+2021-05-30 Paul Eggert <eggert@cs.ucla.edu>
+
+ dfa, etc.: prefer xreallocarray to older name
+ * lib/dfa.c (addtok_mb, realloc_trans_if_necessary, enlist):
+ * lib/readtokens.c (readtokens):
+ * tests/uninorm/test-u32-normalize-big.c:
+ (read_normalization_test_file):
+ Prefer xreallocarray to the equivalent xnrealloc.
+ The newer name follows the glibc lead of ‘reallocarray’.
+
2021-05-30 Bruno Haible <bruno@clisp.org>
Write 'LGPLv3+ or GPLv2+' instead of 'LGPLv3+ or GPLv2'.
dfa->tokens = xpalloc (dfa->tokens, &dfa->talloc, 1, -1,
sizeof *dfa->tokens);
if (dfa->localeinfo.multibyte)
- dfa->multibyte_prop = xnrealloc (dfa->multibyte_prop, dfa->talloc,
- sizeof *dfa->multibyte_prop);
+ dfa->multibyte_prop = xreallocarray (dfa->multibyte_prop, dfa->talloc,
+ sizeof *dfa->multibyte_prop);
}
if (dfa->localeinfo.multibyte)
dfa->multibyte_prop[dfa->tindex] = mbprop;
realtrans[0] = realtrans[1] = NULL;
d->trans = realtrans + 2;
idx_t newalloc = d->tralloc = newalloc1 - 2;
- d->fails = xnrealloc (d->fails, newalloc, sizeof *d->fails);
- d->success = xnrealloc (d->success, newalloc, sizeof *d->success);
- d->newlines = xnrealloc (d->newlines, newalloc, sizeof *d->newlines);
+ d->fails = xreallocarray (d->fails, newalloc, sizeof *d->fails);
+ d->success = xreallocarray (d->success, newalloc, sizeof *d->success);
+ d->newlines = xreallocarray (d->newlines, newalloc, sizeof *d->newlines);
if (d->localeinfo.multibyte)
{
realtrans = d->mb_trans ? d->mb_trans - 2 : NULL;
- realtrans = xnrealloc (realtrans, newalloc1, sizeof *realtrans);
+ realtrans = xreallocarray (realtrans, newalloc1, sizeof *realtrans);
if (oldalloc == 0)
realtrans[0] = realtrans[1] = NULL;
d->mb_trans = realtrans + 2;
cpp[i] = NULL;
}
/* Add the new string. */
- cpp = xnrealloc (cpp, i + 2, sizeof *cpp);
+ cpp = xreallocarray (cpp, i + 2, sizeof *cpp);
cpp[i] = new;
cpp[i + 1] = NULL;
return cpp;
if (n_tokens >= sz)
{
tokens = x2nrealloc (tokens, &sz, sizeof *tokens);
- lengths = xnrealloc (lengths, sz, sizeof *lengths);
+ lengths = xreallocarray (lengths, sz, sizeof *lengths);
}
if (token_length == (size_t) -1)
{
lines =
(struct normalization_test_line *)
- xnrealloc (lines, lines_length, sizeof (struct normalization_test_line));
+ xreallocarray (lines, lines_length, sizeof *lines);
file->parts[part_index].lines = lines;
file->parts[part_index].lines_length = lines_length;
}
/* Append uc to the sequence. */
sequence =
(uint32_t *)
- xnrealloc (sequence, sequence_length + 2, sizeof (uint32_t));
+ xreallocarray (sequence, sequence_length + 2, sizeof *sequence);
sequence[sequence_length] = uc;
sequence_length++;
lines_allocated = 7;
lines =
(struct normalization_test_line *)
- xnrealloc (lines, lines_allocated, sizeof (struct normalization_test_line));
+ xreallocarray (lines, lines_allocated, sizeof *lines);
}
lines[lines_length] = line;
lines_length++;
{
lines =
(struct normalization_test_line *)
- xnrealloc (lines, lines_length, sizeof (struct normalization_test_line));
+ xreallocarray (lines, lines_length, sizeof *lines);
file->parts[part_index].lines = lines;
file->parts[part_index].lines_length = lines_length;
}