From: Paul Eggert Date: Fri, 26 Mar 2021 21:56:36 +0000 (-0700) Subject: env: prefer ptrdiff_t X-Git-Tag: v9.0~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12abdb757abb79a6be4843174898868f8dd0f24c;p=thirdparty%2Fcoreutils.git env: prefer ptrdiff_t * src/env.c (usvars_used, vnlen, unset_envvars, expansion) (build_argv): Prefer ptrdiff_t to size_t when either will do. --- diff --git a/src/env.c b/src/env.c index 341777cb8e..11db374d97 100644 --- a/src/env.c +++ b/src/env.c @@ -41,14 +41,14 @@ /* Array of envvars to unset. */ static const char **usvars; static size_t usvars_alloc; -static size_t usvars_used; +static ptrdiff_t usvars_used; /* Annotate the output with extra info to aid the user. */ static bool dev_debug; /* Buffer and length of extracted envvars in -S strings. */ static char *varname; -static size_t vnlen; +static ptrdiff_t vnlen; /* Possible actions on each signal. */ enum SIGNAL_MODE { @@ -175,7 +175,7 @@ append_unset_var (const char *var) static void unset_envvars (void) { - for (size_t i = 0; i < usvars_used; ++i) + for (ptrdiff_t i = 0; i < usvars_used; ++i) { devmsg ("unset: %s\n", usvars[i]); @@ -271,11 +271,11 @@ extract_varname (const char *str) after ENVVAR expansion (the value is overestimated). maxargc - the maximum number of arguments (the size of the new argv). */ static void -validate_split_str (const char *str, size_t *bufsize, int *maxargc) +validate_split_str (const char *str, ptrdiff_t *bufsize, int *maxargc) { bool dq, sq, sp; const char *pch; - size_t buflen; + ptrdiff_t buflen; int cnt = 1; dq = sq = sp = false; @@ -379,7 +379,7 @@ build_argv (const char *str, int extra_argc) char **newargv, **nextargv; int newargc = 0; - size_t buflen = 0; + ptrdiff_t buflen = 0; /* This macro is called before inserting any characters to the output buffer. It checks if the previous character was a separator