- size_t changes
- remove some unused variables
- remove `register'
+
+ 1/5
+ ---
+builtins/getopt.c
+ - sh_getopt_restore_state: make sure argv[sh_curopt] is non-null before
+ using it
+
+parse.y
+ - CHECK_FOR_RESERVED_WORD: make sure to set word_top appropriately if
+ the last token was IF, WHILE, or UNTIL, since these tokens can follow
+ those reserved words
+
+Makefile.in
+ - ubsan: new target, to build with gcc/clang UBSan undefined behavior
+ sanitizer
+
+ 1/6
+ ---
+execute_cmd.[ch],locale.c,parse.y,expr.c,bracecomp.c,bashline.c,externs.h
+stringlib.c,general.[ch]
+builtins/{subst.c,array.c,echo.def,printf.def,enable.def,help.def,set.def}
+lib/sh/{strtrans.c,stringvec.c,shquote.c}
+lib/glob/sm_loop.c
+lib/readline/{vi_mode.c,histfile.c,funmap.c,complete.c,display.c,bind.c,isearch.c}
+lib/tilde/tilde.c
+ - final code cleanups for ANSI C and lint/ubsan/asan runs
+
ASAN_XCFLAGS = -fsanitize=address -fno-omit-frame-pointer
ASAN_XLDFLAGS = -fsanitize=address
+UBSAN_XCFLAGS = -fsanitize=undefined -fsanitize-recover -fstack-protector
+UBSAN_XLDFLAGS = -fsanitize=undefined
+
GCOV_XCFLAGS = -fprofile-arcs -ftest-coverage
GCOV_XLDFLAGS = -fprofile-arcs -ftest-coverage
# Maybe add: -Wextra
GCC_LINT_FLAGS = -O -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wno-parentheses \
-Wcast-align -Wstrict-prototypes -Wconversion -Wformat \
- -Wformat-nonliteral -Wmissing-braces -Wuninitialized \
+ -Wmissing-braces -Wuninitialized \
-Wmissing-declarations -Winline \
-Wmissing-prototypes -Wredundant-decls \
-Wformat-security -pedantic
asan:
${MAKE} ${MFLAGS} ADDON_CFLAGS='${ASAN_XCFLAGS}' ADDON_LDFLAGS='${ASAN_XLDFLAGS}' .made
+ubsan:
+ ${MAKE} ${MFLAGS} ADDON_CFLAGS='${UBSAN_XCFLAGS}' ADDON_LDFLAGS='${UBSAN_XLDFLAGS}' .made
+
valgrind:
${MAKE} ${MFLAGS} ADDON_CFLAGS='-DDISABLE_MALLOC_WRAPPERS' ADDON_LDFLAGS= .made
if (a == 0 || array_num_elements (a) == 0)
{
for (i = 0; i < count; i++)
- array_insert (a, i, t);
+ array_insert (a, i, vec[i]);
return a;
}
static char **
hostnames_matching (const char *text)
{
- register int i, len, nmatch, rsize;
+ int i, nmatch;
char **result;
+ size_t rsize, len;
if (hostname_list_initialized == 0)
initialize_hostname_list ();
{
int start, end, gcd;
char *result, *subterm, *x;
- int result_size, flag, tlen;
+ size_t result_size;
+ int flag, tlen;
flag = 0;
int
echo_builtin (WORD_LIST *list)
{
- int display_return, do_v9, i, len;
+ int display_return, do_v9, i;
+ size_t len;
char *temp, *s;
do_v9 = xpg_echo;
WORD_LIST *l;
void *handle;
- int total, new, replaced, r;
- size_t size;
+ int total, replaced, r;
+ size_t size, new;
char *struct_name, *name, *funcname;
sh_load_func_t *loadfunc;
struct builtin **new_builtins, *b, *new_shell_builtins, *old_builtin;
/* For each new builtin in the shared object, find it and its describing
structure. If this is overwriting an existing builtin, do so, otherwise
save the loaded struct for creating the new list of builtins. */
- for (replaced = new = 0; list; list = list->next)
+ for (replaced = 0, new = 0; list; list = list->next)
{
name = list->word->word;
void
sh_getopt_restore_state (char **argv)
{
- if (nextchar)
+ if (nextchar && argv && argv[sh_curopt])
nextchar = argv[sh_curopt] + sh_charindex;
}
show_desc (char *name, int i)
{
register int j, r;
- char **doc, *line;
+ char * const *doc, *line;
int fd, usefile;
- doc = (char **)shell_builtins[i].long_doc;
+ doc = shell_builtins[i].long_doc;
usefile = (doc && doc[0] && *doc[0] == '/' && doc[1] == (char *)NULL);
if (usefile)
case '(':
{
char *timefmt, timebuf[TIMELEN_MAX], *t;
- int n;
+ size_t n;
+ int r;
intmax_t arg;
time_t secs;
struct tm *tm;
/* convert to %s format that preserves fieldwidth and precision */
modstart[0] = 's';
modstart[1] = '\0';
- n = printstr (start, timebuf, strlen (timebuf), fieldwidth, precision); /* XXX - %s for now */
- if (n < 0)
+ r = printstr (start, timebuf, strlen (timebuf), fieldwidth, precision); /* XXX - %s for now */
+ if (r < 0)
{
if (ferror (stdout) == 0)
{
get_current_options (void)
{
char *temp;
- int i, posixopts;
+ int i;
+ size_t posixopts;
posixopts = num_posix_options (); /* shopts modified by posix mode */
/* Make the buffer big enough to hold the set -o options and the shopt
int len;
tname = savestring (nameref_cell (var));
+ tem = 0;
if (var = array_variable_part (tname, 0, &t, &len))
{
/* change to what unbind_array_element now expects */
*/
/*
- Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022,2023 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
for (sawc = 0, l = list; l; l = l->next)
{
- ostr = ansicstr (l->word->word, strlen (l->word->word), 0, &sawc, (int *)0);
+ ostr = ansicstr (l->word->word, strlen (l->word->word), 0, &sawc, 0);
if (ostr)
fprintf (ofp, "%s", ostr);
free (ostr);
void
close_fd_bitmap (struct fd_bitmap *fdbp)
{
- register int i;
+ int i;
if (fdbp)
{
void
open_files (void)
{
- register int i;
+ int i;
int f, fd_table_size;
fd_table_size = getdtablesize ();
void
coproc_unsetvars (struct coproc *cp)
{
- int l;
+ size_t l;
char *namevar;
if (cp->c_name == 0)
static int
execute_for_command (FOR_COM *for_command)
{
- register WORD_LIST *releaser, *list;
+ WORD_LIST *releaser, *list;
SHELL_VAR *v;
char *identifier;
int retval, save_line_number;
static int
print_index_and_element (int len, int ind, WORD_LIST *list)
{
- register WORD_LIST *l;
- register int i;
+ WORD_LIST *l;
+ int i;
if (list == 0)
return (0);
static int
execute_case_command (CASE_COM *case_command)
{
- register WORD_LIST *list;
+ WORD_LIST *list;
WORD_LIST *wlist, *es;
PATTERN_LIST *clauses;
char *word, *pattern;
static char *
getinterp (char *sample, int sample_len, int *endp)
{
- register int i;
+ int i;
char *execname;
int start;
void
close_all_files (void)
{
- register int i, fd_table_size;
+ int i, fd_table_size;
fd_table_size = getdtablesize ();
if (fd_table_size > 256) /* clamp to a reasonable value */
pid_t pid;
int subshell_env;
};
-
/* Variables declared in execute_cmd.c, used by many other files */
extern int return_catch_flag;
subexpr (const char *expr)
{
intmax_t val;
- char *p;
+ const char *p;
- for (p = (char *)expr; p && *p && cr_whitespace (*p); p++)
+ for (p = expr; p && *p && cr_whitespace (*p); p++)
;
if (p == NULL || *p == '\0')
extern int set_lang (const char *, const char *);
extern void set_default_lang (void);
extern char *get_locale_var (const char *);
-extern char *localetrans (const char *, int, int *);
+extern char *localetrans (const char *, int, size_t *);
extern char *mk_msgstr (char *, int *);
-extern char *locale_expand (const char *, int, int, int, int *);
+extern char *locale_expand (const char *, int, int, int, size_t *);
#ifndef locale_decpoint
extern int locale_decpoint (void);
#endif
extern char *strcreplace (const char *, int, const char *, int);
extern void strip_leading (char *);
extern void strip_trailing (char *, int, int);
-extern void xbcopy (char *, char *, size_t);
+extern void xbcopy (const void *, void *, size_t);
/* Functions from version.c. */
extern char *shell_version_string (void);
#endif
/* declarations for functions defined in lib/sh/strtrans.c */
-extern char *ansicstr (const char *, int, int, int *, int *);
+extern char *ansicstr (const char *, size_t, int, int *, size_t *);
extern char *ansic_quote (const char *, int, int *);
extern int ansic_shouldquote (const char *);
-extern char *ansiexpand (const char *, int, int, int *);
+extern char *ansiexpand (const char *, int, int, size_t *);
/* declarations for functions defined in lib/sh/strvis.c */
extern int sh_charvis (const char *, size_t *, size_t, char *, size_t *);
}
}
-int
+size_t
num_posix_options (void)
{
return ((sizeof (posix_vars) / sizeof (posix_vars[0])) - 1);
/* Declarations for functions defined in general.c */
extern void posix_initialize (int);
-extern int num_posix_options (void);
+extern size_t num_posix_options (void);
extern char *get_posix_options (char *);
extern void set_posix_options (const char *);
we are matching a pathname. */
if ((flags & FNM_DOTDOT) &&
((n == string && SDOT_OR_DOTDOT(n)) ||
- ((flags & FNM_PATHNAME) && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
+ ((flags & FNM_PATHNAME) && n > string && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
return FNM_NOMATCH;
break;
we are matching a pathname. */
if ((flags & FNM_DOTDOT) &&
((n == string && SDOT_OR_DOTDOT(n)) ||
- ((flags & FNM_PATHNAME) && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
+ ((flags & FNM_PATHNAME) && n > string && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
return FNM_NOMATCH;
if (p == pe)
we are matching a pathname. */
if ((flags & FNM_DOTDOT) &&
((n == string && SDOT_OR_DOTDOT(n)) ||
- ((flags & FNM_PATHNAME) && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
+ ((flags & FNM_PATHNAME) && n > string && n[-1] == L('/') && PDOT_OR_DOTDOT(n))))
return FNM_NOMATCH;
p = BRACKMATCH (p, sc, flags);
{
register int key;
char **result;
- int result_index, result_size;
+ size_t result_index, result_size;
result = (char **)NULL;
result_index = result_size = 0;
static void
_rl_macro_dumper_internal (int print_readably, Keymap map, char *prefix)
{
- register int key;
+ int key;
char *keyname, *out;
- int prefix_len;
+ size_t prefix_len;
for (key = 0; key < KEYMAP_SIZE; key++)
{
register int i;
/* Number of slots in match_list. */
- int match_list_size;
+ size_t match_list_size;
/* The list of matches. */
char **match_list;
static void
realloc_line (int minsize)
{
- int minimum_size;
- int newsize, delta;
+ size_t minimum_size;
+ size_t newsize, delta;
minimum_size = DEFAULT_LINE_BUFFER_SIZE;
if (minsize < minimum_size)
{
int in, out, c, linenum, cursor_linenum;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
- int newlines, lpos, temp, n0, num, prompt_lines_estimate;
+ int newlines, lpos, temp, num, prompt_lines_estimate;
char *prompt_this_line;
char cur_face;
int hl_begin, hl_end;
extern int _rl_qsort_string_compare (char **, char **);
FUNMAP **funmap;
-static int funmap_size;
+static size_t funmap_size;
static int funmap_entry;
/* After initializing the function map, this is the index of the first
rl_funmap_names (void)
{
const char **result;
- int result_size, result_index;
+ size_t result_size, result_index;
/* Make sure that the function map has been initialized. */
rl_initialize_funmap ();
file = filename ? open (filename, O_RDONLY|O_BINARY, 0666) : -1;
rv = exists = 0;
+ orig_lines = lines;
+
/* Don't try to truncate non-regular files. */
if (file == -1 || fstat (file, &finfo) == -1)
{
goto truncate_exit;
}
- orig_lines = lines;
/* Count backwards from the end of buffer until we have passed
LINES lines. bp1 is set funny initially. But since bp[1] can't
be a comment character (since it's off the end) and *bp can't be
rl_display_search (char *search_string, int flags, int where)
{
char *message;
- int msglen, searchlen;
+ size_t msglen, searchlen;
searchlen = (search_string && *search_string) ? strlen (search_string) : 0;
us implicitly into insert mode. Some people want this text to be
attached to the command so that it is `redoable' with `.'. */
static char *vi_insert_buffer;
-static int vi_insert_buffer_size;
+static size_t vi_insert_buffer_size;
static int _rl_vi_last_repeat = 1;
static int _rl_vi_last_arg_sign = 1;
extern char *get_working_directory (char *);
-static inline int
+static inline ssize_t
_path_readlink (char *path, char *buf, size_t bufsiz)
{
#ifdef HAVE_READLINK
char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
char *result, *p, *q, *qsave, *qbase, *workpath;
int double_slash_path, nlink;
+ ssize_t r;
size_t linklen;
linklen = strlen (path);
*q = '\0';
- linklen = _path_readlink (result, linkbuf, PATH_MAX);
- if (linklen < 0) /* if errno == EINVAL, it's not a symlink */
+ r = _path_readlink (result, linkbuf, PATH_MAX);
+ if (r < 0) /* if errno == EINVAL, it's not a symlink */
{
if (errno != EINVAL)
goto error;
continue;
}
+ linklen = r;
/* It's a symlink, and the value is in LINKBUF. */
nlink++;
other shell blank characters. */
char *
-sh_backslash_quote (char *string, char *table, int flags)
+sh_backslash_quote (char *string, const char *table, int flags)
{
int c, mb_cur_max;
size_t slen;
- char *result, *r, *s, *backslash_table, *send;
+ char *result, *r, *s, *send;
+ const char *backslash_table;
DECLARE_MBSTATE;
slen = strlen (string);
send = string + slen;
result = (char *)xmalloc (2 * slen + 1);
- backslash_table = table ? table : (char *)bstab;
+ backslash_table = table ? table : bstab;
mb_cur_max = MB_CUR_MAX;
for (r = result, s = string; s && (c = *s); s++)
char **
strvec_copy (char * const *array)
{
- register int i;
- int len;
+ int i;
+ size_t len;
char **ret;
len = strvec_len (array);
quote CTLESC and CTLNUL with CTLESC. If (flags&4) is non-zero, we want
to remove the backslash before any unrecognized escape sequence. */
char *
-ansicstr (const char *string, int len, int flags, int *sawc, int *rlen)
+ansicstr (const char *string, size_t len, int flags, int *sawc, size_t *rlen)
{
int c, temp;
char *ret, *r;
/* $'...' ANSI-C expand the portion of STRING between START and END and
return the result. The result cannot be longer than the input string. */
char *
-ansiexpand (const char *string, int start, int end, int *lenp)
+ansiexpand (const char *string, int start, int end, size_t *lenp)
{
char *temp, *t;
- int len, tlen;
+ int len;
+ size_t tlen;
temp = (char *)xmalloc (end - start + 1);
for (tlen = 0, len = start; len < end; )
static int
tilde_find_suffix (const char *string)
{
- register int i, j, string_len;
- register char **suffixes;
+ int i, j;
+ size_t string_len;
+ char **suffixes;
suffixes = tilde_additional_suffixes;
string_len = strlen (string);
tilde_expand (const char *string)
{
char *result;
- int result_size, result_index;
+ size_t result_size, result_index;
result_index = result_size = 0;
if (result = strchr (string, '~'))
/* Scan through STRING expanding tildes as we come to them. */
while (1)
{
- register int start, end;
+ int start, end;
char *tilde_word, *expansion;
int len;
is not available, the passed string is returned unchanged. The
length of the translated string is returned in LENP, if non-null. */
char *
-localetrans (const char *string, int len, int *lenp)
+localetrans (const char *string, int len, size_t *lenp)
{
char *locale, *t;
char *translated;
- int tlen;
+ size_t tlen;
/* Don't try to translate null strings. */
if (string == 0 || *string == 0)
by the caller. The length of the translated string is returned in LENP,
if non-null. */
char *
-locale_expand (const char *string, int start, int end, int lineno, int *lenp)
+locale_expand (const char *string, int start, int end, int lineno, size_t *lenp)
{
- int len, tlen, foundnl;
+ int tlen, foundnl;
char *temp, *t, *t2;
+ size_t len;
temp = (char *)xmalloc (end - start + 1);
for (tlen = 0, len = start; len < end; )
static int time_command_acceptable (void);
static int special_case_tokens (const char *);
static int read_token (int);
-static char *parse_matched_pair (int, int, int, int *, int);
-static char *parse_comsub (int, int, int, int *, int);
+static char *parse_matched_pair (int, int, int, size_t *, int);
+static char *parse_comsub (int, int, int, size_t *, int);
#if defined (ARRAY_VARS)
-static char *parse_compound_assignment (int *);
+static char *parse_compound_assignment (size_t *);
#endif
#if defined (DPAREN_ARITHMETIC) || defined (ARITH_FOR_COMMAND)
static int parse_dparen (int);
read_a_line (int remove_quoted_newline)
{
static char *line_buffer = (char *)NULL;
- static int buffer_size = 0;
+ static size_t buffer_size = 0;
int indx, c, peekc, pass_next;
#if defined (READLINE)
static int
shell_getc (int remove_quoted_newline)
{
- register int i;
+ int i;
int c, truncating, last_was_backslash;
unsigned char uc;
open_brace_count++; \
else if (word_token_alist[i].token == '}' && open_brace_count) \
open_brace_count--; \
+\
+ if (last_read_token == IF || last_read_token == WHILE || last_read_token == UNTIL) \
+ { \
+ if (word_top < MAX_COMPOUND_NEST) \
+ word_top++; \
+ word_lineno[word_top] = line_number; \
+ } \
+\
return (word_token_alist[i].token); \
} \
} \
/* QC == `"' if this construct is within double quotes */
static char *
-parse_matched_pair (int qc, int open, int close, int *lenp, int flags)
+parse_matched_pair (int qc, int open, int close, size_t *lenp, int flags)
{
- int count, ch, prevch, tflags;
- int nestlen, ttranslen, start_lineno;
+ int count, ch, prevch, tflags, start_lineno;
+ size_t nestlen, ttranslen;
char *ret, *nestret, *ttrans;
- int retind, retsize, rflags;
+ int rflags;
+ size_t retsize, retind;
int dolbrace_state;
dolbrace_state = (flags & P_DOLBRACE) ? DOLBRACE_PARAM : 0;
/* Parse a $(...) command substitution. This reads input from the current
input stream. QC == `"' if this construct is within double quotes */
static char *
-parse_comsub (int qc, int open, int close, int *lenp, int flags)
+parse_comsub (int qc, int open, int close, size_t *lenp, int flags)
{
int peekc, r;
int start_lineno, local_extglob, was_extpat;
char *ret, *tcmd;
- int retlen;
+ size_t retlen;
sh_parser_state_t ps;
STRING_SAVER *saved_strings;
COMMAND *saved_global, *parsed_command;
{
int exp_lineno, rval, c;
char *ttok, *tokstr;
- int ttoklen;
+ size_t ttoklen;
exp_lineno = line_number;
ttok = parse_matched_pair (0, '(', ')', &ttoklen, P_ARITH);
int cd;
int result, peek_char;
char *ttok, *ttrans;
- int ttoklen, ttranslen;
+ size_t ttoklen, ttranslen;
intmax_t lvalue;
if (token_buffer_size < TOKEN_DEFAULT_INITIAL_SIZE)
/* Check for special case tokens. */
result = (last_shell_getc_is_singlebyte) ? special_case_tokens (token) : -1;
if (result >= 0)
- return result;
+ return result; /* don't need to set word_top in any of these cases */
#if defined (ALIAS)
/* Posix.2 does not allow reserved words to be aliased, so check for all
time_t the_time;
char timebuf[128];
char *timefmt;
+ size_t tslen;
result = (char *)xmalloc (result_size = PROMPT_GROWTH);
result[result_index = 0] = 0;
tm = localtime (&the_time);
if (c == 'd')
- n = strftime (timebuf, sizeof (timebuf), "%a %b %d", tm);
+ tslen = strftime (timebuf, sizeof (timebuf), "%a %b %d", tm);
else if (c == 't')
- n = strftime (timebuf, sizeof (timebuf), "%H:%M:%S", tm);
+ tslen = strftime (timebuf, sizeof (timebuf), "%H:%M:%S", tm);
else if (c == 'T')
- n = strftime (timebuf, sizeof (timebuf), "%I:%M:%S", tm);
+ tslen = strftime (timebuf, sizeof (timebuf), "%I:%M:%S", tm);
else if (c == '@')
- n = strftime (timebuf, sizeof (timebuf), "%I:%M %p", tm);
+ tslen = strftime (timebuf, sizeof (timebuf), "%I:%M %p", tm);
else if (c == 'A')
- n = strftime (timebuf, sizeof (timebuf), "%H:%M", tm);
+ tslen = strftime (timebuf, sizeof (timebuf), "%H:%M", tm);
- if (n == 0)
+ if (tslen == 0)
timebuf[0] = '\0';
else
timebuf[sizeof(timebuf) - 1] = '\0';
timefmt[1] = 'X'; /* locale-specific current time */
timefmt[2] = '\0';
}
- n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
+ tslen = strftime (timebuf, sizeof (timebuf), timefmt, tm);
free (timefmt);
- if (n == 0)
+ if (tslen == 0)
timebuf[0] = '\0';
else
timebuf[sizeof(timebuf) - 1] = '\0';
}
static char *
-parse_compound_assignment (int *retlenp)
+parse_compound_assignment (size_t *retlenp)
{
WORD_LIST *wl, *rl;
int tok, orig_line_number, assignok;
/* A wrapper for bcopy that can be prototyped in general.h */
void
-xbcopy (char *s, char *d, size_t n)
+xbcopy (const void *s, void *d, size_t n)
{
FASTCOPY (s, d, n);
}
if (c == '$' && string[i+1] == '\'')
{
char *ttrans;
- int ttranslen;
+ size_t ttranslen;
if ((posixly_correct || extended_quote == 0) && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2)
{
if (c == '$' && string[i+1] == '"')
{
char *ttrans;
- int ttranslen;
+ size_t ttranslen;
si = i + 2;
t = string_extract_double_quoted (string, &si, flags); /* XXX */
{
int i, pass_next, backq, si, c, count, oldjmp;
size_t slen;
- char *temp, *ss;
+ char *temp;
DECLARE_MBSTATE;
slen = strlen (string + start) + start;
i = (flags & 2) ? start : start + 1;
count = 1;
pass_next = backq = 0;
- ss = (char *)string;
while (c = string[i])
{
if (pass_next)
}
else if ((flags & 1) == 0 && (c == '\'' || c == '"'))
{
- i = (c == '\'') ? skip_single_quoted (ss, slen, ++i, 0)
- : skip_double_quoted (ss, slen, ++i, 0);
+ i = (c == '\'') ? skip_single_quoted (string, slen, ++i, 0)
+ : skip_double_quoted (string, slen, ++i, 0);
/* no increment, the skip functions increment past the closing quote. */
}
else if ((flags & 1) == 0 && c == '$' && (string[i+1] == LPAREN || string[i+1] == LBRACE))
/* XXX - extract_command_subst here? */
if (string[i+1] == LPAREN)
- temp = extract_delimited_string (ss, &si, "$(", "(", ")", SX_NOALLOC|SX_COMMAND); /* ) */
+ temp = extract_delimited_string (string, &si, "$(", "(", ")", SX_NOALLOC|SX_COMMAND); /* ) */
else
- temp = extract_dollar_brace_string (ss, &si, 0, SX_NOALLOC);
+ temp = extract_dollar_brace_string (string, &si, 0, SX_NOALLOC);
CHECK_STRING_OVERRUN (i, si, slen, c);
expand_string_dollar_quote (const char *string, int flags)
{
size_t slen, retind, retsize;
- int sindex, c, translen, peekc, news;
+ int sindex, c, peekc, news;
char *ret, *trans, *t;
+ size_t translen;
const char *send;
DECLARE_MBSTATE;
#endif
istring = (char *)NULL;
- istring_index = istring_size = bufn = tflag = 0;
+ istring_index = istring_size = tflag = 0;
+ bufn = 0;
skip_ctlesc = ifs_cmap[CTLESC];
skip_ctlnul = ifs_cmap[CTLNUL];
break;
/* Transformations that modify the variable's value */
case 'E':
- t = ansiexpand (s, 0, strlen (s), (int *)0);
+ t = ansiexpand (s, 0, strlen (s), 0);
ret = dequote_escapes (t);
free (t);
break;
break;
case '"':
- i = skip_double_quoted ((char *)s, len, ++i, 0);
+ i = skip_double_quoted (s, len, ++i, 0);
break;
}
}