| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3ac22f8 commit 2756ca4
26 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97,8 +97,7 @@ static struct git_attr *git_attr_internal(const char *name, int len) | |||
| 97 | 97 | a->attr_nr = attr_nr++; | |
| 98 | 98 | git_attr_hash[pos] = a; | |
| 99 | 99 | ||
| 100 | - check_all_attr = xrealloc(check_all_attr, | ||
| 101 | - sizeof(*check_all_attr) * attr_nr); | ||
| 100 | + REALLOC_ARRAY(check_all_attr, attr_nr); | ||
| 102 | 101 | check_all_attr[a->attr_nr].attr = a; | |
| 103 | 102 | check_all_attr[a->attr_nr].value = ATTR__UNKNOWN; | |
| 104 | 103 | return a; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2626,7 +2626,7 @@ static void update_image(struct image *img, | |||
| 2626 | 2626 | * NOTE: this knows that we never call remove_first_line() | |
| 2627 | 2627 | * on anything other than pre/post image. | |
| 2628 | 2628 | */ | |
| 2629 | - img->line = xrealloc(img->line, nr * sizeof(*img->line)); | ||
| 2629 | + REALLOC_ARRAY(img->line, nr); | ||
| 2630 | 2630 | img->line_allocated = img->line; | |
| 2631 | 2631 | } | |
| 2632 | 2632 | if (preimage_limit != postimage->nr) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -138,10 +138,8 @@ static int parse_atom(const char *atom, const char *ep) | |||
| 138 | 138 | /* Add it in, including the deref prefix */ | |
| 139 | 139 | at = used_atom_cnt; | |
| 140 | 140 | used_atom_cnt++; | |
| 141 | - used_atom = xrealloc(used_atom, | ||
| 142 | - (sizeof *used_atom) * used_atom_cnt); | ||
| 143 | - used_atom_type = xrealloc(used_atom_type, | ||
| 144 | - (sizeof(*used_atom_type) * used_atom_cnt)); | ||
| 141 | + REALLOC_ARRAY(used_atom, used_atom_cnt); | ||
| 142 | + REALLOC_ARRAY(used_atom_type, used_atom_cnt); | ||
| 145 | 143 | used_atom[at] = xmemdupz(atom, ep - atom); | |
| 146 | 144 | used_atom_type[at] = valid_atom[i].cmp_type; | |
| 147 | 145 | if (*atom == '*') | |
@@ -870,8 +868,7 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f | |||
| 870 | 868 | ref->flag = flag; | |
| 871 | 869 | ||
| 872 | 870 | cnt = cb->grab_cnt; | |
| 873 | - cb->grab_array = xrealloc(cb->grab_array, | ||
| 874 | - sizeof(*cb->grab_array) * (cnt + 1)); | ||
| 871 | + REALLOC_ARRAY(cb->grab_array, cnt + 1); | ||
| 875 | 872 | cb->grab_array[cnt++] = ref; | |
| 876 | 873 | cb->grab_cnt = cnt; | |
| 877 | 874 | return 0; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1140,9 +1140,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha | |||
| 1140 | 1140 | int nr_objects_initial = nr_objects; | |
| 1141 | 1141 | if (nr_unresolved <= 0) | |
| 1142 | 1142 | die(_("confusion beyond insanity")); | |
| 1143 | - objects = xrealloc(objects, | ||
| 1144 | - (nr_objects + nr_unresolved + 1) | ||
| 1145 | - * sizeof(*objects)); | ||
| 1143 | + REALLOC_ARRAY(objects, nr_objects + nr_unresolved + 1); | ||
| 1146 | 1144 | memset(objects + nr_objects + 1, 0, | |
| 1147 | 1145 | nr_unresolved * sizeof(*objects)); | |
| 1148 | 1146 | f = sha1fd(output_fd, curr_pack); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1440,7 +1440,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) | |||
| 1440 | 1440 | continue; | |
| 1441 | 1441 | ||
| 1442 | 1442 | nr++; | |
| 1443 | - list = xrealloc(list, nr * sizeof(list[0])); | ||
| 1443 | + REALLOC_ARRAY(list, nr); | ||
| 1444 | 1444 | list[nr - 1] = commit; | |
| 1445 | 1445 | } | |
| 1446 | 1446 | if (nr == 0) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -556,7 +556,7 @@ static void parse_branch_merge_options(char *bmo) | |||
| 556 | 556 | if (argc < 0) | |
| 557 | 557 | die(_("Bad branch.%s.mergeoptions string: %s"), branch, | |
| 558 | 558 | split_cmdline_strerror(argc)); | |
| 559 | - argv = xrealloc(argv, sizeof(*argv) * (argc + 2)); | ||
| 559 | + REALLOC_ARRAY(argv, argc + 2); | ||
| 560 | 560 | memmove(argv + 1, argv, sizeof(*argv) * (argc + 1)); | |
| 561 | 561 | argc++; | |
| 562 | 562 | argv[0] = "branch.*.mergeoptions"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,10 +184,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix) | |||
| 184 | 184 | ||
| 185 | 185 | modes[i] = WORKING_DIRECTORY; | |
| 186 | 186 | n = argc + last - first; | |
| 187 | - source = xrealloc(source, n * sizeof(char *)); | ||
| 188 | - destination = xrealloc(destination, n * sizeof(char *)); | ||
| 189 | - modes = xrealloc(modes, n * sizeof(enum update_mode)); | ||
| 190 | - submodule_gitfile = xrealloc(submodule_gitfile, n * sizeof(char *)); | ||
| 187 | + REALLOC_ARRAY(source, n); | ||
| 188 | + REALLOC_ARRAY(destination, n); | ||
| 189 | + REALLOC_ARRAY(modes, n); | ||
| 190 | + REALLOC_ARRAY(submodule_gitfile, n); | ||
| 191 | 191 | ||
| 192 | 192 | dst = add_slash(dst); | |
| 193 | 193 | dst_len = strlen(dst); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,8 +89,7 @@ static void index_commit_for_bitmap(struct commit *commit) | |||
| 89 | 89 | { | |
| 90 | 90 | if (indexed_commits_nr >= indexed_commits_alloc) { | |
| 91 | 91 | indexed_commits_alloc = (indexed_commits_alloc + 32) * 2; | |
| 92 | - indexed_commits = xrealloc(indexed_commits, | ||
| 93 | - indexed_commits_alloc * sizeof(struct commit *)); | ||
| 92 | + REALLOC_ARRAY(indexed_commits, indexed_commits_alloc); | ||
| 94 | 93 | } | |
| 95 | 94 | ||
| 96 | 95 | indexed_commits[indexed_commits_nr++] = commit; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -563,7 +563,7 @@ static int git_show_branch_config(const char *var, const char *value, void *cb) | |||
| 563 | 563 | default_arg[default_num++] = "show-branch"; | |
| 564 | 564 | } else if (default_alloc <= default_num + 1) { | |
| 565 | 565 | default_alloc = default_alloc * 3 / 2 + 20; | |
| 566 | - default_arg = xrealloc(default_arg, sizeof *default_arg * default_alloc); | ||
| 566 | + REALLOC_ARRAY(default_arg, default_alloc); | ||
| 567 | 567 | } | |
| 568 | 568 | default_arg[default_num++] = xstrdup(value); | |
| 569 | 569 | default_arg[default_num] = NULL; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -482,7 +482,7 @@ extern int daemonize(void); | |||
| 482 | 482 | alloc = (nr); \ | |
| 483 | 483 | else \ | |
| 484 | 484 | alloc = alloc_nr(alloc); \ | |
| 485 | - x = xrealloc((x), alloc * sizeof(*(x))); \ | ||
| 485 | + REALLOC_ARRAY(x, alloc); \ | ||
| 486 | 486 | } \ | |
| 487 | 487 | } while (0) | |
| 488 | 488 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments