summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorBrian Gesiak <modocache@gmail.com>2014-05-26 15:33:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-05-27 21:00:44 (GMT)
commitf1064f6bc897fe35830c2ecee08f8dd27caf763c (patch)
tree83fa4d32de8d94c4b6f887d34d510046fb0075a3 /config.c
parentc4a7b0092bbe39a6b05ddd65a6b3e45565203367 (diff)
downloadgit-f1064f6bc897fe35830c2ecee08f8dd27caf763c.zip
git-f1064f6bc897fe35830c2ecee08f8dd27caf763c.tar.gz
git-f1064f6bc897fe35830c2ecee08f8dd27caf763c.tar.bz2
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>
Diffstat (limited to 'config.c')
-rw-r--r--config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/config.c b/config.c
index a30cb5c..6bd3575 100644
--- a/config.c
+++ b/config.c
@@ -1538,7 +1538,7 @@ int git_config_set_multivar_in_file(const char *config_filename,
* The lock serves a purpose in addition to locking: the new
* contents of .git/config will be written into it.
*/
- lock = xcalloc(sizeof(struct lock_file), 1);
+ lock = xcalloc(1, sizeof(struct lock_file));
fd = hold_lock_file_for_update(lock, config_filename, 0);
if (fd < 0) {
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,
if (!config_filename)
config_filename = filename_buf = git_pathdup("config");
- lock = xcalloc(sizeof(struct lock_file), 1);
+ lock = xcalloc(1, sizeof(struct lock_file));
out_fd = hold_lock_file_for_update(lock, config_filename, 0);
if (out_fd < 0) {
ret = error("could not lock config file %s", config_filename);