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 <modocache@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Gesiak committed
May 27, 2014 at 00:33 UTC
f1064f6bc897fe35830c2ecee08f8dd27caf763c
1 file changed
+2
-2
config.c
+2
-2
@@ -1538,7 +1538,7 @@ int git_config_set_multivar_in_file(const char *config_filename,
1538
* The lock serves a purpose in addition to locking: the new
1539
* contents of .git/config will be written into it.
1540
*/
1541
- lock = xcalloc(sizeof(struct lock_file), 1);
1541
+ lock = xcalloc(1, sizeof(struct lock_file));
1542
fd = hold_lock_file_for_update(lock, config_filename, 0);
1543
if (fd < 0) {
1544
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,
1793
if (!config_filename)
1794
config_filename = filename_buf = git_pathdup("config");
1795
1796
- lock = xcalloc(sizeof(struct lock_file), 1);
1796
+ lock = xcalloc(1, sizeof(struct lock_file));
1797
out_fd = hold_lock_file_for_update(lock, config_filename, 0);
1798
if (out_fd < 0) {
1799
ret = error("could not lock config file %s", config_filename);