{"thread":{"id":"36753","subject":"[PATCH 00/15] Rearrange xcalloc arguments","startedAt":"2014-05-26T15:33:41Z","lastAt":"2014-06-10T21:54:49Z","messageCount":28,"participants":["Brian Gesiak","Jeremiah Mahler","Eric Sunshine","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":15},"messages":[{"id":"242669","messageId":"1401118436-66090-1-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":null,"subject":"[PATCH 00/15] Rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:41Z","receivedAt":"2014-05-26T15:33:41Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nThe vast majority of the Git codebase passes these arguments in the\ncorrect order, but there are some exceptions. This patch series\ncorrects those exceptions.\n\nBrian Gesiak (15):\n  builtin/add.c: rearrange xcalloc arguments\n  builtin/ls-remote.c: rearrange xcalloc arguments\n  builtin/remote.c: rearrange xcalloc arguments\n  commit.c: rearrange xcalloc arguments\n  config.c: rearrange xcalloc arguments\n  diff.c: rearrange xcalloc arguments\n  hash.c: rearrange xcalloc arguments\n  hash.h: rearrange xcalloc arguments\n  http-push.c: rearrange xcalloc arguments\n  imap-send.c: rearrange xcalloc arguments\n  notes.c: rearrange xcalloc arguments\n  pack-revindex.c: rearrange xcalloc arguments\n  reflog-walk.c: rearrange xcalloc arguments\n  remote.c: rearrange xcalloc arguments\n  transport-helper.c: rearrange xcalloc arguments\n\nbuiltin/add.c       | 2 +-\nbuiltin/ls-remote.c | 2 +-\nbuiltin/remote.c    | 8 ++++----\ncommit.c            | 2 +-\nconfig.c            | 4 ++--\ndiff.c              | 2 +-\nhash.c              | 2 +-\nhash.h              | 2 +-\nhttp-push.c         | 2 +-\nimap-send.c         | 2 +-\nnotes.c             | 6 +++---\npack-revindex.c     | 2 +-\nreflog-walk.c       | 8 ++++----\nremote.c            | 2 +-\ntransport-helper.c  | 2 +-\n15 files changed, 24 insertions(+), 24 deletions(-)\n\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242671","messageId":"1401118436-66090-2-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:42Z","receivedAt":"2014-05-26T15:33:42Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nrun_add_interactive passes the arguments in reverse order, passing the\nsize of a char*, followed by the number of char* to be allocated.\nRearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n builtin/add.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 672adc0..488acf4 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char *patch_mode,\n \tint status, ac, i;\n \tconst char **args;\n \n-\targs = xcalloc(sizeof(const char *), (pathspec->nr + 6));\n+\targs = xcalloc((pathspec->nr + 6), sizeof(const char *));\n \tac = 0;\n \targs[ac++] = \"add--interactive\";\n \tif (patch_mode)\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242670","messageId":"1401118436-66090-3-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 02/15] builtin/ls-remote.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:43Z","receivedAt":"2014-05-26T15:33:43Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\ncmd_ls_remote passes the arguments in reverse order, passing the\nsize of a char*, followed by the number of char* to be allocated.\nRearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n builtin/ls-remote.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/ls-remote.c b/builtin/ls-remote.c\nindex 39e5144..aec1c0c 100644\n--- a/builtin/ls-remote.c\n+++ b/builtin/ls-remote.c\n@@ -92,7 +92,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)\n \n \tif (argv[i]) {\n \t\tint j;\n-\t\tpattern = xcalloc(sizeof(const char *), argc - i + 1);\n+\t\tpattern = xcalloc(argc - i + 1, sizeof(const char *));\n \t\tfor (j = i; j < argc; j++) {\n \t\t\tint len = strlen(argv[j]);\n \t\t\tchar *p = xmalloc(len + 3);\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242672","messageId":"1401118436-66090-4-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 03/15] builtin/remote.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:44Z","receivedAt":"2014-05-26T15:33:44Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nbuiltin/remote.c includes several calls to xcalloc that pass the\narguments in reverse order. Rearrgange them so they are in the\ncorrect order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n builtin/remote.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex b3ab4cf..9f62021 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -282,7 +282,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\titem = string_list_insert(&branch_list, name);\n \n \t\tif (!item->util)\n-\t\t\titem->util = xcalloc(sizeof(struct branch_info), 1);\n+\t\t\titem->util = xcalloc(1, sizeof(struct branch_info));\n \t\tinfo = item->util;\n \t\tif (type == REMOTE) {\n \t\t\tif (info->remote_name)\n@@ -398,7 +398,7 @@ static int get_push_ref_states(const struct ref *remote_refs,\n \n \t\titem = string_list_append(&states->push,\n \t\t\t\t\t  abbrev_branch(ref->peer_ref->name));\n-\t\titem->util = xcalloc(sizeof(struct push_info), 1);\n+\t\titem->util = xcalloc(1, sizeof(struct push_info));\n \t\tinfo = item->util;\n \t\tinfo->forced = ref->force;\n \t\tinfo->dest = xstrdup(abbrev_branch(ref->name));\n@@ -433,7 +433,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)\n \tstates->push.strdup_strings = 1;\n \tif (!remote->push_refspec_nr) {\n \t\titem = string_list_append(&states->push, _(\"(matching)\"));\n-\t\tinfo = item->util = xcalloc(sizeof(struct push_info), 1);\n+\t\tinfo = item->util = xcalloc(1, sizeof(struct push_info));\n \t\tinfo->status = PUSH_STATUS_NOTQUERIED;\n \t\tinfo->dest = xstrdup(item->string);\n \t}\n@@ -446,7 +446,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)\n \t\telse\n \t\t\titem = string_list_append(&states->push, _(\"(delete)\"));\n \n-\t\tinfo = item->util = xcalloc(sizeof(struct push_info), 1);\n+\t\tinfo = item->util = xcalloc(1, sizeof(struct push_info));\n \t\tinfo->forced = spec->force;\n \t\tinfo->status = PUSH_STATUS_NOTQUERIED;\n \t\tinfo->dest = xstrdup(spec->dst ? spec->dst : item->string);\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242683","messageId":"1401118436-66090-5-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 04/15] commit.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:45Z","receivedAt":"2014-05-26T15:33:45Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nreduce_heads passes the arguments in reverse order, passing the\nsize of a commit*, followed by the number of commit* to be allocated.\nRearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n commit.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/commit.c b/commit.c\nindex 6bf4fe0..0fe685f 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -1041,7 +1041,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)\n \t\tp->item->object.flags |= STALE;\n \t\tnum_head++;\n \t}\n-\tarray = xcalloc(sizeof(*array), num_head);\n+\tarray = xcalloc(num_head, sizeof(*array));\n \tfor (p = heads, i = 0; p; p = p->next) {\n \t\tif (p->item->object.flags & STALE) {\n \t\t\tarray[i++] = p->item;\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242684","messageId":"1401118436-66090-6-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 05/15] config.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:46Z","receivedAt":"2014-05-26T15:33:46Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nconfig.c includes several calls to xcalloc that pass the arguments\nin reverse order: the size of a struct lock_file*, followed by the\nnumber to allocate. Rearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n config.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 314d8ee..c3612cc 100644\n--- a/config.c\n+++ b/config.c\n@@ -1536,7 +1536,7 @@ int git_config_set_multivar_in_file(const char *config_filename,\n \t * The lock serves a purpose in addition to locking: the new\n \t * contents of .git/config will be written into it.\n \t */\n-\tlock = xcalloc(sizeof(struct lock_file), 1);\n+\tlock = xcalloc(1, sizeof(struct lock_file));\n \tfd = hold_lock_file_for_update(lock, config_filename, 0);\n \tif (fd < 0) {\n \t\terror(\"could not lock config file %s: %s\", config_filename, strerror(errno));\n@@ -1791,7 +1791,7 @@ int git_config_rename_section_in_file(const char *config_filename,\n \tif (!config_filename)\n \t\tconfig_filename = filename_buf = git_pathdup(\"config\");\n \n-\tlock = xcalloc(sizeof(struct lock_file), 1);\n+\tlock = xcalloc(1, sizeof(struct lock_file));\n \tout_fd = hold_lock_file_for_update(lock, config_filename, 0);\n \tif (out_fd < 0) {\n \t\tret = error(\"could not lock config file %s\", config_filename);\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242674","messageId":"1401118436-66090-7-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 06/15] diff.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:47Z","receivedAt":"2014-05-26T15:33:47Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\ndiffstat_add passes the arguments in reverse order, passing the\nsize of a diffstat_file*, followed by the number of diffstat_file* to\nbe allocated. Rearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n diff.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/diff.c b/diff.c\nindex 635dee2..a71dfde 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1360,7 +1360,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat,\n \t\t\t\t\t  const char *name_b)\n {\n \tstruct diffstat_file *x;\n-\tx = xcalloc(sizeof (*x), 1);\n+\tx = xcalloc(1, sizeof(*x));\n \tif (diffstat->nr == diffstat->alloc) {\n \t\tdiffstat->alloc = alloc_nr(diffstat->alloc);\n \t\tdiffstat->files = xrealloc(diffstat->files,\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242673","messageId":"1401118436-66090-8-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 07/15] hash.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:48Z","receivedAt":"2014-05-26T15:33:48Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\ngrow_hash_table passes the arguments in reverse order, passing the\nsize of a hash table entry, followed by the number of entries.\nRearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n hash.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/hash.c b/hash.c\nindex 749ecfe..2067be9 100644\n--- a/hash.c\n+++ b/hash.c\n@@ -53,7 +53,7 @@ static void grow_hash_table(struct hash_table *table)\n \tstruct hash_table_entry *old_array = table->array, *new_array;\n \n \tnew_size = alloc_nr(old_size);\n-\tnew_array = xcalloc(sizeof(struct hash_table_entry), new_size);\n+\tnew_array = xcalloc(new_size, sizeof(struct hash_table_entry));\n \ttable->size = new_size;\n \ttable->array = new_array;\n \ttable->nr = 0;\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242682","messageId":"1401118436-66090-9-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 08/15] hash.h: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:49Z","receivedAt":"2014-05-26T15:33:49Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nprellocate_hash passes the arguments in reverse order, passing the\nsize of a hash table entry, followed by the number of entries.\nRearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n hash.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/hash.h b/hash.h\nindex 1d43ac0..3b5d9e7 100644\n--- a/hash.h\n+++ b/hash.h\n@@ -44,7 +44,7 @@ static inline void preallocate_hash(struct hash_table *table, unsigned int elts)\n {\n \tassert(table->size == 0 && table->nr == 0 && table->array == NULL);\n \ttable->size = elts * 2;\n-\ttable->array = xcalloc(sizeof(struct hash_table_entry), table->size);\n+\ttable->array = xcalloc(table->size, sizeof(struct hash_table_entry));\n }\n \n #endif\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242676","messageId":"1401118436-66090-10-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 09/15] http-push.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:50Z","receivedAt":"2014-05-26T15:33:50Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nhttp-push passes the arguments in reverse order, passing the size\nof a repo, followed by the number to allocate. Rearrgange them so\nthey are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n http-push.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex d4b40c9..1c722e5 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1733,7 +1733,7 @@ int main(int argc, char **argv)\n \n \tgit_extract_argv0_path(argv[0]);\n \n-\trepo = xcalloc(sizeof(*repo), 1);\n+\trepo = xcalloc(1, sizeof(*repo));\n \n \targv++;\n \tfor (i = 1; i < argc; i++, argv++) {\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242675","messageId":"1401118436-66090-11-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 10/15] imap-send.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:51Z","receivedAt":"2014-05-26T15:33:51Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nimap_open_store passes the arguments in reverse order, passing the\nsize of an imap_store*, followed by the number to allocate.\nRearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n imap-send.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 0bc6f7f..45230e1 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -951,7 +951,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc)\n \tchar *arg, *rsp;\n \tint s = -1, preauth;\n \n-\tctx = xcalloc(sizeof(*ctx), 1);\n+\tctx = xcalloc(1, sizeof(*ctx));\n \n \tctx->imap = imap = xcalloc(sizeof(*imap), 1);\n \timap->buf.sock.fd[0] = imap->buf.sock.fd[1] = -1;\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242678","messageId":"1401118436-66090-12-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 11/15] notes.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:52Z","receivedAt":"2014-05-26T15:33:52Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nnotes.c includes several calls to xcalloc that pass the arguments in\nreverse order. Rearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n notes.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/notes.c b/notes.c\nindex 5f07c0b..5fe691d 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -303,7 +303,7 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree,\n \t\tfree(entry);\n \t\treturn 0;\n \t}\n-\tnew_node = (struct int_node *) xcalloc(sizeof(struct int_node), 1);\n+\tnew_node = (struct int_node *) xcalloc(1, sizeof(struct int_node));\n \tret = note_tree_insert(t, new_node, n + 1, l, GET_PTR_TYPE(*p),\n \t\t\t       combine_notes);\n \tif (ret)\n@@ -443,7 +443,7 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,\n \t\tif (len <= 20) {\n \t\t\ttype = PTR_TYPE_NOTE;\n \t\t\tl = (struct leaf_node *)\n-\t\t\t\txcalloc(sizeof(struct leaf_node), 1);\n+\t\t\t\txcalloc(1, sizeof(struct leaf_node));\n \t\t\thashcpy(l->key_sha1, object_sha1);\n \t\t\thashcpy(l->val_sha1, entry.sha1);\n \t\t\tif (len < 20) {\n@@ -1003,7 +1003,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,\n \tif (!combine_notes)\n \t\tcombine_notes = combine_notes_concatenate;\n \n-\tt->root = (struct int_node *) xcalloc(sizeof(struct int_node), 1);\n+\tt->root = (struct int_node *) xcalloc(1, sizeof(struct int_node));\n \tt->first_non_note = NULL;\n \tt->prev_non_note = NULL;\n \tt->ref = notes_ref ? xstrdup(notes_ref) : NULL;\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242681","messageId":"1401118436-66090-13-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 12/15] pack-revindex.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:53Z","receivedAt":"2014-05-26T15:33:53Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\ninit_pack_revindex passes the arguments in reverse order, passing the\nsize of a pack_revindex, followed by the number to allocate.\nRearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n pack-revindex.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/pack-revindex.c b/pack-revindex.c\nindex b4d2b35..f84979b 100644\n--- a/pack-revindex.c\n+++ b/pack-revindex.c\n@@ -50,7 +50,7 @@ static void init_pack_revindex(void)\n \tif (!num)\n \t\treturn;\n \tpack_revindex_hashsz = num * 11;\n-\tpack_revindex = xcalloc(sizeof(*pack_revindex), pack_revindex_hashsz);\n+\tpack_revindex = xcalloc(pack_revindex_hashsz, sizeof(*pack_revindex));\n \tfor (p = packed_git; p; p = p->next) {\n \t\tnum = pack_revindex_ix(p);\n \t\tnum = - 1 - num;\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242677","messageId":"1401118436-66090-14-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 13/15] reflog-walk.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:54Z","receivedAt":"2014-05-26T15:33:54Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nreflog-walk.c includes several calls to xcalloc that pass the arguments\nin reverse order. Rearrgange them so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n reflog-walk.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/reflog-walk.c b/reflog-walk.c\nindex b2fbdb2..f8d8f13 100644\n--- a/reflog-walk.c\n+++ b/reflog-walk.c\n@@ -45,7 +45,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,\n static struct complete_reflogs *read_complete_reflog(const char *ref)\n {\n \tstruct complete_reflogs *reflogs =\n-\t\txcalloc(sizeof(struct complete_reflogs), 1);\n+\t\txcalloc(1, sizeof(struct complete_reflogs));\n \treflogs->ref = xstrdup(ref);\n \tfor_each_reflog_ent(ref, read_one_reflog, reflogs);\n \tif (reflogs->nr == 0) {\n@@ -143,7 +143,7 @@ struct reflog_walk_info {\n \n void init_reflog_walk(struct reflog_walk_info** info)\n {\n-\t*info = xcalloc(sizeof(struct reflog_walk_info), 1);\n+\t*info = xcalloc(1, sizeof(struct reflog_walk_info));\n }\n \n int add_reflog_for_walk(struct reflog_walk_info *info,\n@@ -207,7 +207,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,\n \t\t\t= reflogs;\n \t}\n \n-\tcommit_reflog = xcalloc(sizeof(struct commit_reflog), 1);\n+\tcommit_reflog = xcalloc(1, sizeof(struct commit_reflog));\n \tif (recno < 0) {\n \t\tcommit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);\n \t\tif (commit_reflog->recno < 0) {\n@@ -250,7 +250,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)\n \t\treturn;\n \t}\n \n-\tcommit->parents = xcalloc(sizeof(struct commit_list), 1);\n+\tcommit->parents = xcalloc(1, sizeof(struct commit_list));\n \tcommit->parents->item = commit_info->commit;\n }\n \n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242680","messageId":"1401118436-66090-15-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 14/15] remote.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:55Z","receivedAt":"2014-05-26T15:33:55Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\nparse_refspec_internal passes the arguments in reverse order, passing the\nsize of a refspec, followed by the number to allocate. Rearrgange them\nso they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n remote.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/remote.c b/remote.c\nindex ebed40d..df3267b 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -523,7 +523,7 @@ static void free_refspecs(struct refspec *refspec, int nr_refspec)\n static struct refspec *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify)\n {\n \tint i;\n-\tstruct refspec *rs = xcalloc(sizeof(*rs), nr_refspec);\n+\tstruct refspec *rs = xcalloc(nr_refspec, sizeof(*rs));\n \n \tfor (i = 0; i < nr_refspec; i++) {\n \t\tsize_t llen;\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242679","messageId":"1401118436-66090-16-git-send-email-modocache@gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"[PATCH 15/15] transport-helper.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-26T15:33:56Z","receivedAt":"2014-05-26T15:33:56Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"xcalloc takes two arguments: the number of elements and their size.\ntransport_helper_init passes the arguments in reverse order, passing the\nsize of a helper_data*, followed by the number to allocate. Rearrgange\nthem so they are in the correct order.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n transport-helper.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex ad72fbd..cf48913 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -1002,7 +1002,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)\n \n int transport_helper_init(struct transport *transport, const char *name)\n {\n-\tstruct helper_data *data = xcalloc(sizeof(*data), 1);\n+\tstruct helper_data *data = xcalloc(1, sizeof(*data));\n \tdata->name = name;\n \n \tif (getenv(\"GIT_TRANSPORT_HELPER_DEBUG\"))\n-- \n2.0.0.rc1.543.gc8042da\n"},{"id":"242710","messageId":"20140526231156.GA8570@hudson.localdomain","threadId":"36753","inReplyTo":"1401118436-66090-2-git-send-email-modocache@gmail.com","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-05-26T23:11:56Z","receivedAt":"2014-05-26T23:11:56Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Brian,\n\nOn Tue, May 27, 2014 at 12:33:42AM +0900, Brian Gesiak wrote:\n> xcalloc takes two arguments: the number of elements and their size.\n> run_add_interactive passes the arguments in reverse order, passing the\n> size of a char*, followed by the number of char* to be allocated.\n> Rearrgange them so they are in the correct order.\n> \n> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n> ---\n>  builtin/add.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/builtin/add.c b/builtin/add.c\n> index 672adc0..488acf4 100644\n> --- a/builtin/add.c\n> +++ b/builtin/add.c\n> @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char *patch_mode,\n>  \tint status, ac, i;\n>  \tconst char **args;\n>  \n> -\targs = xcalloc(sizeof(const char *), (pathspec->nr + 6));\n> +\targs = xcalloc((pathspec->nr + 6), sizeof(const char *));\n>  \tac = 0;\n>  \targs[ac++] = \"add--interactive\";\n>  \tif (patch_mode)\n> \n\nThis patch doesn't apply to any of the branches I have available\n(master, pu, next).  And there is no line containing \"pathspec->nr + 6\"\nanywhere in my builtin/add.c.  Which branch is your work based off?\n\n-- \nJeremiah Mahler\njmmahler@gmail.com\nhttp://github.com/jmahler\n"},{"id":"242711","messageId":"20140526233741.GB8570@hudson.localdomain","threadId":"36753","inReplyTo":"1401118436-66090-1-git-send-email-modocache@gmail.com","subject":"Re: [PATCH 00/15] Rearrange xcalloc arguments","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-05-26T23:37:41Z","receivedAt":"2014-05-26T23:37:41Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Brian,\n\nOn Tue, May 27, 2014 at 12:33:41AM +0900, Brian Gesiak wrote:\n> xcalloc takes two arguments: the number of elements and their size.\n> The vast majority of the Git codebase passes these arguments in the\n> correct order, but there are some exceptions. This patch series\n> corrects those exceptions.\n> \n\nLet me see if I understand the issue underlying this patch set.\n\nxcalloc works like calloc and takes two arguments, the number of\nelements and the size of each element.  However, many calls specified\nthese arguments in the reverse order.  It didn't produce a compile\nerror because both arguments are the same type.  And it didn't produce\na run time error because A*B is the same as B*A.\n\nIf this behaved like dd, performance would be different depending on the\norder.\n\n  dd if=in of=out bs=1    count=1024\n  dd if=in of=out bs=1024 count=1\n\nNonetheless, it appears to be a good fix.  Nice job!\n\n-- \nJeremiah Mahler\njmmahler@gmail.com\nhttp://github.com/jmahler\n"},{"id":"242713","messageId":"CAN7MxmUPH5-qgZQ-Wm0GeenNmqHvtwtx5WkXynNX9zRP3Yr1tQ@mail.gmail.com","threadId":"36753","inReplyTo":"20140526231156.GA8570@hudson.localdomain","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-27T02:22:00Z","receivedAt":"2014-05-27T02:22:00Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"My apologies! I based my work off of maint, branching off of eea591.\n\nMy reasoning was that Documentation/SubmittingPatches states that \"a\nbugfix should be based on 'maint'\". [1] Now that I think about it,\nthis is probably not the kind of \"bug\" that statement had in mind.\n\nShould I reroll the patch based on master?\n\n- Brian Gesiak\n\n[1] https://github.com/git/git/blob/4a28f169ad29ba452e0e7bea2583914c10c58322/Documentation/SubmittingPatches#L9\n\nOn Tue, May 27, 2014 at 8:11 AM, Jeremiah Mahler <jmmahler@gmail.com> wrote:\n> Brian,\n>\n> On Tue, May 27, 2014 at 12:33:42AM +0900, Brian Gesiak wrote:\n>> xcalloc takes two arguments: the number of elements and their size.\n>> run_add_interactive passes the arguments in reverse order, passing the\n>> size of a char*, followed by the number of char* to be allocated.\n>> Rearrgange them so they are in the correct order.\n>>\n>> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n>> ---\n>>  builtin/add.c | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/builtin/add.c b/builtin/add.c\n>> index 672adc0..488acf4 100644\n>> --- a/builtin/add.c\n>> +++ b/builtin/add.c\n>> @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char *patch_mode,\n>>       int status, ac, i;\n>>       const char **args;\n>>\n>> -     args = xcalloc(sizeof(const char *), (pathspec->nr + 6));\n>> +     args = xcalloc((pathspec->nr + 6), sizeof(const char *));\n>>       ac = 0;\n>>       args[ac++] = \"add--interactive\";\n>>       if (patch_mode)\n>>\n>\n> This patch doesn't apply to any of the branches I have available\n> (master, pu, next).  And there is no line containing \"pathspec->nr + 6\"\n> anywhere in my builtin/add.c.  Which branch is your work based off?\n>\n> --\n> Jeremiah Mahler\n> jmmahler@gmail.com\n> http://github.com/jmahler\n"},{"id":"242714","messageId":"20140527023838.GA16507@hudson.localdomain","threadId":"36753","inReplyTo":"CAN7MxmUPH5-qgZQ-Wm0GeenNmqHvtwtx5WkXynNX9zRP3Yr1tQ@mail.gmail.com","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-05-27T02:38:38Z","receivedAt":"2014-05-27T02:38:38Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"On Tue, May 27, 2014 at 11:22:00AM +0900, Brian Gesiak wrote:\n> My apologies! I based my work off of maint, branching off of eea591.\n> \n> My reasoning was that Documentation/SubmittingPatches states that \"a\n> bugfix should be based on 'maint'\". [1] Now that I think about it,\n> this is probably not the kind of \"bug\" that statement had in mind.\n> \n> Should I reroll the patch based on master?\n> \n> - Brian Gesiak\n> \n> [1] https://github.com/git/git/blob/4a28f169ad29ba452e0e7bea2583914c10c58322/Documentation/SubmittingPatches#L9\n> \n\nOK, got it.  I should have read Documentation/SubmittingPatches more\nclosely like you did :-)  No need to reroll I can just use the maint\nbranch to test it out.  Thanks!\n\n-- \nJeremiah Mahler\njmmahler@gmail.com\nhttp://github.com/jmahler\n"},{"id":"242715","messageId":"CAPig+cRE0LUaNLTJARBCmoDn7cR1bbgi8At0ChgSDWBjDPaNjg@mail.gmail.com","threadId":"36753","inReplyTo":"1401118436-66090-2-git-send-email-modocache@gmail.com","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-05-27T03:25:47Z","receivedAt":"2014-05-27T03:25:47Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, May 26, 2014 at 11:33 AM, Brian Gesiak <modocache@gmail.com> wrote:\n> xcalloc takes two arguments: the number of elements and their size.\n> run_add_interactive passes the arguments in reverse order, passing the\n> size of a char*, followed by the number of char* to be allocated.\n> Rearrgange them so they are in the correct order.\n\ns/Rearrgange/Rearrange/\n\nSame misspelling afflicts the entire patch series.\n\n> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n> ---\n>  builtin/add.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/builtin/add.c b/builtin/add.c\n> index 672adc0..488acf4 100644\n> --- a/builtin/add.c\n> +++ b/builtin/add.c\n> @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char *patch_mode,\n>         int status, ac, i;\n>         const char **args;\n>\n> -       args = xcalloc(sizeof(const char *), (pathspec->nr + 6));\n> +       args = xcalloc((pathspec->nr + 6), sizeof(const char *));\n>         ac = 0;\n>         args[ac++] = \"add--interactive\";\n>         if (patch_mode)\n> --\n> 2.0.0.rc1.543.gc8042da\n"},{"id":"242738","messageId":"CAN7MxmXVDTiQv5J9cU2E8iS=BNROw3q9NVaBuG7aQP-7=Qo_ZQ@mail.gmail.com","threadId":"36753","inReplyTo":"CAPig+cRE0LUaNLTJARBCmoDn7cR1bbgi8At0ChgSDWBjDPaNjg@mail.gmail.com","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-27T11:32:54Z","receivedAt":"2014-05-27T11:32:54Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"Oomph, how embarrassing. Thanks for pointing that out!\n\nWould it be better if I rerolled the patches?\n\n- Brian Gesiak\n\nOn Tue, May 27, 2014 at 12:25 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Mon, May 26, 2014 at 11:33 AM, Brian Gesiak <modocache@gmail.com> wrote:\n>> xcalloc takes two arguments: the number of elements and their size.\n>> run_add_interactive passes the arguments in reverse order, passing the\n>> size of a char*, followed by the number of char* to be allocated.\n>> Rearrgange them so they are in the correct order.\n>\n> s/Rearrgange/Rearrange/\n>\n> Same misspelling afflicts the entire patch series.\n>\n>> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n>> ---\n>>  builtin/add.c | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/builtin/add.c b/builtin/add.c\n>> index 672adc0..488acf4 100644\n>> --- a/builtin/add.c\n>> +++ b/builtin/add.c\n>> @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char *patch_mode,\n>>         int status, ac, i;\n>>         const char **args;\n>>\n>> -       args = xcalloc(sizeof(const char *), (pathspec->nr + 6));\n>> +       args = xcalloc((pathspec->nr + 6), sizeof(const char *));\n>>         ac = 0;\n>>         args[ac++] = \"add--interactive\";\n>>         if (patch_mode)\n>> --\n>> 2.0.0.rc1.543.gc8042da\n"},{"id":"242817","messageId":"CAPig+cTmyBzroDOnqEb_GWqhcbgbK27pT3=3VCVOnj13=C4CfA@mail.gmail.com","threadId":"36753","inReplyTo":"CAN7MxmXVDTiQv5J9cU2E8iS=BNROw3q9NVaBuG7aQP-7=Qo_ZQ@mail.gmail.com","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-05-27T21:35:29Z","receivedAt":"2014-05-27T21:35:29Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, May 27, 2014 at 7:32 AM, Brian Gesiak <modocache@gmail.com> wrote:\n> Oomph, how embarrassing. Thanks for pointing that out!\n\nEtiquette on this list is to avoid top-posting [1].\n\n[1]: https://lkml.org/lkml/2005/1/11/111\n\n> Would it be better if I rerolled the patches?\n\nJunio may or may not make small fixes himself when he picks up a patch\nseries. If you don't hear from him and your patches don't appear in\nhis 'pu' branch with that fix, re-rolling might be advisable.\n\n> - Brian Gesiak\n>\n> On Tue, May 27, 2014 at 12:25 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n>> On Mon, May 26, 2014 at 11:33 AM, Brian Gesiak <modocache@gmail.com> wrote:\n>>> xcalloc takes two arguments: the number of elements and their size.\n>>> run_add_interactive passes the arguments in reverse order, passing the\n>>> size of a char*, followed by the number of char* to be allocated.\n>>> Rearrgange them so they are in the correct order.\n\nIf you do re-roll, perhaps consider simplifying the commit messages.\nThe patch itself states concisely and precisely what is being changed;\nthe lengthy prose description doesn't really add anything (and makes\nmore work for you and the reader of the message). It might be\nsufficient to use a single-line (Subject:) commit message, like this:\n\n    builtin/add.c: fix order of xcalloc arguments\n\n>> s/Rearrgange/Rearrange/\n>>\n>> Same misspelling afflicts the entire patch series.\n>>\n>>> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n>>> ---\n>>>  builtin/add.c | 2 +-\n>>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>>\n>>> diff --git a/builtin/add.c b/builtin/add.c\n>>> index 672adc0..488acf4 100644\n>>> --- a/builtin/add.c\n>>> +++ b/builtin/add.c\n>>> @@ -248,7 +248,7 @@ int run_add_interactive(const char *revision, const char *patch_mode,\n>>>         int status, ac, i;\n>>>         const char **args;\n>>>\n>>> -       args = xcalloc(sizeof(const char *), (pathspec->nr + 6));\n>>> +       args = xcalloc((pathspec->nr + 6), sizeof(const char *));\n>>>         ac = 0;\n>>>         args[ac++] = \"add--interactive\";\n>>>         if (patch_mode)\n>>> --\n>>> 2.0.0.rc1.543.gc8042da\n"},{"id":"242821","messageId":"xmqqsinueteo.fsf@gitster.dls.corp.google.com","threadId":"36753","inReplyTo":"CAPig+cTmyBzroDOnqEb_GWqhcbgbK27pT3=3VCVOnj13=C4CfA@mail.gmail.com","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-05-27T22:41:35Z","receivedAt":"2014-05-27T22:41:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> If you do re-roll, perhaps consider simplifying the commit messages.\n> The patch itself states concisely and precisely what is being changed;\n> the lengthy prose description doesn't really add anything (and makes\n> more work for you and the reader of the message). It might be\n> sufficient to use a single-line (Subject:) commit message, like this:\n>\n>     builtin/add.c: fix order of xcalloc arguments\n\nYeah, I like that.\n\nI do not think it is worth doing this change starting from maint, so\nI've dropped this one and a few others that did not apply to master\nand queued the remainder to 'pu'.\n"},{"id":"242831","messageId":"20140528011658.GA17688@sigill.intra.peff.net","threadId":"36753","inReplyTo":"20140526233741.GB8570@hudson.localdomain","subject":"Re: [PATCH 00/15] Rearrange xcalloc arguments","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-05-28T01:16:58Z","receivedAt":"2014-05-28T01:16:58Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, May 26, 2014 at 04:37:41PM -0700, Jeremiah Mahler wrote:\n\n> > xcalloc takes two arguments: the number of elements and their size.\n> > The vast majority of the Git codebase passes these arguments in the\n> > correct order, but there are some exceptions. This patch series\n> > corrects those exceptions.\n> > \n> \n> Let me see if I understand the issue underlying this patch set.\n> \n> xcalloc works like calloc and takes two arguments, the number of\n> elements and the size of each element.  However, many calls specified\n> these arguments in the reverse order.  It didn't produce a compile\n> error because both arguments are the same type.  And it didn't produce\n> a run time error because A*B is the same as B*A.\n\nYes, I think that is a good summary.\n\nIt may be theoretically possible that an implementation of calloc()\ncan use the distinction between the two arguments to adjust the padding\nor alignment of the result. However, I don't know if any implementation\nactually does this, or if it is even true in theory. You can find\nsome discussions[1,2] online, but nothing conclusive. The most plausible\ntheory I saw is that early K&R C may have done something clever here,\nbut ANSI C alignment requirements effectively remove any wiggle room for\nthe implementation.\n\nBut it certainly does not hurt to follow the spec and be consistent.\n\n-Peff\n\n[1] http://stackoverflow.com/questions/501839/is-calloc4-6-the-same-as-calloc6-4\n\n[2] https://groups.google.com/d/msg/comp.lang.c/jZbiyuYqjB4/NIAmeNd11IoJ\n"},{"id":"242835","messageId":"20140528051411.GA3095@hudson.localdomain","threadId":"36753","inReplyTo":"CAPig+cTmyBzroDOnqEb_GWqhcbgbK27pT3=3VCVOnj13=C4CfA@mail.gmail.com","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-05-28T05:14:11Z","receivedAt":"2014-05-28T05:14:11Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"On Tue, May 27, 2014 at 05:35:29PM -0400, Eric Sunshine wrote:\n> On Tue, May 27, 2014 at 7:32 AM, Brian Gesiak <modocache@gmail.com> wrote:\n> > Oomph, how embarrassing. Thanks for pointing that out!\n> \n> Etiquette on this list is to avoid top-posting [1].\n> \n> [1]: https://lkml.org/lkml/2005/1/11/111\n> \n\nA: Because it messes up the order in which people normally read text.\nQ: Why is top-posting such a bad thing?\n\nThat is the funniest post I have ever seen by Kroah.\n\n-- \nJeremiah Mahler\njmmahler@gmail.com\nhttp://github.com/jmahler\n"},{"id":"242836","messageId":"CAN7MxmU3gcpbdS-Xx3AE=ftUMeJfRvcCfO7Qs=a2W0jgORdx9g@mail.gmail.com","threadId":"36753","inReplyTo":"20140528051411.GA3095@hudson.localdomain","subject":"Re: [PATCH 01/15] builtin/add.c: rearrange xcalloc arguments","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-05-28T05:56:18Z","receivedAt":"2014-05-28T05:56:18Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"On Wed, May 28, 2014 at 7:41 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> I do not think it is worth doing this change starting from maint, so\n> I've dropped this one and a few others that did not apply to master\n> and queued the remainder to 'pu'.\n\nThank you! I'll keep this in mind when choosing what to branch off of\nin the future.\n\nOn Wed, May 28, 2014 at 6:35 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> Etiquette on this list is to avoid top-posting [1].\n> ...\n> If you do re-roll, perhaps consider simplifying the commit messages.\n\nThank you for the tips; very much appreciated.\n\n- Brian Gesiak\n"},{"id":"243808","messageId":"20140610215449.GA1783@hudson.localdomain","threadId":"36753","inReplyTo":"1401118436-66090-11-git-send-email-modocache@gmail.com","subject":"Re: [PATCH 10/15] imap-send.c: rearrange xcalloc arguments","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-10T21:54:49Z","receivedAt":"2014-06-10T21:54:49Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Brian,\n\nOn Tue, May 27, 2014 at 12:33:51AM +0900, Brian Gesiak wrote:\n> xcalloc takes two arguments: the number of elements and their size.\n> imap_open_store passes the arguments in reverse order, passing the\n> size of an imap_store*, followed by the number to allocate.\n> Rearrgange them so they are in the correct order.\n> \n> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n> ---\n>  imap-send.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/imap-send.c b/imap-send.c\n> index 0bc6f7f..45230e1 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -951,7 +951,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc)\n>  \tchar *arg, *rsp;\n>  \tint s = -1, preauth;\n>  \n> -\tctx = xcalloc(sizeof(*ctx), 1);\n> +\tctx = xcalloc(1, sizeof(*ctx));\n>  \n>  \tctx->imap = imap = xcalloc(sizeof(*imap), 1);\n                       ^^^^^^^^^^^^^^^^^^^^^^^^\n\nWhy wasn't the second instance swapped?  It is still this way in the\nlatest 'pu' branch.\n\n-- \nJeremiah Mahler\njmmahler@gmail.com\nhttp://github.com/jmahler\n"}]}