From: Micah Cowan Date: Sun, 14 Oct 2007 21:46:24 +0000 (-0700) Subject: ISSPACE -> c_isspace X-Git-Tag: v1.13~508^2~2 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=da99855784988c6bf125799f47c57d888bbc25f1 ISSPACE -> c_isspace --- diff --git a/src/ChangeLog b/src/ChangeLog index 8044e1e0..112d914c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2007-10-14 Micah Cowan + + * cmpt.c, cookies.c, ftp-basic.c, ftp-ls.c, ftp.c, hash.c, + host.c, html-parse.c, html-url.c, http-ntlm.c, http.c, init.c, + log.c, main.c, netrc.c, openssl.c, res.c, url.c, utils.c, + wget.h: Replace uses of ISSPACE, etc with c_isspace, etc. + 2007-10-13 Micah Cowan * Makefile.am: Make version.c depend on Wget dependencies (source diff --git a/src/cmpt.c b/src/cmpt.c index 1977e8ea..291056a4 100644 --- a/src/cmpt.c +++ b/src/cmpt.c @@ -73,8 +73,8 @@ strcasecmp (const char *s1, const char *s2) do { - c1 = TOLOWER (*p1++); - c2 = TOLOWER (*p2++); + c1 = c_tolower (*p1++); + c2 = c_tolower (*p2++); if (c1 == '\0') break; } @@ -102,8 +102,8 @@ strncasecmp (const char *s1, const char *s2, size_t n) do { - c1 = TOLOWER (*p1++); - c2 = TOLOWER (*p2++); + c1 = c_tolower (*p1++); + c2 = c_tolower (*p2++); if (c1 == '\0' || c1 != c2) return c1 - c2; } while (--n > 0); @@ -432,9 +432,9 @@ strptime_internal (rp, fmt, tm, decided) { /* A white space in the format string matches 0 more or white space in the input string. */ - if (ISSPACE (*fmt)) + if (c_isspace (*fmt)) { - while (ISSPACE (*rp)) + while (c_isspace (*rp)) ++rp; ++fmt; continue; @@ -654,7 +654,7 @@ strptime_internal (rp, fmt, tm, decided) case 'n': case 't': /* Match any white space. */ - while (ISSPACE (*rp)) + while (c_isspace (*rp)) ++rp; break; case 'p': @@ -1367,7 +1367,7 @@ strtoll (const char *nptr, char **endptr, int base) nptr += 2; /* "0x" must be followed by at least one hex char. If not, return 0 and place ENDPTR on 'x'. */ - if (!ISXDIGIT (*nptr)) + if (!c_isxdigit (*nptr)) { --nptr; goto out; diff --git a/src/cookies.c b/src/cookies.c index d3b64a9f..0f54f665 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -456,9 +456,9 @@ parse_set_cookie (const char *set_cookie, bool silent) #define REQUIRE_DIGITS(p) do { \ - if (!ISDIGIT (*p)) \ + if (!c_isdigit (*p)) \ return false; \ - for (++p; ISDIGIT (*p); p++) \ + for (++p; c_isdigit (*p); p++) \ ; \ } while (0) @@ -1102,7 +1102,7 @@ domain_port (const char *domain_b, const char *domain_e, const char *colon = memchr (domain_b, ':', domain_e - domain_b); if (!colon) return 0; - for (p = colon + 1; p < domain_e && ISDIGIT (*p); p++) + for (p = colon + 1; p < domain_e && c_isdigit (*p); p++) port = 10 * port + (*p - '0'); if (p < domain_e) /* Garbage following port number. */ @@ -1153,7 +1153,7 @@ cookie_jar_load (struct cookie_jar *jar, const char *file) char *value_b = NULL, *value_e = NULL; /* Skip leading white-space. */ - while (*p && ISSPACE (*p)) + while (*p && c_isspace (*p)) ++p; /* Ignore empty lines. */ if (!*p || *p == '#') diff --git a/src/ftp-basic.c b/src/ftp-basic.c index 9df26849..4920f725 100644 --- a/src/ftp-basic.c +++ b/src/ftp-basic.c @@ -82,7 +82,7 @@ ftp_response (int fd, char **ret_line) DEBUGP (("%s\n", escnonprint (line))); /* The last line of output is the one that begins with "ddd ". */ - if (ISDIGIT (line[0]) && ISDIGIT (line[1]) && ISDIGIT (line[2]) + if (c_isdigit (line[0]) && c_isdigit (line[1]) && c_isdigit (line[2]) && line[3] == ' ') { strncpy (ftp_last_respline, line, sizeof (ftp_last_respline)); @@ -205,7 +205,7 @@ ftp_login (int csock, const char *acc, const char *pass) int skey_sequence = 0; /* Extract the sequence from SEED. */ - for (; ISDIGIT (*seed); seed++) + for (; c_isdigit (*seed); seed++) skey_sequence = 10 * skey_sequence + *seed - '0'; if (*seed == ' ') ++seed; @@ -521,14 +521,14 @@ ftp_pasv (int csock, ip_address *addr, int *port) } /* Parse the request. */ s = respline; - for (s += 4; *s && !ISDIGIT (*s); s++) + for (s += 4; *s && !c_isdigit (*s); s++) ; if (!*s) return FTPINVPASV; for (i = 0; i < 6; i++) { tmp[i] = 0; - for (; ISDIGIT (*s); s++) + for (; c_isdigit (*s); s++) tmp[i] = (*s - '0') + 10 * tmp[i]; if (*s == ',') s++; @@ -590,14 +590,14 @@ ftp_lpsv (int csock, ip_address *addr, int *port) /* Parse the response. */ s = respline; - for (s += 4; *s && !ISDIGIT (*s); s++) + for (s += 4; *s && !c_isdigit (*s); s++) ; if (!*s) return FTPINVPASV; /* First, get the address family */ af = 0; - for (; ISDIGIT (*s); s++) + for (; c_isdigit (*s); s++) af = (*s - '0') + 10 * af; if (af != 4 && af != 6) @@ -614,7 +614,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port) /* Then, get the address length */ addrlen = 0; - for (; ISDIGIT (*s); s++) + for (; c_isdigit (*s); s++) addrlen = (*s - '0') + 10 * addrlen; if (!*s || *s++ != ',') @@ -640,7 +640,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port) for (i = 0; i < addrlen; i++) { tmp[i] = 0; - for (; ISDIGIT (*s); s++) + for (; c_isdigit (*s); s++) tmp[i] = (*s - '0') + 10 * tmp[i]; if (*s == ',') s++; @@ -653,7 +653,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port) /* Now, get the port length */ portlen = 0; - for (; ISDIGIT (*s); s++) + for (; c_isdigit (*s); s++) portlen = (*s - '0') + 10 * portlen; if (!*s || *s++ != ',') @@ -670,7 +670,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port) /* Finally, we get the port number */ tmpprt[0] = 0; - for (; ISDIGIT (*s); s++) + for (; c_isdigit (*s); s++) tmpprt[0] = (*s - '0') + 10 * tmpprt[0]; if (!*s || *s++ != ',') @@ -680,7 +680,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port) } tmpprt[1] = 0; - for (; ISDIGIT (*s); s++) + for (; c_isdigit (*s); s++) tmpprt[1] = (*s - '0') + 10 * tmpprt[1]; assert (s != NULL); @@ -786,7 +786,7 @@ ftp_epsv (int csock, ip_address *ip, int *port) /* Finally, get the port number */ tport = 0; - for (i = 1; ISDIGIT (*s); s++) + for (i = 1; c_isdigit (*s); s++) { if (i > 5) { @@ -1171,7 +1171,7 @@ ftp_process_type (const char *params) if (params && 0 == strncasecmp (params, "type=", 5) && params[5] != '\0') - return TOUPPER (params[5]); + return c_toupper (params[5]); else return 'I'; } diff --git a/src/ftp-ls.c b/src/ftp-ls.c index 97d725f6..b056572e 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -252,10 +252,10 @@ ftp_parse_unix_ls (const char *file, int ignore_perms) year = 0; min = hour = sec = 0; /* We must deal with digits. */ - if (ISDIGIT (*tok)) + if (c_isdigit (*tok)) { /* Suppose it's year. */ - for (; ISDIGIT (*tok); tok++) + for (; c_isdigit (*tok); tok++) year = (*tok - '0') + 10 * year; if (*tok == ':') { @@ -264,13 +264,13 @@ ftp_parse_unix_ls (const char *file, int ignore_perms) year = 0; ++tok; /* Get the minutes... */ - for (; ISDIGIT (*tok); tok++) + for (; c_isdigit (*tok); tok++) min = (*tok - '0') + 10 * min; if (*tok == ':') { /* ...and the seconds. */ ++tok; - for (; ISDIGIT (*tok); tok++) + for (; c_isdigit (*tok); tok++) sec = (*tok - '0') + 10 * sec; } } diff --git a/src/ftp.c b/src/ftp.c index e0d07773..302714af 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -88,11 +88,11 @@ ftp_expected_bytes (const char *s) res = str_to_wgint (s, (char **) &s, 10); if (!*s) return 0; - while (*s && ISSPACE (*s)) + while (*s && c_isspace (*s)) ++s; if (!*s) return 0; - if (TOLOWER (*s) != 'b') + if (c_tolower (*s) != 'b') continue; if (strncasecmp (s, "byte", 4)) continue; @@ -496,7 +496,7 @@ Error in server response, closing control connection.\n")); if (target[0] != '/' && !(con->rs != ST_UNIX - && ISALPHA (target[0]) + && c_isalpha (target[0]) && target[1] == ':') && con->rs != ST_OS400) { diff --git a/src/hash.c b/src/hash.c index 5d156da8..cb65c7f7 100644 --- a/src/hash.c +++ b/src/hash.c @@ -54,7 +54,7 @@ so, delete this exception statement from your version. */ # define countof(x) (sizeof (x) / sizeof ((x)[0])) # endif # include -# define TOLOWER(x) tolower ((unsigned char) (x)) +# define c_tolower(x) tolower ((unsigned char) (x)) # if __STDC_VERSION__ >= 199901L # include /* for uintptr_t */ # else @@ -680,11 +680,11 @@ static unsigned long hash_string_nocase (const void *key) { const char *p = key; - unsigned int h = TOLOWER (*p); + unsigned int h = c_tolower (*p); if (h) for (p += 1; *p != '\0'; p++) - h = (h << 5) - h + TOLOWER (*p); + h = (h << 5) - h + c_tolower (*p); return h; } diff --git a/src/host.c b/src/host.c index fee5e404..f6b0f163 100644 --- a/src/host.c +++ b/src/host.c @@ -495,7 +495,7 @@ is_valid_ipv6_address (const char *str, const char *end) int ch = *str++; /* if ch is a number, add it to val. */ - if (ISXDIGIT (ch)) + if (c_isxdigit (ch)) { val <<= 4; val |= XDIGIT_TO_NUM (ch); @@ -848,7 +848,7 @@ sufmatch (const char **list, const char *what) for (i = 0; list[i]; i++) { for (j = strlen (list[i]), k = lw; j >= 0 && k >= 0; j--, k--) - if (TOLOWER (list[i][j]) != TOLOWER (what[k])) + if (c_tolower (list[i][j]) != c_tolower (what[k])) break; /* The domain must be first to reach to beginning. */ if (j == -1) diff --git a/src/html-parse.c b/src/html-parse.c index 243ead23..a72688e3 100644 --- a/src/html-parse.c +++ b/src/html-parse.c @@ -110,21 +110,21 @@ so, delete this exception statement from your version. */ # define xrealloc realloc # define xfree free -# undef ISSPACE -# undef ISDIGIT -# undef ISXDIGIT -# undef ISALPHA -# undef ISALNUM -# undef TOLOWER -# undef TOUPPER - -# define ISSPACE(x) isspace (x) -# define ISDIGIT(x) isdigit (x) -# define ISXDIGIT(x) isxdigit (x) -# define ISALPHA(x) isalpha (x) -# define ISALNUM(x) isalnum (x) -# define TOLOWER(x) tolower (x) -# define TOUPPER(x) toupper (x) +# undef c_isspace +# undef c_isdigit +# undef c_isxdigit +# undef c_isalpha +# undef c_isalnum +# undef c_tolower +# undef c_toupper + +# define c_isspace(x) isspace (x) +# define c_isdigit(x) isdigit (x) +# define c_isxdigit(x) isxdigit (x) +# define c_isalpha(x) isalpha (x) +# define c_isalnum(x) isalnum (x) +# define c_tolower(x) tolower (x) +# define c_toupper(x) toupper (x) struct hash_table { int dummy; @@ -258,7 +258,7 @@ struct pool { However, "<foo" will work, as will "<!foo", "<", etc. In other words an entity needs to be terminated by either a non-alphanumeric or the end of string. */ -#define FITS(p, n) (p + n == end || (p + n < end && !ISALNUM (p[n]))) +#define FITS(p, n) (p + n == end || (p + n < end && !c_isalnum (p[n]))) /* Macros that test entity names by returning true if P is followed by the specified characters. */ @@ -296,10 +296,10 @@ decode_entity (const char **ptr, const char *end) int digits = 0; value = 0; if (*p == 'x') - for (++p; value < 256 && p < end && ISXDIGIT (*p); p++, digits++) + for (++p; value < 256 && p < end && c_isxdigit (*p); p++, digits++) value = (value << 4) + XDIGIT_TO_NUM (*p); else - for (; value < 256 && p < end && ISDIGIT (*p); p++, digits++) + for (; value < 256 && p < end && c_isdigit (*p); p++, digits++) value = (value * 10) + (*p - '0'); if (!digits) return -1; @@ -368,9 +368,9 @@ convert_and_copy (struct pool *pool, const char *beg, const char *end, int flags ` '. */ if (flags & AP_TRIM_BLANKS) { - while (beg < end && ISSPACE (*beg)) + while (beg < end && c_isspace (*beg)) ++beg; - while (end > beg && ISSPACE (end[-1])) + while (end > beg && c_isspace (end[-1])) --end; } @@ -425,7 +425,7 @@ convert_and_copy (struct pool *pool, const char *beg, const char *end, int flags { char *p = pool->contents + old_tail; for (; *p; p++) - *p = TOLOWER (*p); + *p = c_tolower (*p); } } @@ -705,7 +705,7 @@ name_allowed (const struct hash_table *ht, const char *b, const char *e) /* Skip whitespace, if any. */ #define SKIP_WS(p) do { \ - while (ISSPACE (*p)) { \ + while (c_isspace (*p)) { \ ADVANCE (p); \ } \ } while (0) @@ -713,7 +713,7 @@ name_allowed (const struct hash_table *ht, const char *b, const char *e) /* Skip non-whitespace, if any. */ #define SKIP_NON_WS(p) do { \ - while (!ISSPACE (*p)) { \ + while (!c_isspace (*p)) { \ ADVANCE (p); \ } \ } while (0) @@ -936,7 +936,7 @@ map_html_tags (const char *text, int size, violated by, for instance, `%' in `width=75%'. We'll be liberal and allow just about anything as an attribute value. */ - while (!ISSPACE (*p) && *p != '>') + while (!c_isspace (*p) && *p != '>') ADVANCE (p); attr_value_end = p; /* */ /* ^ */ diff --git a/src/html-url.c b/src/html-url.c index 97443ea0..6a96f6c2 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -509,20 +509,20 @@ tag_handle_meta (int tagid, struct taginfo *tag, struct map_context *ctx) if (!refresh) return; - for (p = refresh; ISDIGIT (*p); p++) + for (p = refresh; c_isdigit (*p); p++) timeout = 10 * timeout + *p - '0'; if (*p++ != ';') return; - while (ISSPACE (*p)) + while (c_isspace (*p)) ++p; - if (!( TOUPPER (*p) == 'U' - && TOUPPER (*(p + 1)) == 'R' - && TOUPPER (*(p + 2)) == 'L' + if (!( c_toupper (*p) == 'U' + && c_toupper (*(p + 1)) == 'R' + && c_toupper (*(p + 2)) == 'L' && *(p + 3) == '=')) return; p += 4; - while (ISSPACE (*p)) + while (c_isspace (*p)) ++p; entry = append_url (p, tag, attrind, ctx); @@ -668,9 +668,9 @@ get_urls_file (const char *file) text = line_end; /* Strip whitespace from the beginning and end of line. */ - while (line_beg < line_end && ISSPACE (*line_beg)) + while (line_beg < line_end && c_isspace (*line_beg)) ++line_beg; - while (line_end > line_beg && ISSPACE (*(line_end - 1))) + while (line_end > line_beg && c_isspace (*(line_end - 1))) --line_end; if (line_beg == line_end) diff --git a/src/http-ntlm.c b/src/http-ntlm.c index 32bb3c59..5ca8e85c 100644 --- a/src/http-ntlm.c +++ b/src/http-ntlm.c @@ -121,7 +121,7 @@ ntlm_input (struct ntlmdata *ntlm, const char *header) return false; header += 4; - while (*header && ISSPACE(*header)) + while (*header && c_isspace(*header)) header++; if (*header) @@ -247,7 +247,7 @@ mkhash(const char *password, len = 14; for (i=0; ib = p; - while (*p && !ISSPACE (*p) && *p != '=' && *p != separator) ++p; + while (*p && !c_isspace (*p) && *p != '=' && *p != separator) ++p; name->e = p; if (name->b == name->e) return false; /* empty name: error */ - while (ISSPACE (*p)) ++p; + while (c_isspace (*p)) ++p; if (*p == separator || !*p) /* no value */ { xzero (*value); @@ -965,7 +965,7 @@ extract_param (const char **source, param_token *name, param_token *value, /* *p is '=', extract value */ ++p; - while (ISSPACE (*p)) ++p; + while (c_isspace (*p)) ++p; if (*p == '"') /* quoted */ { value->b = ++p; @@ -974,7 +974,7 @@ extract_param (const char **source, param_token *name, param_token *value, return false; value->e = p++; /* Currently at closing quote; find the end of param. */ - while (ISSPACE (*p)) ++p; + while (c_isspace (*p)) ++p; while (*p && *p != separator) ++p; if (*p == separator) ++p; @@ -987,7 +987,7 @@ extract_param (const char **source, param_token *name, param_token *value, value->b = p; while (*p && *p != separator) ++p; value->e = p; - while (value->e != value->b && ISSPACE (value->e[-1])) + while (value->e != value->b && c_isspace (value->e[-1])) --value->e; if (*p == separator) ++p; } @@ -1315,7 +1315,7 @@ free_hstat (struct http_stat *hs) #define BEGINS_WITH(line, string_constant) \ (!strncasecmp (line, string_constant, sizeof (string_constant) - 1) \ - && (ISSPACE (line[sizeof (string_constant) - 1]) \ + && (c_isspace (line[sizeof (string_constant) - 1]) \ || !line[sizeof (string_constant) - 1])) #define SET_USER_AGENT(req) do { \ @@ -2021,7 +2021,7 @@ File `%s' already there; not retrieving.\n\n"), hs->local_file); char *tmp = strchr (type, ';'); if (tmp) { - while (tmp > type && ISSPACE (tmp[-1])) + while (tmp > type && c_isspace (tmp[-1])) --tmp; *tmp = '\0'; } @@ -2796,11 +2796,11 @@ check_end (const char *p) { if (!p) return false; - while (ISSPACE (*p)) + while (c_isspace (*p)) ++p; if (!*p || (p[0] == 'G' && p[1] == 'M' && p[2] == 'T') - || ((p[0] == '+' || p[0] == '-') && ISDIGIT (p[1]))) + || ((p[0] == '+' || p[0] == '-') && c_isdigit (p[1]))) return true; else return false; @@ -2916,7 +2916,7 @@ basic_authentication_encode (const char *user, const char *passwd) } #define SKIP_WS(x) do { \ - while (ISSPACE (*(x))) \ + while (c_isspace (*(x))) \ ++(x); \ } while (0) @@ -3048,7 +3048,7 @@ username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"", ((e) - (b) >= STRSIZE (literal) \ && 0 == strncasecmp (b, literal, STRSIZE (literal)) \ && ((e) - (b) == STRSIZE (literal) \ - || ISSPACE (b[STRSIZE (literal)]))) + || c_isspace (b[STRSIZE (literal)]))) static bool known_authentication_scheme_p (const char *hdrbeg, const char *hdrend) @@ -3077,7 +3077,7 @@ create_authorization_line (const char *au, const char *user, { /* We are called only with known schemes, so we can dispatch on the first letter. */ - switch (TOUPPER (*au)) + switch (c_toupper (*au)) { case 'B': /* Basic */ *finished = true; diff --git a/src/init.c b/src/init.c index 20ca99be..8000d73c 100644 --- a/src/init.c +++ b/src/init.c @@ -576,9 +576,9 @@ parse_line (const char *line, char **com, char **val, int *comind) int ind; /* Skip leading and trailing whitespace. */ - while (*line && ISSPACE (*line)) + while (*line && c_isspace (*line)) ++line; - while (end > line && ISSPACE (end[-1])) + while (end > line && c_isspace (end[-1])) --end; /* Skip empty lines and comments. */ @@ -588,17 +588,17 @@ parse_line (const char *line, char **com, char **val, int *comind) p = line; cmdstart = p; - while (p < end && (ISALNUM (*p) || *p == '_' || *p == '-')) + while (p < end && (c_isalnum (*p) || *p == '_' || *p == '-')) ++p; cmdend = p; /* Skip '=', as well as any space before or after it. */ - while (p < end && ISSPACE (*p)) + while (p < end && c_isspace (*p)) ++p; if (p == end || *p != '=') return line_syntax_error; ++p; - while (p < end && ISSPACE (*p)) + while (p < end && c_isspace (*p)) ++p; valstart = p; @@ -691,15 +691,15 @@ static bool decode_string (const char *, const struct decode_item *, int, int *) static bool simple_atoi (const char *, const char *, int *); static bool simple_atof (const char *, const char *, double *); -#define CMP1(p, c0) (TOLOWER((p)[0]) == (c0) && (p)[1] == '\0') +#define CMP1(p, c0) (c_tolower((p)[0]) == (c0) && (p)[1] == '\0') -#define CMP2(p, c0, c1) (TOLOWER((p)[0]) == (c0) \ - && TOLOWER((p)[1]) == (c1) \ +#define CMP2(p, c0, c1) (c_tolower((p)[0]) == (c0) \ + && c_tolower((p)[1]) == (c1) \ && (p)[2] == '\0') -#define CMP3(p, c0, c1, c2) (TOLOWER((p)[0]) == (c0) \ - && TOLOWER((p)[1]) == (c1) \ - && TOLOWER((p)[2]) == (c2) \ +#define CMP3(p, c0, c1, c2) (c_tolower((p)[0]) == (c0) \ + && c_tolower((p)[1]) == (c1) \ + && c_tolower((p)[2]) == (c2) \ && (p)[3] == '\0') @@ -907,12 +907,12 @@ parse_bytes_helper (const char *val, double *result) } /* Strip trailing whitespace. */ - while (val < end && ISSPACE (end[-1])) + while (val < end && c_isspace (end[-1])) --end; if (val == end) return false; - switch (TOLOWER (end[-1])) + switch (c_tolower (end[-1])) { case 'k': --end, mult = 1024.0; @@ -933,9 +933,9 @@ parse_bytes_helper (const char *val, double *result) } /* Skip leading and trailing whitespace. */ - while (val < end && ISSPACE (*val)) + while (val < end && c_isspace (*val)) ++val; - while (val < end && ISSPACE (end[-1])) + while (val < end && c_isspace (end[-1])) --end; if (val == end) return false; @@ -1005,7 +1005,7 @@ cmd_time (const char *com, const char *val, void *place) const char *end = val + strlen (val); /* Strip trailing whitespace. */ - while (val < end && ISSPACE (end[-1])) + while (val < end && c_isspace (end[-1])) --end; if (val == end) @@ -1016,7 +1016,7 @@ cmd_time (const char *com, const char *val, void *place) return false; } - switch (TOLOWER (end[-1])) + switch (c_tolower (end[-1])) { case 's': --end, mult = 1; /* seconds */ @@ -1040,9 +1040,9 @@ cmd_time (const char *com, const char *val, void *place) } /* Skip leading and trailing whitespace. */ - while (val < end && ISSPACE (*val)) + while (val < end && c_isspace (*val)) ++val; - while (val < end && ISSPACE (end[-1])) + while (val < end && c_isspace (end[-1])) --end; if (val == end) goto err; @@ -1321,7 +1321,7 @@ simple_atoi (const char *beg, const char *end, int *dest) bool negative = false; const char *p = beg; - while (p < end && ISSPACE (*p)) + while (p < end && c_isspace (*p)) ++p; if (p < end && (*p == '-' || *p == '+')) { @@ -1335,7 +1335,7 @@ simple_atoi (const char *beg, const char *end, int *dest) negative integer cannot be represented as a positive number. */ if (!negative) - for (; p < end && ISDIGIT (*p); p++) + for (; p < end && c_isdigit (*p); p++) { int next = (10 * result) + (*p - '0'); if (next < result) @@ -1343,7 +1343,7 @@ simple_atoi (const char *beg, const char *end, int *dest) result = next; } else - for (; p < end && ISDIGIT (*p); p++) + for (; p < end && c_isdigit (*p); p++) { int next = (10 * result) - (*p - '0'); if (next > result) @@ -1375,7 +1375,7 @@ simple_atof (const char *beg, const char *end, double *dest) const char *p = beg; - while (p < end && ISSPACE (*p)) + while (p < end && c_isspace (*p)) ++p; if (p < end && (*p == '-' || *p == '+')) { @@ -1386,7 +1386,7 @@ simple_atof (const char *beg, const char *end, double *dest) for (; p < end; p++) { char ch = *p; - if (ISDIGIT (ch)) + if (c_isdigit (ch)) { if (!seen_dot) result = (10 * result) + (ch - '0'); @@ -1422,7 +1422,7 @@ check_user_specified_header (const char *s) { const char *p; - for (p = s; *p && *p != ':' && !ISSPACE (*p); p++) + for (p = s; *p && *p != ':' && !c_isspace (*p); p++) ; /* The header MUST contain `:' preceded by at least one non-whitespace character. */ diff --git a/src/log.c b/src/log.c index e3c4d452..5cce3513 100644 --- a/src/log.c +++ b/src/log.c @@ -604,7 +604,7 @@ count_nonprint (const char *source) const char *p; int cnt; for (p = source, cnt = 0; *p; p++) - if (!ISPRINT (*p)) + if (!c_isprint (*p)) ++cnt; return cnt; } @@ -644,7 +644,7 @@ copy_and_escape (const char *source, char *dest, char escape, int base) { case 8: while ((c = *from++) != '\0') - if (ISPRINT (c)) + if (c_isprint (c)) *to++ = c; else { @@ -656,7 +656,7 @@ copy_and_escape (const char *source, char *dest, char escape, int base) break; case 16: while ((c = *from++) != '\0') - if (ISPRINT (c)) + if (c_isprint (c)) *to++ = c; else { diff --git a/src/main.c b/src/main.c index 43889c5f..fb07c1a4 100644 --- a/src/main.c +++ b/src/main.c @@ -811,9 +811,9 @@ main (int argc, char *const *argv) before passing the value to setoptval. */ bool flag = true; if (optarg) - flag = (*optarg == '1' || TOLOWER (*optarg) == 'y' - || (TOLOWER (optarg[0]) == 'o' - && TOLOWER (optarg[1]) == 'n')); + flag = (*optarg == '1' || c_tolower (*optarg) == 'y' + || (c_tolower (optarg[0]) == 'o' + && c_tolower (optarg[1]) == 'n')); setoptval (opt->type == OPT__PARENT ? "noparent" : "noclobber", flag ? "0" : "1", opt->long_name); break; diff --git a/src/netrc.c b/src/netrc.c index 87c8c94b..485e0757 100644 --- a/src/netrc.c +++ b/src/netrc.c @@ -283,7 +283,7 @@ parse_netrc (const char *path) quote = 0; /* Skip leading whitespace. */ - while (*p && ISSPACE (*p)) + while (*p && c_isspace (*p)) p ++; /* If the line is empty, then end any macro definition. */ @@ -295,7 +295,7 @@ parse_netrc (const char *path) while (*p && last_token != tok_macdef) { /* Skip any whitespace. */ - while (*p && ISSPACE (*p)) + while (*p && c_isspace (*p)) p ++; /* Discard end-of-line comments; also, stop processing if @@ -313,7 +313,7 @@ parse_netrc (const char *path) tok = p; /* Find the end of the token, handling quotes and escapes. */ - while (*p && (quote ? *p != '"' : !ISSPACE (*p))){ + while (*p && (quote ? *p != '"' : !c_isspace (*p))){ if (*p == '\\') shift_left (p); p ++; diff --git a/src/openssl.c b/src/openssl.c index 7427f34d..aa44cbaa 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -439,13 +439,13 @@ pattern_match (const char *pattern, const char *string) { const char *p = pattern, *n = string; char c; - for (; (c = TOLOWER (*p++)) != '\0'; n++) + for (; (c = c_tolower (*p++)) != '\0'; n++) if (c == '*') { - for (c = TOLOWER (*p); c == '*'; c = TOLOWER (*++p)) + for (c = c_tolower (*p); c == '*'; c = c_tolower (*++p)) ; for (; *n != '\0'; n++) - if (TOLOWER (*n) == c && pattern_match (p, n)) + if (c_tolower (*n) == c && pattern_match (p, n)) return true; #ifdef ASTERISK_EXCLUDES_DOT else if (*n == '.') @@ -455,7 +455,7 @@ pattern_match (const char *pattern, const char *string) } else { - if (c != TOLOWER (*n)) + if (c != c_tolower (*n)) return false; } return *n == '\0'; diff --git a/src/res.c b/src/res.c index 56041229..0aea66f3 100644 --- a/src/res.c +++ b/src/res.c @@ -180,7 +180,7 @@ prune_non_exact (struct robot_specs *specs) #define EOL(p) ((p) >= lineend) #define SKIP_SPACE(p) do { \ - while (!EOL (p) && ISSPACE (*p)) \ + while (!EOL (p) && c_isspace (*p)) \ ++p; \ } while (0) @@ -266,18 +266,18 @@ res_parse (const char *source, int length) lineend to a location preceding the first comment. Real line ending remains in lineend_real. */ for (lineend = p; lineend < lineend_real; lineend++) - if ((lineend == p || ISSPACE (*(lineend - 1))) + if ((lineend == p || c_isspace (*(lineend - 1))) && *lineend == '#') break; /* Ignore trailing whitespace in the same way. */ - while (lineend > p && ISSPACE (*(lineend - 1))) + while (lineend > p && c_isspace (*(lineend - 1))) --lineend; assert (!EOL (p)); field_b = p; - while (!EOL (p) && (ISALNUM (*p) || *p == '-')) + while (!EOL (p) && (c_isalnum (*p) || *p == '-')) ++p; field_e = p; @@ -415,7 +415,7 @@ free_specs (struct robot_specs *specs) advance the pointer. */ #define DECODE_MAYBE(c, ptr) do { \ - if (c == '%' && ISXDIGIT (ptr[1]) && ISXDIGIT (ptr[2])) \ + if (c == '%' && c_isxdigit (ptr[1]) && c_isxdigit (ptr[2])) \ { \ char decoded = X2DIGITS_TO_NUM (ptr[1], ptr[2]); \ if (decoded != '/') \ diff --git a/src/url.c b/src/url.c index 72bb7b90..31dc09f6 100644 --- a/src/url.c +++ b/src/url.c @@ -183,7 +183,7 @@ url_unescape (char *s) { char c; /* Do nothing if '%' is not followed by two hex digits. */ - if (!h[1] || !h[2] || !(ISXDIGIT (h[1]) && ISXDIGIT (h[2]))) + if (!h[1] || !h[2] || !(c_isxdigit (h[1]) && c_isxdigit (h[2]))) goto copychar; c = X2DIGITS_TO_NUM (h[1], h[2]); /* Don't unescape %00 because there is no way to insert it @@ -272,7 +272,7 @@ char_needs_escaping (const char *p) { if (*p == '%') { - if (ISXDIGIT (*(p + 1)) && ISXDIGIT (*(p + 2))) + if (c_isxdigit (*(p + 1)) && c_isxdigit (*(p + 2))) return false; else /* Garbled %.. sequence: encode `%'. */ @@ -428,7 +428,7 @@ url_scheme (const char *url) return SCHEME_INVALID; } -#define SCHEME_CHAR(ch) (ISALNUM (ch) || (ch) == '-' || (ch) == '+') +#define SCHEME_CHAR(ch) (c_isalnum (ch) || (ch) == '-' || (ch) == '+') /* Return 1 if the URL begins with any "scheme", 0 otherwise. As currently implemented, it returns true if URL begins with @@ -590,10 +590,10 @@ lowercase_str (char *str) { bool changed = false; for (; *str; str++) - if (ISUPPER (*str)) + if (c_isupper (*str)) { changed = true; - *str = TOLOWER (*str); + *str = c_tolower (*str); } return changed; } @@ -769,7 +769,7 @@ url_parse (const char *url, int *error) if (port_b != port_e) for (port = 0, pp = port_b; pp < port_e; pp++) { - if (!ISDIGIT (*pp)) + if (!c_isdigit (*pp)) { /* http://host:12randomgarbage/blah */ /* ^ */ @@ -1373,9 +1373,9 @@ append_uri_pathel (const char *b, const char *e, bool escaped, for (q = TAIL (dest); q < TAIL (dest) + outlen; ++q) { if (opt.restrict_files_case == restrict_lowercase) - *q = TOLOWER (*q); + *q = c_tolower (*q); else - *q = TOUPPER (*q); + *q = c_toupper (*q); } } @@ -1940,7 +1940,7 @@ getchar_from_escaped_string (const char *str, char *c) if (p[0] == '%') { - if (!ISXDIGIT(p[1]) || !ISXDIGIT(p[2])) + if (!c_isxdigit(p[1]) || !c_isxdigit(p[2])) { *c = '%'; return 1; @@ -1982,7 +1982,7 @@ are_urls_equal (const char *u1, const char *u2) while (*p && *q && (pp = getchar_from_escaped_string (p, &ch1)) && (qq = getchar_from_escaped_string (q, &ch2)) - && (TOLOWER(ch1) == TOLOWER(ch2))) + && (c_tolower(ch1) == c_tolower(ch2))) { p += pp; q += qq; diff --git a/src/utils.c b/src/utils.c index 63545a32..003b3640 100644 --- a/src/utils.c +++ b/src/utils.c @@ -96,7 +96,7 @@ xstrdup_lower (const char *s) char *copy = xstrdup (s); char *p = copy; for (; *p; p++) - *p = TOLOWER (*p); + *p = c_tolower (*p); return copy; } @@ -135,7 +135,7 @@ sepstring (const char *s) res[++i] = NULL; ++s; /* Skip the blanks following the ','. */ - while (ISSPACE (*s)) + while (c_isspace (*s)) ++s; p = s; } @@ -636,10 +636,10 @@ fnmatch_nocase (const char *pattern, const char *string, int flags) char *strcopy = (char *) alloca (strlen (string) + 1); char *p; for (p = patcopy; *pattern; pattern++, p++) - *p = TOLOWER (*pattern); + *p = c_tolower (*pattern); *p = '\0'; for (p = strcopy; *string; string++, p++) - *p = TOLOWER (*string); + *p = c_tolower (*string); *p = '\0'; return fnmatch (patcopy, strcopy, flags); #endif @@ -681,7 +681,7 @@ subdir_p (const char *d1, const char *d2) for (; *d1 && *d2 && (*d1 == *d2); ++d1, ++d2) ; else - for (; *d1 && *d2 && (TOLOWER (*d1) == TOLOWER (*d2)); ++d1, ++d2) + for (; *d1 && *d2 && (c_tolower (*d1) == c_tolower (*d2)); ++d1, ++d2) ; return *d1 == '\0' && (*d2 == '\0' || *d2 == '/'); @@ -766,7 +766,7 @@ match_tail (const char *string, const char *tail, bool fold_case) else { for (i = strlen (string), j = strlen (tail); i >= 0 && j >= 0; i--, j--) - if (TOLOWER (string[i]) != TOLOWER (tail[j])) + if (c_tolower (string[i]) != c_tolower (tail[j])) break; } @@ -1940,7 +1940,7 @@ base64_encode (const void *data, int length, char *dest) when end of string is reached. */ #define NEXT_CHAR(c, p) do { \ c = (unsigned char) *p++; \ -} while (ISSPACE (c)) +} while (c_isspace (c)) #define IS_ASCII(c) (((c) & 0x80) == 0) diff --git a/src/wget.h b/src/wget.h index ac16504b..9d302064 100644 --- a/src/wget.h +++ b/src/wget.h @@ -213,7 +213,7 @@ typedef double SUM_SIZE_INT; /* Convert an ASCII hex digit to the corresponding number between 0 and 15. H should be a hexadecimal digit that satisfies isxdigit; otherwise, the result is undefined. */ -#define XDIGIT_TO_NUM(h) ((h) < 'A' ? (h) - '0' : TOUPPER (h) - 'A' + 10) +#define XDIGIT_TO_NUM(h) ((h) < 'A' ? (h) - '0' : c_toupper (h) - 'A' + 10) #define X2DIGITS_TO_NUM(h1, h2) ((XDIGIT_TO_NUM (h1) << 4) + XDIGIT_TO_NUM (h2)) /* The reverse of the above: convert a number in the [0, 16) range to