]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
As a minor cleanup remove the (r)index defines from include/string.h as
authorWilco Dijkstra <wdijkstr@arm.com>
Mon, 6 Feb 2017 18:14:16 +0000 (18:14 +0000)
committerWilco Dijkstra <wdijkstr@arm.com>
Mon, 6 Feb 2017 18:15:18 +0000 (18:15 +0000)
they are only used internally in a few places.  Rename all uses that
occur in GLIBC.

* hurd/path-lookup.c (file_name_path_scan): Rename index to strchr.
* include/string.h (index): Remove define.
(rindex): Likewise.
* misc/getttyent.c (__getttyent): Rename index to strchr.
* misc/ttyslot.c (ttyslot): Rename rindex to strrchr.
* sunrpc/rpc_main.c (mkfile_output): Likewise.

ChangeLog
hurd/path-lookup.c
include/string.h
misc/getttyent.c
misc/ttyslot.c
sunrpc/rpc_main.c

index db64d85ee1485c2e6fe10910256e525b7d326142..d058211edb081fb4975c666d9b7c02c0d94f2e52 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-02-06  Wilco Dijkstra  <wdijkstr@arm.com>
+
+       * hurd/path-lookup.c (file_name_path_scan): Rename index to strchr.
+       * include/string.h (index): Remove define.
+       (rindex): Likewise.
+       * misc/getttyent.c (__getttyent): Rename index to strchr.
+       * misc/ttyslot.c (ttyslot): Rename rindex to strrchr.
+       * sunrpc/rpc_main.c (mkfile_output): Likewise.
+
 2017-02-06  Joseph Myers  <joseph@codesourcery.com>
 
        * math/libm-test-driver.c: New file.  Based on math/libm-test.inc.
index d79a482e834d15895f64efd2858899eb9aaf48cd..f2061b0bff1a1babced48e98f6592a5c15e177b2 100644 (file)
@@ -33,7 +33,7 @@ file_name_path_scan (const char *file_name, const char *path,
                     error_t (*fun)(const char *name),
                     char **prefixed_name)
 {
-  if (path == NULL || index (file_name, '/'))
+  if (path == NULL || strchr (file_name, '/'))
     {
       if (prefixed_name)
        *prefixed_name = 0;
@@ -47,7 +47,7 @@ file_name_path_scan (const char *file_name, const char *path,
       for (;;)
        {
          error_t err;
-         const char *next = index (path, ':') ?: path + strlen (path);
+         const char *next = strchr (path, ':') ?: path + strlen (path);
          size_t pfx_len = next - path;
          char pfxed_name[pfx_len + 2 + file_name_len + 1];
 
index 300a2e2faa7d4000431329e2c7848db7bb9a6258..07389f327886bccc3ba30a0056c25a309c72079c 100644 (file)
@@ -160,15 +160,6 @@ extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
 extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
 #endif
 
-# ifndef _ISOMAC
-#  ifndef index
-#   define index(s, c) (strchr ((s), (c)))
-#  endif
-#  ifndef rindex
-#   define rindex(s, c)        (strrchr ((s), (c)))
-#  endif
-# endif
-
 extern void *__memcpy_chk (void *__restrict __dest,
                           const void *__restrict __src, size_t __len,
                           size_t __destlen) __THROW;
index d2af87012343b0596d50dfdecff14ecf55c16732..73002f52d10dc30af95d3163bc5f7a1992fe9dce 100644 (file)
@@ -78,7 +78,7 @@ __getttyent (void)
                        return (NULL);
                }
                /* skip lines that are too big */
-               if (!index(p, '\n')) {
+               if (!strchr (p, '\n')) {
                        while ((c = getc_unlocked(tf)) != '\n' && c != EOF)
                                ;
                        continue;
@@ -127,7 +127,7 @@ __getttyent (void)
        tty.ty_comment = p;
        if (*p == 0)
                tty.ty_comment = 0;
-       if ((p = index(p, '\n')))
+       if ((p = strchr (p, '\n')))
                *p = '\0';
        return (&tty);
 }
@@ -179,7 +179,7 @@ internal_function
 value (char *p)
 {
 
-       return ((p = index(p, '=')) ? ++p : NULL);
+       return ((p = strchr (p, '=')) ? ++p : NULL);
 }
 
 int
index 0ed14d73ea53e7ed09c58717316fea20fa0177eb..2f3c7953d75c8522f3b6447c43a9e33aa19e8f72 100644 (file)
@@ -56,7 +56,7 @@ ttyslot (void)
        __setttyent();
        for (cnt = 0; cnt < 3; ++cnt)
                if (__ttyname_r (cnt, name, buflen) == 0) {
-                       if ((p = rindex(name, '/')))
+                       if ((p = strrchr (name, '/')))
                                ++p;
                        else
                                p = name;
index 0a51e2cfa233570eeee15705da19c1af7ad3147e..f94bc91546ffe58881374ab9363d73bf4e8a11d2 100644 (file)
@@ -956,7 +956,7 @@ mkfile_output (struct commandline *cmd)
       mkfilename = alloc (strlen ("Makefile.") + strlen (cmd->infile) + 1);
       if (mkfilename == NULL)
        abort ();
-      temp = rindex (cmd->infile, '.');
+      temp = strrchr (cmd->infile, '.');
       cp = stpcpy (mkfilename, "Makefile.");
       if (temp != NULL)
        *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';