diff options
| author | Paul Eggert | 2014-08-31 17:06:11 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-08-31 17:06:11 -0700 |
| commit | 56f9f0ab54fd752773d8bb371a4032e43c9c224c (patch) | |
| tree | 44cee63bc391bde2b21f56ec8453e94b118c236e /lib-src | |
| parent | 60aa41b935d93c2f4126056de5263c535530ba5e (diff) | |
| download | emacs-56f9f0ab54fd752773d8bb371a4032e43c9c224c.tar.gz emacs-56f9f0ab54fd752773d8bb371a4032e43c9c224c.zip | |
* etags.c (emacs_strchr, emacs_strrchr): Remove.
All uses replaced by strchr and strrchr, which are on all
target platforms now.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 6 | ||||
| -rw-r--r-- | lib-src/etags.c | 73 |
2 files changed, 23 insertions, 56 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 199d46f4984..bf4d500921b 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-09-01 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * etags.c (emacs_strchr, emacs_strrchr): Remove. | ||
| 4 | All uses replaced by strchr and strrchr, which are on all | ||
| 5 | target platforms now. | ||
| 6 | |||
| 1 | 2014-07-15 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2014-07-15 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Use "b" flag more consistently; avoid "t" (Bug#18006). | 9 | Use "b" flag more consistently; avoid "t" (Bug#18006). |
diff --git a/lib-src/etags.c b/lib-src/etags.c index ae5491a8204..84ed03e375f 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -339,8 +339,6 @@ static char *skip_non_spaces (char *); | |||
| 339 | static char *skip_name (char *); | 339 | static char *skip_name (char *); |
| 340 | static char *savenstr (const char *, int); | 340 | static char *savenstr (const char *, int); |
| 341 | static char *savestr (const char *); | 341 | static char *savestr (const char *); |
| 342 | static char *etags_strchr (const char *, int); | ||
| 343 | static char *etags_strrchr (const char *, int); | ||
| 344 | static char *etags_getcwd (void); | 342 | static char *etags_getcwd (void); |
| 345 | static char *relative_filename (char *, char *); | 343 | static char *relative_filename (char *, char *); |
| 346 | static char *absolute_filename (char *, char *); | 344 | static char *absolute_filename (char *, char *); |
| @@ -1334,8 +1332,8 @@ get_compressor_from_suffix (char *file, char **extptr) | |||
| 1334 | 1332 | ||
| 1335 | /* File has been processed by canonicalize_filename, | 1333 | /* File has been processed by canonicalize_filename, |
| 1336 | so we don't need to consider backslashes on DOS_NT. */ | 1334 | so we don't need to consider backslashes on DOS_NT. */ |
| 1337 | slash = etags_strrchr (file, '/'); | 1335 | slash = strrchr (file, '/'); |
| 1338 | suffix = etags_strrchr (file, '.'); | 1336 | suffix = strrchr (file, '.'); |
| 1339 | if (suffix == NULL || suffix < slash) | 1337 | if (suffix == NULL || suffix < slash) |
| 1340 | return NULL; | 1338 | return NULL; |
| 1341 | if (extptr != NULL) | 1339 | if (extptr != NULL) |
| @@ -1422,7 +1420,7 @@ get_language_from_filename (char *file, int case_sensitive) | |||
| 1422 | return lang; | 1420 | return lang; |
| 1423 | 1421 | ||
| 1424 | /* If not found, try suffix after last dot. */ | 1422 | /* If not found, try suffix after last dot. */ |
| 1425 | suffix = etags_strrchr (file, '.'); | 1423 | suffix = strrchr (file, '.'); |
| 1426 | if (suffix == NULL) | 1424 | if (suffix == NULL) |
| 1427 | return NULL; | 1425 | return NULL; |
| 1428 | suffix += 1; | 1426 | suffix += 1; |
| @@ -1699,7 +1697,7 @@ find_entries (FILE *inf) | |||
| 1699 | /* Set lp to point at the first char after the last slash in the | 1697 | /* Set lp to point at the first char after the last slash in the |
| 1700 | line or, if no slashes, at the first nonblank. Then set cp to | 1698 | line or, if no slashes, at the first nonblank. Then set cp to |
| 1701 | the first successive blank and terminate the string. */ | 1699 | the first successive blank and terminate the string. */ |
| 1702 | lp = etags_strrchr (lb.buffer+2, '/'); | 1700 | lp = strrchr (lb.buffer+2, '/'); |
| 1703 | if (lp != NULL) | 1701 | if (lp != NULL) |
| 1704 | lp += 1; | 1702 | lp += 1; |
| 1705 | else | 1703 | else |
| @@ -1884,9 +1882,9 @@ pfnote (char *name, bool is_func, char *linestart, int linelen, int lno, | |||
| 1884 | /* If ctags mode, change name "main" to M<thisfilename>. */ | 1882 | /* If ctags mode, change name "main" to M<thisfilename>. */ |
| 1885 | if (CTAGS && !cxref_style && streq (name, "main")) | 1883 | if (CTAGS && !cxref_style && streq (name, "main")) |
| 1886 | { | 1884 | { |
| 1887 | register char *fp = etags_strrchr (curfdp->taggedfname, '/'); | 1885 | char *fp = strrchr (curfdp->taggedfname, '/'); |
| 1888 | np->name = concat ("M", fp == NULL ? curfdp->taggedfname : fp + 1, ""); | 1886 | np->name = concat ("M", fp == NULL ? curfdp->taggedfname : fp + 1, ""); |
| 1889 | fp = etags_strrchr (np->name, '.'); | 1887 | fp = strrchr (np->name, '.'); |
| 1890 | if (fp != NULL && fp[1] != '\0' && fp[2] == '\0') | 1888 | if (fp != NULL && fp[1] != '\0' && fp[2] == '\0') |
| 1891 | fp[0] = '\0'; | 1889 | fp[0] = '\0'; |
| 1892 | } | 1890 | } |
| @@ -4116,7 +4114,7 @@ Ada_funcs (FILE *inf) | |||
| 4116 | /* Skip a string i.e. "abcd". */ | 4114 | /* Skip a string i.e. "abcd". */ |
| 4117 | if (inquote || (*dbp == '"')) | 4115 | if (inquote || (*dbp == '"')) |
| 4118 | { | 4116 | { |
| 4119 | dbp = etags_strchr (dbp + !inquote, '"'); | 4117 | dbp = strchr (dbp + !inquote, '"'); |
| 4120 | if (dbp != NULL) | 4118 | if (dbp != NULL) |
| 4121 | { | 4119 | { |
| 4122 | inquote = false; | 4120 | inquote = false; |
| @@ -4274,7 +4272,7 @@ Perl_functions (FILE *inf) | |||
| 4274 | cp++; | 4272 | cp++; |
| 4275 | if (cp == sp) | 4273 | if (cp == sp) |
| 4276 | continue; /* nothing found */ | 4274 | continue; /* nothing found */ |
| 4277 | if ((pos = etags_strchr (sp, ':')) != NULL | 4275 | if ((pos = strchr (sp, ':')) != NULL |
| 4278 | && pos < cp && pos[1] == ':') | 4276 | && pos < cp && pos[1] == ':') |
| 4279 | /* The name is already qualified. */ | 4277 | /* The name is already qualified. */ |
| 4280 | make_tag (sp, cp - sp, true, | 4278 | make_tag (sp, cp - sp, true, |
| @@ -5029,7 +5027,7 @@ TEX_decode_env (const char *evarname, const char *defenv) | |||
| 5029 | 5027 | ||
| 5030 | /* Allocate a token table */ | 5028 | /* Allocate a token table */ |
| 5031 | for (len = 1, p = env; p;) | 5029 | for (len = 1, p = env; p;) |
| 5032 | if ((p = etags_strchr (p, ':')) && *++p != '\0') | 5030 | if ((p = strchr (p, ':')) && *++p != '\0') |
| 5033 | len++; | 5031 | len++; |
| 5034 | TEX_toktab = xnew (len, linebuffer); | 5032 | TEX_toktab = xnew (len, linebuffer); |
| 5035 | 5033 | ||
| @@ -5037,7 +5035,7 @@ TEX_decode_env (const char *evarname, const char *defenv) | |||
| 5037 | /* zero-length strings (leading ':', "::" and trailing ':') */ | 5035 | /* zero-length strings (leading ':', "::" and trailing ':') */ |
| 5038 | for (i = 0; *env != '\0';) | 5036 | for (i = 0; *env != '\0';) |
| 5039 | { | 5037 | { |
| 5040 | p = etags_strchr (env, ':'); | 5038 | p = strchr (env, ':'); |
| 5041 | if (!p) /* End of environment string. */ | 5039 | if (!p) /* End of environment string. */ |
| 5042 | p = env + strlen (env); | 5040 | p = env + strlen (env); |
| 5043 | if (p - env > 0) | 5041 | if (p - env > 0) |
| @@ -5767,9 +5765,9 @@ substitute (char *in, char *out, struct re_registers *regs) | |||
| 5767 | /* Pass 1: figure out how much to allocate by finding all \N strings. */ | 5765 | /* Pass 1: figure out how much to allocate by finding all \N strings. */ |
| 5768 | if (out[size - 1] == '\\') | 5766 | if (out[size - 1] == '\\') |
| 5769 | fatal ("pattern error in \"%s\"", out); | 5767 | fatal ("pattern error in \"%s\"", out); |
| 5770 | for (t = etags_strchr (out, '\\'); | 5768 | for (t = strchr (out, '\\'); |
| 5771 | t != NULL; | 5769 | t != NULL; |
| 5772 | t = etags_strchr (t + 2, '\\')) | 5770 | t = strchr (t + 2, '\\')) |
| 5773 | if (ISDIGIT (t[1])) | 5771 | if (ISDIGIT (t[1])) |
| 5774 | { | 5772 | { |
| 5775 | dig = t[1] - '0'; | 5773 | dig = t[1] - '0'; |
| @@ -6051,7 +6049,7 @@ readline (linebuffer *lbp, FILE *stream) | |||
| 6051 | { | 6049 | { |
| 6052 | char *endp = lbp->buffer + start; | 6050 | char *endp = lbp->buffer + start; |
| 6053 | 6051 | ||
| 6054 | while ((endp = etags_strchr (endp, '"')) != NULL | 6052 | while ((endp = strchr (endp, '"')) != NULL |
| 6055 | && endp[-1] == '\\') | 6053 | && endp[-1] == '\\') |
| 6056 | endp++; | 6054 | endp++; |
| 6057 | if (endp != NULL) | 6055 | if (endp != NULL) |
| @@ -6236,43 +6234,6 @@ savenstr (const char *cp, int len) | |||
| 6236 | return memcpy (dp, cp, len); | 6234 | return memcpy (dp, cp, len); |
| 6237 | } | 6235 | } |
| 6238 | 6236 | ||
| 6239 | /* | ||
| 6240 | * Return the ptr in sp at which the character c last | ||
| 6241 | * appears; NULL if not found | ||
| 6242 | * | ||
| 6243 | * Identical to POSIX strrchr, included for portability. | ||
| 6244 | */ | ||
| 6245 | static char * | ||
| 6246 | etags_strrchr (register const char *sp, register int c) | ||
| 6247 | { | ||
| 6248 | register const char *r; | ||
| 6249 | |||
| 6250 | r = NULL; | ||
| 6251 | do | ||
| 6252 | { | ||
| 6253 | if (*sp == c) | ||
| 6254 | r = sp; | ||
| 6255 | } while (*sp++); | ||
| 6256 | return (char *)r; | ||
| 6257 | } | ||
| 6258 | |||
| 6259 | /* | ||
| 6260 | * Return the ptr in sp at which the character c first | ||
| 6261 | * appears; NULL if not found | ||
| 6262 | * | ||
| 6263 | * Identical to POSIX strchr, included for portability. | ||
| 6264 | */ | ||
| 6265 | static char * | ||
| 6266 | etags_strchr (register const char *sp, register int c) | ||
| 6267 | { | ||
| 6268 | do | ||
| 6269 | { | ||
| 6270 | if (*sp == c) | ||
| 6271 | return (char *)sp; | ||
| 6272 | } while (*sp++); | ||
| 6273 | return NULL; | ||
| 6274 | } | ||
| 6275 | |||
| 6276 | /* Skip spaces (end of string is not space), return new pointer. */ | 6237 | /* Skip spaces (end of string is not space), return new pointer. */ |
| 6277 | static char * | 6238 | static char * |
| 6278 | skip_spaces (char *cp) | 6239 | skip_spaces (char *cp) |
| @@ -6398,7 +6359,7 @@ relative_filename (char *file, char *dir) | |||
| 6398 | 6359 | ||
| 6399 | /* Build a sequence of "../" strings for the resulting relative file name. */ | 6360 | /* Build a sequence of "../" strings for the resulting relative file name. */ |
| 6400 | i = 0; | 6361 | i = 0; |
| 6401 | while ((dp = etags_strchr (dp + 1, '/')) != NULL) | 6362 | while ((dp = strchr (dp + 1, '/')) != NULL) |
| 6402 | i += 1; | 6363 | i += 1; |
| 6403 | res = xnew (3*i + strlen (fp + 1) + 1, char); | 6364 | res = xnew (3*i + strlen (fp + 1) + 1, char); |
| 6404 | res[0] = '\0'; | 6365 | res[0] = '\0'; |
| @@ -6431,7 +6392,7 @@ absolute_filename (char *file, char *dir) | |||
| 6431 | res = concat (dir, file, ""); | 6392 | res = concat (dir, file, ""); |
| 6432 | 6393 | ||
| 6433 | /* Delete the "/dirname/.." and "/." substrings. */ | 6394 | /* Delete the "/dirname/.." and "/." substrings. */ |
| 6434 | slashp = etags_strchr (res, '/'); | 6395 | slashp = strchr (res, '/'); |
| 6435 | while (slashp != NULL && slashp[0] != '\0') | 6396 | while (slashp != NULL && slashp[0] != '\0') |
| 6436 | { | 6397 | { |
| 6437 | if (slashp[1] == '.') | 6398 | if (slashp[1] == '.') |
| @@ -6463,7 +6424,7 @@ absolute_filename (char *file, char *dir) | |||
| 6463 | } | 6424 | } |
| 6464 | } | 6425 | } |
| 6465 | 6426 | ||
| 6466 | slashp = etags_strchr (slashp + 1, '/'); | 6427 | slashp = strchr (slashp + 1, '/'); |
| 6467 | } | 6428 | } |
| 6468 | 6429 | ||
| 6469 | if (res[0] == '\0') /* just a safety net: should never happen */ | 6430 | if (res[0] == '\0') /* just a safety net: should never happen */ |
| @@ -6484,7 +6445,7 @@ absolute_dirname (char *file, char *dir) | |||
| 6484 | char *slashp, *res; | 6445 | char *slashp, *res; |
| 6485 | char save; | 6446 | char save; |
| 6486 | 6447 | ||
| 6487 | slashp = etags_strrchr (file, '/'); | 6448 | slashp = strrchr (file, '/'); |
| 6488 | if (slashp == NULL) | 6449 | if (slashp == NULL) |
| 6489 | return savestr (dir); | 6450 | return savestr (dir); |
| 6490 | save = slashp[1]; | 6451 | save = slashp[1]; |