From c908277be21c27a0894404821605134958521fd6 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 18 Mar 2008 09:10:13 +0200 Subject: Minimal namespacing for locale-insensitive x*() string functions --- build/expression.c | 10 +++++----- build/files.c | 10 +++++----- build/parseChangelog.c | 8 ++++---- build/parsePreamble.c | 20 ++++++++++---------- build/parseReqs.c | 6 +++--- build/parseSpec.c | 14 +++++++------- build/spec.c | 6 +++--- lib/poptALL.c | 2 +- lib/rpmds.c | 2 +- lib/rpmrc.c | 34 +++++++++++++++++----------------- lib/rpmts.c | 2 +- lib/rpmvercmp.c | 14 +++++++------- lib/signature.c | 8 ++++---- python/header-py.c | 2 +- python/rpmds-py.c | 2 +- rpmdb/dbconfig.c | 8 ++++---- rpmdb/header.c | 8 ++++---- rpmdb/rpmdb.c | 4 ++-- rpmdb/tagname.c | 20 ++++++++++---------- rpmio/macro.c | 12 ++++++------ rpmio/rpmstring.c | 14 +++++++------- rpmio/rpmstring.h | 32 ++++++++++++++++---------------- 22 files changed, 119 insertions(+), 119 deletions(-) diff --git a/build/expression.c b/build/expression.c index f0c21299b..d789b161d 100644 --- a/build/expression.c +++ b/build/expression.c @@ -181,7 +181,7 @@ static int rdToken(ParseState state) char *p = state->p; /* Skip whitespace before the next token. */ - while (*p && xisspace(*p)) p++; + while (*p && risspace(*p)) p++; switch (*p) { case '\0': @@ -256,11 +256,11 @@ static int rdToken(ParseState state) break; default: - if (xisdigit(*p)) { + if (risdigit(*p)) { char temp[EXPRBUFSIZ], *t = temp; temp[0] = '\0'; - while (*p && xisdigit(*p)) + while (*p && risdigit(*p)) *t++ = *p++; *t++ = '\0'; p--; @@ -268,11 +268,11 @@ static int rdToken(ParseState state) token = TOK_INTEGER; v = valueMakeInteger(atoi(temp)); - } else if (xisalpha(*p)) { + } else if (risalpha(*p)) { char temp[EXPRBUFSIZ], *t = temp; temp[0] = '\0'; - while (*p && (xisalnum(*p) || *p == '_')) + while (*p && (risalnum(*p) || *p == '_')) *t++ = *p++; *t++ = '\0'; p--; diff --git a/build/files.c b/build/files.c index fd11092aa..0277acca3 100644 --- a/build/files.c +++ b/build/files.c @@ -27,9 +27,9 @@ #include "debug.h" -#define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } -#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;} -#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;} +#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; } +#define SKIPWHITE(_x) {while(*(_x) && (risspace(*_x) || *(_x) == ',')) (_x)++;} +#define SKIPNONWHITE(_x){while(*(_x) &&!(risspace(*_x) || *(_x) == ',')) (_x)++;} #define MAXDOCDIR 1024 @@ -418,7 +418,7 @@ static rpmRC parseForDev(const char * buf, FileList fl) p = pe; SKIPWHITE(p); pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0'; - for (pe = p; *pe && xisdigit(*pe); pe++) + for (pe = p; *pe && risdigit(*pe); pe++) {} ; if (*pe == '\0') { fl->devmajor = atoi(p); @@ -434,7 +434,7 @@ static rpmRC parseForDev(const char * buf, FileList fl) p = pe; SKIPWHITE(p); pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0'; - for (pe = p; *pe && xisdigit(*pe); pe++) + for (pe = p; *pe && risdigit(*pe); pe++) {} ; if (*pe == '\0') { fl->devminor = atoi(p); diff --git a/build/parseChangelog.c b/build/parseChangelog.c index 3a6e000df..0c4b83237 100644 --- a/build/parseChangelog.c +++ b/build/parseChangelog.c @@ -10,8 +10,8 @@ #include #include "debug.h" -#define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } -#define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; } +#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; } +#define SKIPNONSPACE(s) { while (*(s) && !risspace(*(s))) (s)++; } void addChangelogEntry(Header h, time_t time, const char *name, const char *text) { @@ -170,7 +170,7 @@ static rpmRC addChangelog(Header h, StringBuf sb) /* name */ name = s; while (*s != '\0') s++; - while (s > name && xisspace(*s)) { + while (s > name && risspace(*s)) { *s-- = '\0'; } if (s == name) { @@ -194,7 +194,7 @@ static rpmRC addChangelog(Header h, StringBuf sb) s--; /* backup to end of description */ - while ((s > text) && xisspace(*s)) { + while ((s > text) && risspace(*s)) { *s-- = '\0'; } diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 656d1152e..07e4ff009 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -11,8 +11,8 @@ #include #include "debug.h" -#define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } -#define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; } +#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; } +#define SKIPNONSPACE(s) { while (*(s) && !risspace(*(s))) (s)++; } /** */ @@ -103,7 +103,7 @@ static int parseSimplePart(const char *line, char **name, int *flag) static inline int parseYesNo(const char * s) { return ((!s || (s[0] == 'n' || s[0] == 'N' || s[0] == '0') || - !xstrcasecmp(s, "false") || !xstrcasecmp(s, "off")) + !rstrcasecmp(s, "false") || !rstrcasecmp(s, "off")) ? 0 : 1); } @@ -148,9 +148,9 @@ static int parseBits(const char * s, const tokenBits tokbits, if (s) { while (*s != '\0') { - while ((c = *s) && xisspace(c)) s++; + while ((c = *s) && risspace(c)) s++; se = s; - while ((c = *se) && xisalpha(c)) se++; + while ((c = *se) && risalpha(c)) se++; if (s == se) break; for (tb = tokbits; tb->name; tb++) { @@ -161,7 +161,7 @@ static int parseBits(const char * s, const tokenBits tokbits, if (tb->name == NULL) break; bits |= tb->bits; - while ((c = *se) && xisspace(c)) se++; + while ((c = *se) && risspace(c)) se++; if (c != ',') break; s = ++se; @@ -178,7 +178,7 @@ static inline char * findLastChar(char * s) char *res = s; while (*s != '\0') { - if (! xisspace(*s)) + if (! risspace(*s)) res = s; s++; } @@ -199,7 +199,7 @@ static int isMemberInEntry(Header h, const char *name, rpmTag tag) if (!hge(h, tag, &type, (rpm_data_t *)&names, &count)) return -1; while (count--) { - if (!xstrcasecmp(names[count], name)) + if (!rstrcasecmp(names[count], name)) break; } names = hfd(names, type); @@ -754,7 +754,7 @@ static int findPreambleTag(rpmSpec spec,rpmTag * tag, initPreambleList(); for (p = preambleList; p->token != NULL; p++) { - if (!(p->token && !xstrncasecmp(spec->line, p->token, p->len))) + if (!(p->token && !rstrncasecmp(spec->line, p->token, p->len))) continue; if (p->obsolete) { rpmlog(RPMLOG_ERR, _("Legacy syntax is unsupported: %s\n"), @@ -786,7 +786,7 @@ static int findPreambleTag(rpmSpec spec,rpmTag * tag, if (*s != '(') return 1; s++; SKIPSPACE(s); - while (!xisspace(*s) && *s != ')') + while (!risspace(*s) && *s != ')') *lang++ = *s++; *lang = '\0'; SKIPSPACE(s); diff --git a/build/parseReqs.c b/build/parseReqs.c index 33bd55771..3913c972d 100644 --- a/build/parseReqs.c +++ b/build/parseReqs.c @@ -30,8 +30,8 @@ const char * token; { NULL, 0 }, }; -#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;} -#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;} +#define SKIPWHITE(_x) {while(*(_x) && (risspace(*_x) || *(_x) == ',')) (_x)++;} +#define SKIPNONWHITE(_x){while(*(_x) &&!(risspace(*_x) || *(_x) == ',')) (_x)++;} rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN, int index, rpmsenseFlags tagflags) @@ -101,7 +101,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN, Flags = (tagflags & ~RPMSENSE_SENSEMASK); /* Tokens must begin with alphanumeric, _, or / */ - if (!(xisalnum(r[0]) || r[0] == '_' || r[0] == '/')) { + if (!(risalnum(r[0]) || r[0] == '_' || r[0] == '/')) { rpmlog(RPMLOG_ERR, _("line %d: Dependency tokens must begin with alpha-numeric, '_' or '/': %s\n"), spec->lineNum, spec->line); diff --git a/build/parseSpec.c b/build/parseSpec.c index 690166b07..32234e3d8 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -14,8 +14,8 @@ #include #include "debug.h" -#define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } -#define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; } +#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; } +#define SKIPNONSPACE(s) { while (*(s) && !risspace(*(s))) (s)++; } /* XXX FIXME: strlen for these is calculated at runtime, preventing const */ static struct PartRec { @@ -64,10 +64,10 @@ rpmParseState isPart(const char *line) for (p = partList; p->token != NULL; p++) { char c; - if (xstrncasecmp(line, p->token, p->len)) + if (rstrncasecmp(line, p->token, p->len)) continue; c = *(line + p->len); - if (c == '\0' || xisspace(c)) + if (c == '\0' || risspace(c)) break; } @@ -88,7 +88,7 @@ static int matchTok(const char *token, const char *line) SKIPNONSPACE(be); if (be == b) break; - if (toklen != (be-b) || xstrncasecmp(token, b, (be-b))) + if (toklen != (be-b) || rstrncasecmp(token, b, (be-b))) continue; rc = 1; break; @@ -199,7 +199,7 @@ static void copyNextLineFinish(rpmSpec spec, int strip) ch = ' '; while (*spec->nextline && ch != '\n') { ch = *spec->nextline++; - if (!xisspace(ch)) + if (!risspace(ch)) last = spec->nextline; } @@ -360,7 +360,7 @@ int readLine(rpmSpec spec, int strip) s += 8; fileName = s; - if (! xisspace(*fileName)) { + if (! risspace(*fileName)) { rpmlog(RPMLOG_ERR, _("malformed %%include statement\n")); return RPMRC_FAIL; } diff --git a/build/spec.c b/build/spec.c index 1f9266de5..30ae4ce08 100644 --- a/build/spec.c +++ b/build/spec.c @@ -19,9 +19,9 @@ extern int specedit; -#define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } -#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;} -#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;} +#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; } +#define SKIPWHITE(_x) {while(*(_x) && (risspace(*_x) || *(_x) == ',')) (_x)++;} +#define SKIPNONWHITE(_x){while(*(_x) &&!(risspace(*_x) || *(_x) == ',')) (_x)++;} /** * @param p trigger entry chain diff --git a/lib/poptALL.c b/lib/poptALL.c index 18b91ad1f..14cfd84af 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -120,7 +120,7 @@ static void rpmcliAllArgCallback( poptContext con, { char *s, *t; /* XXX Convert '-' in macro name to underscore, skip leading %. */ s = t = xstrdup(arg); - while (*t && !xisspace(*t)) { + while (*t && !risspace(*t)) { if (*t == '-') *t = '_'; t++; } diff --git a/lib/rpmds.c b/lib/rpmds.c index 9a03d7bce..403409cf8 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -777,7 +777,7 @@ void parseEVR(char * evr, char *s, *se; s = evr; - while (*s && xisdigit(*s)) s++; /* s points to epoch terminator */ + while (*s && risdigit(*s)) s++; /* s points to epoch terminator */ se = strrchr(s, '-'); /* se points to version terminator */ if (*s == ':') { diff --git a/lib/rpmrc.c b/lib/rpmrc.c index 00f830d9a..61e8e2602 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -163,7 +163,7 @@ static void rpmRebuildTargetVars(const char **target, const char ** canontarget) static int optionCompare(const void * a, const void * b) { - return xstrcasecmp(((const struct rpmOption *) a)->name, + return rstrcasecmp(((const struct rpmOption *) a)->name, ((const struct rpmOption *) b)->name); } @@ -187,7 +187,7 @@ static int machCompatCacheAdd(char * name, const char * fn, int linenum, int delEntry = 0; int i; - while (*name && xisspace(*name)) name++; + while (*name && risspace(*name)) name++; chptr = name; while (*chptr && *chptr != ':') chptr++; @@ -200,10 +200,10 @@ static int machCompatCacheAdd(char * name, const char * fn, int linenum, return 1; } - while (*chptr == ':' || xisspace(*chptr)) chptr--; + while (*chptr == ':' || risspace(*chptr)) chptr--; *(++chptr) = '\0'; equivs = chptr + 1; - while (*equivs && xisspace(*equivs)) equivs++; + while (*equivs && risspace(*equivs)) equivs++; if (!*equivs) { delEntry = 1; } @@ -252,7 +252,7 @@ machEquivSearch(const machEquivTable table, const char * name) int i; for (i = 0; i < table->count; i++) - if (!xstrcasecmp(table->list[i].name, name)) + if (!rstrcasecmp(table->list[i].name, name)) return table->list + i; return NULL; @@ -541,18 +541,18 @@ static rpmRC doReadRC( FD_t fd, const char * urlfn) next = se; /* Trim leading spaces */ - while (*s && xisspace(*s)) s++; + while (*s && risspace(*s)) s++; /* We used to allow comments to begin anywhere, but not anymore. */ if (*s == '#' || *s == '\0') continue; /* Find end-of-keyword. */ se = (char *)s; - while (*se && !xisspace(*se) && *se != ':') se++; + while (*se && !risspace(*se) && *se != ':') se++; - if (xisspace(*se)) { + if (risspace(*se)) { *se++ = '\0'; - while (*se && xisspace(*se) && *se != ':') se++; + while (*se && risspace(*se) && *se != ':') se++; } if (*se != ':') { @@ -561,7 +561,7 @@ static rpmRC doReadRC( FD_t fd, const char * urlfn) return RPMRC_FAIL; } *se++ = '\0'; /* terminate keyword or option, point to value */ - while (*se && xisspace(*se)) se++; + while (*se && risspace(*se)) se++; /* Find keyword in table */ searchOption.name = s; @@ -584,7 +584,7 @@ static rpmRC doReadRC( FD_t fd, const char * urlfn) { FD_t fdinc; s = se; - while (*se && !xisspace(*se)) se++; + while (*se && !risspace(*se)) se++; if (*se != '\0') *se++ = '\0'; #if 0 /* XXX doesn't seem to do anything useful, only break things... */ @@ -617,7 +617,7 @@ static rpmRC doReadRC( FD_t fd, const char * urlfn) if (option->archSpecific) { arch = se; - while (*se && !xisspace(*se)) se++; + while (*se && !risspace(*se)) se++; if (*se == '\0') { rpmlog(RPMLOG_ERR, _("missing architecture for %s at %s:%d\n"), @@ -625,7 +625,7 @@ static rpmRC doReadRC( FD_t fd, const char * urlfn) return RPMRC_FAIL; } *se++ = '\0'; - while (*se && xisspace(*se)) se++; + while (*se && risspace(*se)) se++; if (*se == '\0') { rpmlog(RPMLOG_ERR, _("missing argument for %s at %s:%d\n"), @@ -1071,7 +1071,7 @@ static void defaultMachine(const char ** arch, for (fd = 0; (un.release[fd] != 0 && (fd < sizeof(un.release))); fd++) { - if (!xisdigit(un.release[fd]) && (un.release[fd] != '.')) { + if (!risdigit(un.release[fd]) && (un.release[fd] != '.')) { un.release[fd] = 0; break; } @@ -1481,7 +1481,7 @@ static void rpmRebuildTargetVars(const char ** target, const char ** canontarget if ((co = strrchr(c, '-')) == NULL) { co = c; } else { - if (!xstrcasecmp(co, "-gnu")) + if (!rstrcasecmp(co, "-gnu")) *co = '\0'; if ((co = strrchr(c, '-')) == NULL) co = c; @@ -1507,7 +1507,7 @@ static void rpmRebuildTargetVars(const char ** target, const char ** canontarget ca = (a) ? xstrdup(a) : NULL; } for (x = 0; ca[x] != '\0'; x++) - ca[x] = xtolower(ca[x]); + ca[x] = rtolower(ca[x]); if (co == NULL) { const char *o = NULL; @@ -1515,7 +1515,7 @@ static void rpmRebuildTargetVars(const char ** target, const char ** canontarget co = (o) ? xstrdup(o) : NULL; } for (x = 0; co[x] != '\0'; x++) - co[x] = xtolower(co[x]); + co[x] = rtolower(co[x]); /* XXX For now, set canonical target to arch-os */ if (ct == NULL) { diff --git a/lib/rpmts.c b/lib/rpmts.c index b1f539150..380028e62 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -209,7 +209,7 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, return NULL; } /* Parse explicit epoch. */ - for (se = s; *se && xisdigit(*se); se++) + for (se = s; *se && risdigit(*se); se++) {}; if (*se == ':') { /* XXX skip explicit epoch's (for now) */ diff --git a/lib/rpmvercmp.c b/lib/rpmvercmp.c index ba5c4720d..d3190c1b1 100644 --- a/lib/rpmvercmp.c +++ b/lib/rpmvercmp.c @@ -35,8 +35,8 @@ int rpmvercmp(const char * a, const char * b) /* loop through each version segment of str1 and str2 and compare them */ while (*one && *two) { - while (*one && !xisalnum(*one)) one++; - while (*two && !xisalnum(*two)) two++; + while (*one && !risalnum(*one)) one++; + while (*two && !risalnum(*two)) two++; /* If we ran to the end of either, we are finished with the loop */ if (!(*one && *two)) break; @@ -47,13 +47,13 @@ int rpmvercmp(const char * a, const char * b) /* grab first completely alpha or completely numeric segment */ /* leave one and two pointing to the start of the alpha or numeric */ /* segment and walk str1 and str2 to end of segment */ - if (xisdigit(*str1)) { - while (*str1 && xisdigit(*str1)) str1++; - while (*str2 && xisdigit(*str2)) str2++; + if (risdigit(*str1)) { + while (*str1 && risdigit(*str1)) str1++; + while (*str2 && risdigit(*str2)) str2++; isnum = 1; } else { - while (*str1 && xisalpha(*str1)) str1++; - while (*str2 && xisalpha(*str2)) str2++; + while (*str1 && risalpha(*str1)) str1++; + while (*str2 && risalpha(*str2)) str2++; isnum = 0; } diff --git a/lib/signature.c b/lib/signature.c index f0f6a58ff..6ad3d61da 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -44,13 +44,13 @@ int rpmLookupSignatureType(int action) { char *name = rpmExpand("%{?_signature}", NULL); if (!(name && *name != '\0')) rc = 0; - else if (!xstrcasecmp(name, "none")) + else if (!rstrcasecmp(name, "none")) rc = 0; - else if (!xstrcasecmp(name, "pgp")) + else if (!rstrcasecmp(name, "pgp")) rc = RPMSIGTAG_PGP; - else if (!xstrcasecmp(name, "pgp5")) /* XXX legacy */ + else if (!rstrcasecmp(name, "pgp5")) /* XXX legacy */ rc = RPMSIGTAG_PGP; - else if (!xstrcasecmp(name, "gpg")) + else if (!rstrcasecmp(name, "gpg")) rc = RPMSIGTAG_GPG; else rc = -1; /* Invalid %_signature spec in macro file */ diff --git a/python/header-py.c b/python/header-py.c index 173b2f490..23b9ebb4d 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -435,7 +435,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) str = PyString_AsString(item); while (extensions->name) { if (extensions->type == HEADER_EXT_TAG - && !xstrcasecmp(extensions->name + 7, str)) { + && !rstrcasecmp(extensions->name + 7, str)) { ext = extensions; } extensions++; diff --git a/python/rpmds-py.c b/python/rpmds-py.c index ab4d5586b..24effd359 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -33,7 +33,7 @@ void rpmds_ParseEVR(char * evr, char *s, *se; s = evr; - while (*s && xisdigit(*s)) s++; /* s points to epoch terminator */ + while (*s && risdigit(*s)) s++; /* s points to epoch terminator */ se = strrchr(s, '-'); /* se points to version terminator */ if (*s == ':') { diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c index 6909416d3..29541c59c 100644 --- a/rpmdb/dbconfig.c +++ b/rpmdb/dbconfig.c @@ -293,12 +293,12 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag) unsigned int argInfo; /* Skip leading white space. */ - while (*o && xisspace(*o)) + while (*o && risspace(*o)) o++; /* Find and terminate next key=value pair. Save next start point. */ for (oe = o; oe && *oe; oe++) { - if (xisspace(*oe)) + if (risspace(*oe)) break; if (oe[0] == ':' && !(oe[1] == '/' && oe[2] == '/')) break; @@ -356,9 +356,9 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag) case POPT_ARG_LONG: { long aLong = strtol(p, &pe, 0); if (pe) { - if (!xstrncasecmp(pe, "Mb", 2)) + if (!rstrncasecmp(pe, "Mb", 2)) aLong *= 1024 * 1024; - else if (!xstrncasecmp(pe, "Kb", 2)) + else if (!rstrncasecmp(pe, "Kb", 2)) aLong *= 1024; else if (*pe != '\0') { rpmlog(RPMLOG_ERR, diff --git a/rpmdb/header.c b/rpmdb/header.c index 18b7aa828..3a3f80c82 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -1996,7 +1996,7 @@ static const char * myTagName(headerTagTableEntry tbl, int val) t = name; *t++ = *s++; while (*s != '\0') - *t++ = xtolower(*s++); + *t++ = rtolower(*s++); *t = '\0'; return name; } @@ -2011,7 +2011,7 @@ static const char * myTagName(headerTagTableEntry tbl, int val) static int myTagValue(headerTagTableEntry tbl, const char * name) { for (; tbl->name != NULL; tbl++) { - if (!xstrcasecmp(tbl->name, name)) + if (!rstrcasecmp(tbl->name, name)) return tbl->val; } return 0; @@ -2052,7 +2052,7 @@ static int findTag(headerSprintfArgs hsa, sprintfToken token, const char * name) { if (ext->name == NULL || ext->type != HEADER_EXT_TAG) continue; - if (!xstrcasecmp(ext->name, name)) { + if (!rstrcasecmp(ext->name, name)) { stag->ext = ext->u.tagFunction; stag->extNum = ext - hsa->exts; goto bingo; @@ -2178,7 +2178,7 @@ static int parseFormat(headerSprintfArgs hsa, char * str, *chptr++ = '\0'; while (start < chptr) { - if (xisdigit(*start)) { + if (risdigit(*start)) { i = strtoul(start, &start, 10); token->u.tag.pad += i; start = chptr; diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index c3cd0564e..6c87b0c4f 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -168,12 +168,12 @@ static void dbiTagsInit(void) dbiTags.tags[dbiTags.max++] = RPMDBI_PACKAGES; for (o = dbiTagStr; o && *o; o = oe) { - while (*o && xisspace(*o)) + while (*o && risspace(*o)) o++; if (*o == '\0') break; for (oe = o; oe && *oe; oe++) { - if (xisspace(*oe)) + if (risspace(*oe)) break; if (oe[0] == ':' && !(oe[1] == '/' && oe[2] == '/')) break; diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c index c312f8c4b..191db4d9f 100644 --- a/rpmdb/tagname.c +++ b/rpmdb/tagname.c @@ -166,7 +166,7 @@ static const char * _tagName(rpmTag tag) if (t->name != NULL) strcpy(nameBuf, t->name + (sizeof("RPMTAG_")-1)); for (s = nameBuf+1; *s != '\0'; s++) - *s = xtolower(*s); + *s = rtolower(*s); break; } } @@ -229,21 +229,21 @@ static rpmTag _tagValue(const char * tagstr) int comparison, i, l, u; int xx; - if (!xstrcasecmp(tagstr, "Packages")) + if (!rstrcasecmp(tagstr, "Packages")) return RPMDBI_PACKAGES; - if (!xstrcasecmp(tagstr, "Depends")) + if (!rstrcasecmp(tagstr, "Depends")) return RPMDBI_DEPENDS; - if (!xstrcasecmp(tagstr, "Added")) + if (!rstrcasecmp(tagstr, "Added")) return RPMDBI_ADDED; - if (!xstrcasecmp(tagstr, "Removed")) + if (!rstrcasecmp(tagstr, "Removed")) return RPMDBI_REMOVED; - if (!xstrcasecmp(tagstr, "Available")) + if (!rstrcasecmp(tagstr, "Available")) return RPMDBI_AVAILABLE; - if (!xstrcasecmp(tagstr, "Hdlist")) + if (!rstrcasecmp(tagstr, "Hdlist")) return RPMDBI_HDLIST; - if (!xstrcasecmp(tagstr, "Arglist")) + if (!rstrcasecmp(tagstr, "Arglist")) return RPMDBI_ARGLIST; - if (!xstrcasecmp(tagstr, "Ftswalk")) + if (!rstrcasecmp(tagstr, "Ftswalk")) return RPMDBI_FTSWALK; if (_rpmTags.byName == NULL) @@ -257,7 +257,7 @@ static rpmTag _tagValue(const char * tagstr) i = (l + u) / 2; t = _rpmTags.byName[i]; - comparison = xstrcasecmp(tagstr, t->name + (sizeof("RPMTAG_")-1)); + comparison = rstrcasecmp(tagstr, t->name + (sizeof("RPMTAG_")-1)); if (comparison < 0) u = i; diff --git a/rpmio/macro.c b/rpmio/macro.c index 8792f38d8..03415ab84 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -399,7 +399,7 @@ printExpansion(MacroBuf mb, const char * t, const char * te) #define COPYNAME(_ne, _s, _c) \ { SKIPBLANK(_s,_c); \ - while(((_c) = *(_s)) && (xisalnum(_c) || (_c) == '_')) \ + while(((_c) = *(_s)) && (risalnum(_c) || (_c) == '_')) \ *(_ne)++ = *(_s)++; \ *(_ne) = '\0'; \ } @@ -611,7 +611,7 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody) se = s; /* Names must start with alphabetic or _ and be at least 3 chars */ - if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) { + if (!((c = *n) && (risalpha(c) || c == '_') && (ne - n) > 2)) { rpmlog(RPMLOG_ERR, _("Macro %%%s has illegal name (%%define)\n"), n); return se; @@ -662,7 +662,7 @@ doUndefine(rpmMacroContext mc, const char * se) se = s; /* Names must start with alphabetic or _ and be at least 3 chars */ - if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) { + if (!((c = *n) && (risalpha(c) || c == '_') && (ne - n) > 2)) { rpmlog(RPMLOG_ERR, _("Macro %%%s has illegal name (%%undefine)\n"), n); goto exit; @@ -1032,7 +1032,7 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn, } b = be; } else if (STREQ("S", f, fn)) { - for (b = buf; (c = *b) && xisdigit(c);) + for (b = buf; (c = *b) && risdigit(c);) b++; if (!c) { /* digit index */ b++; @@ -1040,7 +1040,7 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn, } else b = buf; } else if (STREQ("P", f, fn)) { - for (b = buf; (c = *b) && xisdigit(c);) + for (b = buf; (c = *b) && risdigit(c);) b++; if (!c) { /* digit index */ b++; @@ -1127,7 +1127,7 @@ expandMacro(MacroBuf mb) f = se = s; if (*se == '-') se++; - while((c = *se) && (xisalnum(c) || c == '_')) + while((c = *se) && (risalnum(c) || c == '_')) se++; /* Recognize non-alnum macros too */ switch (*se) { diff --git a/rpmio/rpmstring.c b/rpmio/rpmstring.c index 405a8e255..fbac425a2 100644 --- a/rpmio/rpmstring.c +++ b/rpmio/rpmstring.c @@ -98,7 +98,7 @@ void truncStringBuf(StringBuf sb) void stripTrailingBlanksStringBuf(StringBuf sb) { while (sb->free != sb->allocated) { - if (! xisspace(*(sb->tail - 1))) + if (! risspace(*(sb->tail - 1))) break; sb->free++; sb->tail--; @@ -136,7 +136,7 @@ void appendStringBufAux(StringBuf sb, const char *s, int nl) } } -int xstrcasecmp(const char * s1, const char * s2) +int rstrcasecmp(const char * s1, const char * s2) { const char * p1 = s1; const char * p2 = s2; @@ -147,8 +147,8 @@ int xstrcasecmp(const char * s1, const char * s2) do { - c1 = xtolower (*p1++); - c2 = xtolower (*p2++); + c1 = rtolower (*p1++); + c2 = rtolower (*p2++); if (c1 == '\0') break; } @@ -157,7 +157,7 @@ int xstrcasecmp(const char * s1, const char * s2) return (int)(c1 - c2); } -int xstrncasecmp(const char *s1, const char *s2, size_t n) +int rstrncasecmp(const char *s1, const char *s2, size_t n) { const char * p1 = s1; const char * p2 = s2; @@ -168,8 +168,8 @@ int xstrncasecmp(const char *s1, const char *s2, size_t n) do { - c1 = xtolower (*p1++); - c2 = xtolower (*p2++); + c1 = rtolower (*p1++); + c2 = rtolower (*p2++); if (c1 == '\0' || c1 != c2) break; } while (--n > 0); diff --git a/rpmio/rpmstring.h b/rpmio/rpmstring.h index 91091373c..aaf4b3406 100644 --- a/rpmio/rpmstring.h +++ b/rpmio/rpmstring.h @@ -15,75 +15,75 @@ extern "C" { /** \ingroup rpmstring * Locale insensitive islower(3) */ -static inline int xislower(int c) { +static inline int rislower(int c) { return (c >= 'a' && c <= 'z'); } /** \ingroup rpmstring * Locale insensitive isupper(3) */ -static inline int xisupper(int c) { +static inline int risupper(int c) { return (c >= 'A' && c <= 'Z'); } /** \ingroup rpmstring * Locale insensitive isalpha(3) */ -static inline int xisalpha(int c) { - return (xislower(c) || xisupper(c)); +static inline int risalpha(int c) { + return (rislower(c) || risupper(c)); } /** \ingroup rpmstring * Locale insensitive isdigit(3) */ -static inline int xisdigit(int c) { +static inline int risdigit(int c) { return (c >= '0' && c <= '9'); } /** \ingroup rpmstring * Locale insensitive isalnum(3) */ -static inline int xisalnum(int c) { - return (xisalpha(c) || xisdigit(c)); +static inline int risalnum(int c) { + return (risalpha(c) || risdigit(c)); } /** \ingroup rpmstring * Locale insensitive isblank(3) */ -static inline int xisblank(int c) { +static inline int risblank(int c) { return (c == ' ' || c == '\t'); } /** \ingroup rpmstring * Locale insensitive isspace(3) */ -static inline int xisspace(int c) { - return (xisblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v'); +static inline int risspace(int c) { + return (risblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v'); } /** \ingroup rpmstring * Locale insensitive tolower(3) */ -static inline int xtolower(int c) { - return ((xisupper(c)) ? (c | ('a' - 'A')) : c); +static inline int rtolower(int c) { + return ((risupper(c)) ? (c | ('a' - 'A')) : c); } /** \ingroup rpmstring * Locale insensitive toupper(3) */ -static inline int xtoupper(int c) { - return ((xislower(c)) ? (c & ~('a' - 'A')) : c); +static inline int rtoupper(int c) { + return ((rislower(c)) ? (c & ~('a' - 'A')) : c); } /** \ingroup rpmstring * Locale insensitive strcasecmp(3). */ -int xstrcasecmp(const char * s1, const char * s2) ; +int rstrcasecmp(const char * s1, const char * s2) ; /** \ingroup rpmstring * Locale insensitive strncasecmp(3). */ -int xstrncasecmp(const char *s1, const char * s2, size_t n) ; +int rstrncasecmp(const char *s1, const char * s2, size_t n) ; /** \ingroup rpmstring * Split string into fields separated by a character. -- cgit v1.2.3