Skip to content

Commit f1064f6

Browse files
modocachegitster
authored andcommitted
config.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size. config.c includes several calls to xcalloc() that pass the arguments in reverse order: the size of a struct lock_file*, followed by the number to allocate. Rearrange them so they are in the correct order. Signed-off-by: Brian Gesiak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c4a7b00 commit f1064f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ int git_config_set_multivar_in_file(const char *config_filename,
15381538
* The lock serves a purpose in addition to locking: the new
15391539
* contents of .git/config will be written into it.
15401540
*/
1541-
lock = xcalloc(sizeof(struct lock_file), 1);
1541+
lock = xcalloc(1, sizeof(struct lock_file));
15421542
fd = hold_lock_file_for_update(lock, config_filename, 0);
15431543
if (fd < 0) {
15441544
error("could not lock config file %s: %s", config_filename, strerror(errno));
@@ -1793,7 +1793,7 @@ int git_config_rename_section_in_file(const char *config_filename,
17931793
if (!config_filename)
17941794
config_filename = filename_buf = git_pathdup("config");
17951795

1796-
lock = xcalloc(sizeof(struct lock_file), 1);
1796+
lock = xcalloc(1, sizeof(struct lock_file));
17971797
out_fd = hold_lock_file_for_update(lock, config_filename, 0);
17981798
if (out_fd < 0) {
17991799
ret = error("could not lock config file %s", config_filename);

0 commit comments

Comments
 (0)