mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-09-06 16:26:55 +00:00
Prefer idx_t to size_t in wordsplit
* gnulib.modules: Add ialloc. * lib/wordsplit.c: Include ialloc.h. (PRINTMAX): New constant. (printflen, printfdots): New functions. (wordsplit_dump_nodes, expvar, wordsplit_process_list): Use them. (_wsplt_subsplit, wordsplit_string_unquote_copy): Don’t limit lengths to INT_MAX. (wordsplit_run): Remove. All callers changed to use wordsplit_len. (wordsplit_perror): Don’t limit lengths to ULONG_MAX. * lib/wordsplit.c (wordsplit_init, alloc_space, struct wordsplit_node) (wsnode_len, wordsplit_add_segm, coalesce_segment, wsnode_quoteremoval) (wordsplit_finish, wordsplit_append, node_split_prefix) (find_closing_paren, wordsplit_find_env, wsplt_assign_var) (expvar, node_expand, expcmd, wordsplit_trimws) (wordsplit_tildexpand, isglob, wordsplit_pathexpand) (skip_sed_expr, skip_delim_internal, skip_delim) (skip_delim_real, scan_qstring, scan_word) (wordsplit_c_quoted_length, wordsplit_process_list) (wordsplit_len, wordsplit_free_words, wordsplit_get_words): * lib/wordsplit.h (struct wordsplit): Prefer idx_t to size_t for indexes. * lib/wordsplit.h: Include idx.h.
This commit is contained in:
+1
-2
@@ -204,13 +204,12 @@ cvs_addfn (struct exclude *ex, char const *pattern, int options,
|
||||
MAYBE_UNUSED void *data)
|
||||
{
|
||||
struct wordsplit ws;
|
||||
size_t i;
|
||||
|
||||
options |= EXCLUDE_ALLOC;
|
||||
if (wordsplit (pattern, &ws,
|
||||
WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_SQUEEZE_DELIMS))
|
||||
return;
|
||||
for (i = 0; i < ws.ws_wordc; i++)
|
||||
for (idx_t i = 0; i < ws.ws_wordc; i++)
|
||||
add_exclude (ex, ws.ws_wordv[i], options);
|
||||
wordsplit_free (&ws);
|
||||
}
|
||||
|
||||
+2
-2
@@ -526,8 +526,8 @@ run_decompress_program (void)
|
||||
FATAL_ERROR ((0, 0, _("cannot split string '%s': %s"),
|
||||
p, wordsplit_strerror (&ws)));
|
||||
wsflags |= WRDSF_REUSE;
|
||||
memmove(ws.ws_wordv, ws.ws_wordv + ws.ws_offs,
|
||||
sizeof(ws.ws_wordv[0])*ws.ws_wordc);
|
||||
memmove (ws.ws_wordv, ws.ws_wordv + ws.ws_offs,
|
||||
ws.ws_wordc * sizeof *ws.ws_wordv);
|
||||
ws.ws_wordv[ws.ws_wordc] = (char *) "-d";
|
||||
prog = p;
|
||||
execvp (ws.ws_wordv[0], ws.ws_wordv);
|
||||
|
||||
Reference in New Issue
Block a user