diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-22 13:54:04 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-22 14:02:21 -0700 |
commit | fc7e47f18b5d792e268e3eb9453e486eaf73b036 (patch) | |
tree | 6ee9ad2d340a24ccb83c30ca49f1b78fe9fe9a62 /src | |
parent | b53aba93b81ed718ca783818fa31636f43bffda8 (diff) | |
download | diffutils-fc7e47f18b5d792e268e3eb9453e486eaf73b036.tar.gz |
maint: zalloc → xzalloc
* src/util.c (zalloc): Remove. All uses replaced
by xzalloc, which means the same thing.
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze.c | 8 | ||||
-rw-r--r-- | src/diff.h | 3 | ||||
-rw-r--r-- | src/io.c | 2 | ||||
-rw-r--r-- | src/util.c | 10 |
4 files changed, 5 insertions, 18 deletions
diff --git a/src/analyze.c b/src/analyze.c index a5e4bdc..e11f7d4 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -67,7 +67,7 @@ discard_confusing_lines (struct file_data filevec[]) /* Set up equiv_count[F][I] as the number of lines in file F that fall in equivalence class I. */ - p = zalloc (filevec[0].equiv_max * (2 * sizeof *p)); + p = xcalloc (filevec[0].equiv_max, 2 * sizeof *p); equiv_count[0] = p; equiv_count[1] = p + filevec[0].equiv_max; @@ -78,8 +78,8 @@ discard_confusing_lines (struct file_data filevec[]) /* Set up tables of which lines are going to be discarded. */ - discarded[0] = zalloc (filevec[0].buffered_lines - + filevec[1].buffered_lines); + discarded[0] = xzalloc (filevec[0].buffered_lines + + filevec[1].buffered_lines); discarded[1] = discarded[0] + filevec[0].buffered_lines; /* Mark to be discarded each line that matches no line of the other file. @@ -542,7 +542,7 @@ diff_2_files (struct comparison *cmp) Allocate an extra element, always 0, at each end of each vector. */ size_t s = cmp->file[0].buffered_lines + cmp->file[1].buffered_lines + 4; - char *flag_space = zalloc (s); + char *flag_space = xzalloc (s); cmp->file[0].changed = flag_space + 1; cmp->file[1].changed = flag_space + cmp->file[0].buffered_lines + 3; @@ -389,9 +389,6 @@ extern bool lines_differ (char const *, char const *) _GL_ATTRIBUTE_PURE; extern lin translate_line_number (struct file_data const *, lin); extern struct change *find_change (struct change *); extern struct change *find_reverse_change (struct change *); -extern void *zalloc (size_t) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE - _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL; extern enum changes analyze_hunk (struct change *, lin *, lin *, lin *, lin *); extern void begin_output (void); extern void debug_script (struct change *); @@ -806,7 +806,7 @@ read_files (struct file_data filevec[], bool pretend_binary) nbuckets = ((size_t) 1 << i) - prime_offset[i]; if (PTRDIFF_MAX / sizeof *buckets <= nbuckets) xalloc_die (); - buckets = zalloc ((nbuckets + 1) * sizeof *buckets); + buckets = xcalloc (nbuckets + 1, sizeof *buckets); buckets++; for (i = 0; i < 2; i++) @@ -1546,16 +1546,6 @@ concat (char const *s1, char const *s2, char const *s3) sprintf (new, "%s%s%s", s1, s2, s3); return new; } - -/* Yield a new block of SIZE bytes, initialized to zero. */ - -void * -zalloc (size_t size) -{ - void *p = xmalloc (size); - memset (p, 0, size); - return p; -} void debug_script (struct change *sp) |