aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2010-07-11 12:31:10 +0200
committerAndreas Schwab2010-07-11 12:31:10 +0200
commit8966b7575b1adf62101df4f2ba8ce7f59f893397 (patch)
treeedf79c21229574aa60525071acbfbd50aac9ff4b /src
parentcf237e277f6b033fd8d47ecdc466722c73de5d96 (diff)
downloademacs-8966b7575b1adf62101df4f2ba8ce7f59f893397.tar.gz
emacs-8966b7575b1adf62101df4f2ba8ce7f59f893397.zip
Use strchr, strrchr instead of index, rindex
* callint.c (Fcall_interactively): Use strchr, strrchr instead of index, rindex. * doc.c (get_doc_string, Fsnarf_documentation): Likewise. * editfns.c (Fuser_full_name, Fformat): Likewise. * emacs.c (argmatch, sort_args, decode_env_path): Likewise. * fileio.c (Ffile_symlink_p): Likewise. * filelock.c (current_lock_owner): Likewise. * font.c (font_parse_name, font_parse_family_registry): Likewise. * fontset.c (fontset_pattern_regexp): Likewise. * lread.c (read1): Likewise. * sysdep.c (init_system_name): Likewise. * xfns.c (select_visual): Likewise. * s/hpux10-20.h (index, rindex): Don't define. * s/ms-w32.h (index): Likewise. * s/usg5-4.h: Likewise. * sed2v2.inp (HAVE_INDEX, HAVE_RINDEX): Don't edit. (HAVE_STRCHR, HAVE_STRRCHR): Edit to 1. * emacsclient.c (set_local_socket): Use strchr, strrchr instead of index, rindex. * movemail.c (mail_spool_name, popmail): Likewise. * pop.c (pop_list): Likewise. * CPP-DEFINES (HAVE_INDEX, HAVE_RINDEX): Remove. * configure.in: Don't check for index and rindex, check for strchr and strrchr. Define strchr and strrchr as index and rindex, resp., in src/config.h if not available.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog16
-rw-r--r--src/callint.c12
-rw-r--r--src/config.in20
-rw-r--r--src/doc.c10
-rw-r--r--src/editfns.c10
-rw-r--r--src/emacs.c10
-rw-r--r--src/fileio.c4
-rw-r--r--src/filelock.c7
-rw-r--r--src/font.c6
-rw-r--r--src/fontset.c4
-rw-r--r--src/lread.c8
-rw-r--r--src/s/hpux10-20.h4
-rw-r--r--src/s/ms-w32.h2
-rw-r--r--src/s/usg5-4.h8
-rw-r--r--src/sysdep.c8
-rw-r--r--src/xfns.c2
16 files changed, 61 insertions, 70 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6907c5add4c..451dac369c9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,21 @@
12010-07-11 Andreas Schwab <schwab@linux-m68k.org> 12010-07-11 Andreas Schwab <schwab@linux-m68k.org>
2 2
3 * callint.c (Fcall_interactively): Use strchr, strrchr instead of
4 index, rindex.
5 * doc.c (get_doc_string, Fsnarf_documentation): Likewise.
6 * editfns.c (Fuser_full_name, Fformat): Likewise.
7 * emacs.c (argmatch, sort_args, decode_env_path): Likewise.
8 * fileio.c (Ffile_symlink_p): Likewise.
9 * filelock.c (current_lock_owner): Likewise.
10 * font.c (font_parse_name, font_parse_family_registry): Likewise.
11 * fontset.c (fontset_pattern_regexp): Likewise.
12 * lread.c (read1): Likewise.
13 * sysdep.c (init_system_name): Likewise.
14 * xfns.c (select_visual): Likewise.
15 * s/hpux10-20.h (index, rindex): Don't define.
16 * s/ms-w32.h (index): Likewise.
17 * s/usg5-4.h: Likewise.
18
3 * callproc.c (relocate_fd): Use F_DUPFD if defined. 19 * callproc.c (relocate_fd): Use F_DUPFD if defined.
4 20
5 * alloc.c (pending_malloc_warning, malloc_warning): Add const. 21 * alloc.c (pending_malloc_warning, malloc_warning): Add const.
diff --git a/src/callint.c b/src/callint.c
index 3d4782e7bd6..fa0be112bea 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -29,10 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include "window.h" 29#include "window.h"
30#include "keymap.h" 30#include "keymap.h"
31 31
32#ifdef HAVE_INDEX
33extern char *index (const char *, int);
34#endif
35
36extern Lisp_Object Qcursor_in_echo_area; 32extern Lisp_Object Qcursor_in_echo_area;
37extern Lisp_Object Qfile_directory_p; 33extern Lisp_Object Qfile_directory_p;
38extern Lisp_Object Qonly; 34extern Lisp_Object Qonly;
@@ -469,7 +465,7 @@ invoke it. If KEYS is omitted or nil, the return value of
469 j += 2; 465 j += 2;
470 else 466 else
471 j++; 467 j++;
472 tem = (unsigned char *) index (tem, '\n'); 468 tem = (unsigned char *) strchr (tem, '\n');
473 if (tem) 469 if (tem)
474 ++tem; 470 ++tem;
475 else 471 else
@@ -500,11 +496,11 @@ invoke it. If KEYS is omitted or nil, the return value of
500 { 496 {
501 strncpy (prompt1, tem + 1, sizeof prompt1 - 1); 497 strncpy (prompt1, tem + 1, sizeof prompt1 - 1);
502 prompt1[sizeof prompt1 - 1] = 0; 498 prompt1[sizeof prompt1 - 1] = 0;
503 tem1 = (char *) index (prompt1, '\n'); 499 tem1 = strchr (prompt1, '\n');
504 if (tem1) *tem1 = 0; 500 if (tem1) *tem1 = 0;
505 501
506 visargs[0] = build_string (prompt1); 502 visargs[0] = build_string (prompt1);
507 if (index (prompt1, '%')) 503 if (strchr (prompt1, '%'))
508 callint_message = Fformat (i, visargs); 504 callint_message = Fformat (i, visargs);
509 else 505 else
510 callint_message = visargs[0]; 506 callint_message = visargs[0];
@@ -809,7 +805,7 @@ invoke it. If KEYS is omitted or nil, the return value of
809 if (NILP (visargs[i]) && STRINGP (args[i])) 805 if (NILP (visargs[i]) && STRINGP (args[i]))
810 visargs[i] = args[i]; 806 visargs[i] = args[i];
811 807
812 tem = (unsigned char *) index (tem, '\n'); 808 tem = (unsigned char *) strchr (tem, '\n');
813 if (tem) tem++; 809 if (tem) tem++;
814 else tem = (unsigned char *) ""; 810 else tem = (unsigned char *) "";
815 } 811 }
diff --git a/src/config.in b/src/config.in
index 1ef407c158b..40b62633446 100644
--- a/src/config.in
+++ b/src/config.in
@@ -288,9 +288,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
288/* Define to 1 if netdb.h declares h_errno. */ 288/* Define to 1 if netdb.h declares h_errno. */
289#undef HAVE_H_ERRNO 289#undef HAVE_H_ERRNO
290 290
291/* Define to 1 if you have the `index' function. */
292#undef HAVE_INDEX
293
294/* Define to 1 if you have inet sockets. */ 291/* Define to 1 if you have inet sockets. */
295#undef HAVE_INET_SOCKETS 292#undef HAVE_INET_SOCKETS
296 293
@@ -537,9 +534,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
537/* Define to 1 if res_init is available. */ 534/* Define to 1 if res_init is available. */
538#undef HAVE_RES_INIT 535#undef HAVE_RES_INIT
539 536
540/* Define to 1 if you have the `rindex' function. */
541#undef HAVE_RINDEX
542
543/* Define to 1 if you have the `rint' function. */ 537/* Define to 1 if you have the `rint' function. */
544#undef HAVE_RINT 538#undef HAVE_RINT
545 539
@@ -597,6 +591,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
597/* Define to 1 if you have the <stdlib.h> header file. */ 591/* Define to 1 if you have the <stdlib.h> header file. */
598#undef HAVE_STDLIB_H 592#undef HAVE_STDLIB_H
599 593
594/* Define to 1 if you have the `strchr' function. */
595#undef HAVE_STRCHR
596
600/* Define to 1 if you have the `strerror' function. */ 597/* Define to 1 if you have the `strerror' function. */
601#undef HAVE_STRERROR 598#undef HAVE_STRERROR
602 599
@@ -609,6 +606,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
609/* Define to 1 if you have the <string.h> header file. */ 606/* Define to 1 if you have the <string.h> header file. */
610#undef HAVE_STRING_H 607#undef HAVE_STRING_H
611 608
609/* Define to 1 if you have the `strrchr' function. */
610#undef HAVE_STRRCHR
611
612/* Define to 1 if you have the `strsignal' function. */ 612/* Define to 1 if you have the `strsignal' function. */
613#undef HAVE_STRSIGNAL 613#undef HAVE_STRSIGNAL
614 614
@@ -1154,6 +1154,14 @@ void *alloca (size_t);
1154typedef unsigned size_t; 1154typedef unsigned size_t;
1155#endif 1155#endif
1156 1156
1157#ifndef HAVE_STRCHR
1158#define strchr(a, b) index (a, b)
1159#endif
1160
1161#ifndef HAVE_STRRCHR
1162#define strrchr(a, b) rindex (a, b)
1163#endif
1164
1157#if defined __GNUC__ && (__GNUC__ > 2 \ 1165#if defined __GNUC__ && (__GNUC__ > 2 \
1158 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) 1166 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
1159#define NO_RETURN __attribute__ ((__noreturn__)) 1167#define NO_RETURN __attribute__ ((__noreturn__))
diff --git a/src/doc.c b/src/doc.c
index a8f6217c4ce..fc3cbc1c215 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -45,10 +45,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#include "keymap.h" 45#include "keymap.h"
46#include "buildobj.h" 46#include "buildobj.h"
47 47
48#ifdef HAVE_INDEX
49extern char *index (const char *, int);
50#endif
51
52Lisp_Object Vdoc_file_name; 48Lisp_Object Vdoc_file_name;
53 49
54Lisp_Object Qfunction_documentation; 50Lisp_Object Qfunction_documentation;
@@ -218,9 +214,9 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
218 if (!nread) 214 if (!nread)
219 break; 215 break;
220 if (p == get_doc_string_buffer) 216 if (p == get_doc_string_buffer)
221 p1 = (char *) index (p + offset, '\037'); 217 p1 = strchr (p + offset, '\037');
222 else 218 else
223 p1 = (char *) index (p, '\037'); 219 p1 = strchr (p, '\037');
224 if (p1) 220 if (p1)
225 { 221 {
226 *p1 = 0; 222 *p1 = 0;
@@ -633,7 +629,7 @@ the same file name is found in the `doc-directory'. */)
633 /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */ 629 /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */
634 if (p != end) 630 if (p != end)
635 { 631 {
636 end = (char *) index (p, '\n'); 632 end = strchr (p, '\n');
637 633
638 /* See if this is a file name, and if it is a file in build-files. */ 634 /* See if this is a file name, and if it is a file in build-files. */
639 if (p[1] == 'S' && end - p > 4 && end[-2] == '.' 635 if (p[1] == 'S' && end - p > 4 && end[-2] == '.'
diff --git a/src/editfns.c b/src/editfns.c
index 93ae5647b04..2d8fcb6c85b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -109,10 +109,6 @@ static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
109static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object); 109static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
110static void transpose_markers (int, int, int, int, int, int, int, int); 110static void transpose_markers (int, int, int, int, int, int, int, int);
111 111
112#ifdef HAVE_INDEX
113extern char *index (const char *, int);
114#endif
115
116Lisp_Object Vbuffer_access_fontify_functions; 112Lisp_Object Vbuffer_access_fontify_functions;
117Lisp_Object Qbuffer_access_fontify_functions; 113Lisp_Object Qbuffer_access_fontify_functions;
118Lisp_Object Vbuffer_access_fontified_property; 114Lisp_Object Vbuffer_access_fontified_property;
@@ -1369,12 +1365,12 @@ name, or nil if there is no such user. */)
1369 1365
1370 p = (unsigned char *) USER_FULL_NAME; 1366 p = (unsigned char *) USER_FULL_NAME;
1371 /* Chop off everything after the first comma. */ 1367 /* Chop off everything after the first comma. */
1372 q = (unsigned char *) index (p, ','); 1368 q = (unsigned char *) strchr (p, ',');
1373 full = make_string (p, q ? q - p : strlen (p)); 1369 full = make_string (p, q ? q - p : strlen (p));
1374 1370
1375#ifdef AMPERSAND_FULL_NAME 1371#ifdef AMPERSAND_FULL_NAME
1376 p = SDATA (full); 1372 p = SDATA (full);
1377 q = (unsigned char *) index (p, '&'); 1373 q = (unsigned char *) strchr (p, '&');
1378 /* Substitute the login name for the &, upcasing the first character. */ 1374 /* Substitute the login name for the &, upcasing the first character. */
1379 if (q) 1375 if (q)
1380 { 1376 {
@@ -3813,7 +3809,7 @@ usage: (format STRING &rest OBJECTS) */)
3813 discarded[format - format_start] = 1; 3809 discarded[format - format_start] = 1;
3814 format++; 3810 format++;
3815 3811
3816 while (index ("-+0# ", *format)) 3812 while (strchr ("-+0# ", *format))
3817 { 3813 {
3818 if (*format == '-') 3814 if (*format == '-')
3819 { 3815 {
diff --git a/src/emacs.c b/src/emacs.c
index 180b2276f4c..e00c49b8d24 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -90,10 +90,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
90const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; 90const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
91const char emacs_version[] = "24.0.50"; 91const char emacs_version[] = "24.0.50";
92 92
93#ifdef HAVE_INDEX
94extern char *index (const char *, int);
95#endif
96
97/* Make these values available in GDB, which doesn't see macros. */ 93/* Make these values available in GDB, which doesn't see macros. */
98 94
99#ifdef USE_LSB_TAG 95#ifdef USE_LSB_TAG
@@ -662,7 +658,7 @@ argmatch (char **argv, int argc, char *sstr, char *lstr, int minlen, char **valp
662 *skipptr += 1; 658 *skipptr += 1;
663 return 1; 659 return 1;
664 } 660 }
665 arglen = (valptr != NULL && (p = index (arg, '=')) != NULL 661 arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL
666 ? p - arg : strlen (arg)); 662 ? p - arg : strlen (arg));
667 if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0) 663 if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0)
668 return 0; 664 return 0;
@@ -1974,7 +1970,7 @@ sort_args (int argc, char **argv)
1974 { 1970 {
1975 match = -1; 1971 match = -1;
1976 thislen = strlen (argv[from]); 1972 thislen = strlen (argv[from]);
1977 equals = index (argv[from], '='); 1973 equals = strchr (argv[from], '=');
1978 if (equals != 0) 1974 if (equals != 0)
1979 thislen = equals - argv[from]; 1975 thislen = equals - argv[from];
1980 1976
@@ -2369,7 +2365,7 @@ decode_env_path (const char *evarname, const char *defalt)
2369 lpath = Qnil; 2365 lpath = Qnil;
2370 while (1) 2366 while (1)
2371 { 2367 {
2372 p = index (path, SEPCHAR); 2368 p = strchr (path, SEPCHAR);
2373 if (!p) 2369 if (!p)
2374 p = path + strlen (path); 2370 p = path + strlen (path);
2375 element = (p - path ? make_string (path, p - path) 2371 element = (p - path ? make_string (path, p - path)
diff --git a/src/fileio.c b/src/fileio.c
index 7c0921a0e39..c942803e280 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1455,7 +1455,7 @@ See also the function `substitute-in-file-name'.")
1455 /* Get past ~ to user */ 1455 /* Get past ~ to user */
1456 unsigned char *user = nm + 1; 1456 unsigned char *user = nm + 1;
1457 /* Find end of name. */ 1457 /* Find end of name. */
1458 unsigned char *ptr = (unsigned char *) index (user, '/'); 1458 unsigned char *ptr = (unsigned char *) strchr (user, '/');
1459 int len = ptr ? ptr - user : strlen (user); 1459 int len = ptr ? ptr - user : strlen (user);
1460 /* Copy the user name into temp storage. */ 1460 /* Copy the user name into temp storage. */
1461 o = (unsigned char *) alloca (len + 1); 1461 o = (unsigned char *) alloca (len + 1);
@@ -2729,7 +2729,7 @@ points to a nonexistent file. */)
2729 while (valsize >= bufsize); 2729 while (valsize >= bufsize);
2730 2730
2731 val = make_string (buf, valsize); 2731 val = make_string (buf, valsize);
2732 if (buf[0] == '/' && index (buf, ':')) 2732 if (buf[0] == '/' && strchr (buf, ':'))
2733 val = concat2 (build_string ("/:"), val); 2733 val = concat2 (build_string ("/:"), val);
2734 xfree (buf); 2734 xfree (buf);
2735 val = DECODE_FILE (val); 2735 val = DECODE_FILE (val);
diff --git a/src/filelock.c b/src/filelock.c
index 8eb6060e531..c3f1bfde292 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -413,9 +413,6 @@ within_one_second (time_t a, time_t b)
413static int 413static int
414current_lock_owner (lock_info_type *owner, char *lfname) 414current_lock_owner (lock_info_type *owner, char *lfname)
415{ 415{
416#ifndef index
417 extern char *rindex (const char *, int), *index (const char *, int);
418#endif
419 int len, ret; 416 int len, ret;
420 int local_owner = 0; 417 int local_owner = 0;
421 char *at, *dot, *colon; 418 char *at, *dot, *colon;
@@ -457,8 +454,8 @@ current_lock_owner (lock_info_type *owner, char *lfname)
457 454
458 /* Parse USER@HOST.PID:BOOT_TIME. If can't parse, return -1. */ 455 /* Parse USER@HOST.PID:BOOT_TIME. If can't parse, return -1. */
459 /* The USER is everything before the last @. */ 456 /* The USER is everything before the last @. */
460 at = rindex (lfinfo, '@'); 457 at = strrchr (lfinfo, '@');
461 dot = rindex (lfinfo, '.'); 458 dot = strrchr (lfinfo, '.');
462 if (!at || !dot) 459 if (!at || !dot)
463 { 460 {
464 xfree (lfinfo); 461 xfree (lfinfo);
diff --git a/src/font.c b/src/font.c
index 42a61a5eccd..cb92074df91 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1815,7 +1815,7 @@ font_unparse_gtkname (Lisp_Object font, struct frame *f, char *name, int nbytes)
1815static int 1815static int
1816font_parse_name (char *name, Lisp_Object font) 1816font_parse_name (char *name, Lisp_Object font)
1817{ 1817{
1818 if (name[0] == '-' || index (name, '*') || index (name, '?')) 1818 if (name[0] == '-' || strchr (name, '*') || strchr (name, '?'))
1819 return font_parse_xlfd (name, font); 1819 return font_parse_xlfd (name, font);
1820 return font_parse_fcname (name, font); 1820 return font_parse_fcname (name, font);
1821} 1821}
@@ -1837,7 +1837,7 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec
1837 CHECK_STRING (family); 1837 CHECK_STRING (family);
1838 len = SBYTES (family); 1838 len = SBYTES (family);
1839 p0 = (char *) SDATA (family); 1839 p0 = (char *) SDATA (family);
1840 p1 = index (p0, '-'); 1840 p1 = strchr (p0, '-');
1841 if (p1) 1841 if (p1)
1842 { 1842 {
1843 if ((*p0 != '*' && p1 - p0 > 0) 1843 if ((*p0 != '*' && p1 - p0 > 0)
@@ -1856,7 +1856,7 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec
1856 CHECK_STRING (registry); 1856 CHECK_STRING (registry);
1857 len = SBYTES (registry); 1857 len = SBYTES (registry);
1858 p0 = (char *) SDATA (registry); 1858 p0 = (char *) SDATA (registry);
1859 p1 = index (p0, '-'); 1859 p1 = strchr (p0, '-');
1860 if (! p1) 1860 if (! p1)
1861 { 1861 {
1862 if (SDATA (registry)[len - 1] == '*') 1862 if (SDATA (registry)[len - 1] == '*')
diff --git a/src/fontset.c b/src/fontset.c
index 676e96fd88c..9a27fc3e36b 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1065,8 +1065,8 @@ static Lisp_Object Vcached_fontset_data;
1065static Lisp_Object 1065static Lisp_Object
1066fontset_pattern_regexp (Lisp_Object pattern) 1066fontset_pattern_regexp (Lisp_Object pattern)
1067{ 1067{
1068 if (!index ((char *) SDATA (pattern), '*') 1068 if (!strchr ((char *) SDATA (pattern), '*')
1069 && !index ((char *) SDATA (pattern), '?')) 1069 && !strchr ((char *) SDATA (pattern), '?'))
1070 /* PATTERN does not contain any wild cards. */ 1070 /* PATTERN does not contain any wild cards. */
1071 return Qnil; 1071 return Qnil;
1072 1072
diff --git a/src/lread.c b/src/lread.c
index b9e47e3fccf..79214936f4c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2725,7 +2725,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2725 2725
2726 ok = (next_next_char <= 040 2726 ok = (next_next_char <= 040
2727 || (next_next_char < 0200 2727 || (next_next_char < 0200
2728 && (index ("\"';([#?", next_next_char) 2728 && (strchr ("\"';([#?", next_next_char)
2729 || (!first_in_list && next_next_char == '`') 2729 || (!first_in_list && next_next_char == '`')
2730 || (new_backquote_flag && next_next_char == ',')))); 2730 || (new_backquote_flag && next_next_char == ','))));
2731 } 2731 }
@@ -2733,7 +2733,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2733 { 2733 {
2734 ok = (next_char <= 040 2734 ok = (next_char <= 040
2735 || (next_char < 0200 2735 || (next_char < 0200
2736 && (index ("\"';()[]#?", next_char) 2736 && (strchr ("\"';()[]#?", next_char)
2737 || (!first_in_list && next_char == '`') 2737 || (!first_in_list && next_char == '`')
2738 || (new_backquote_flag && next_char == ',')))); 2738 || (new_backquote_flag && next_char == ','))));
2739 } 2739 }
@@ -2878,7 +2878,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2878 2878
2879 if (next_char <= 040 2879 if (next_char <= 040
2880 || (next_char < 0200 2880 || (next_char < 0200
2881 && (index ("\"';([#?", next_char) 2881 && (strchr ("\"';([#?", next_char)
2882 || (!first_in_list && next_char == '`') 2882 || (!first_in_list && next_char == '`')
2883 || (new_backquote_flag && next_char == ',')))) 2883 || (new_backquote_flag && next_char == ','))))
2884 { 2884 {
@@ -2905,7 +2905,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2905 while (c > 040 2905 while (c > 040
2906 && c != 0x8a0 /* NBSP */ 2906 && c != 0x8a0 /* NBSP */
2907 && (c >= 0200 2907 && (c >= 0200
2908 || (!index ("\"';()[]#", c) 2908 || (!strchr ("\"';()[]#", c)
2909 && !(!first_in_list && c == '`') 2909 && !(!first_in_list && c == '`')
2910 && !(new_backquote_flag && c == ',')))) 2910 && !(new_backquote_flag && c == ','))))
2911 { 2911 {
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index dd0e1bea9ad..ee841041edb 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -146,9 +146,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
146/* No underscore please. */ 146/* No underscore please. */
147#define LDAV_SYMBOL "avenrun" 147#define LDAV_SYMBOL "avenrun"
148 148
149/* On USG systems these have different names. */
150#define index strchr
151#define rindex strrchr
152
153/* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6 149/* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6
154 (do not change this comment) */ 150 (do not change this comment) */
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index df9929f6823..a87e22b338c 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -274,8 +274,6 @@ typedef int pid_t;
274#define pclose _pclose 274#define pclose _pclose
275#define umask _umask 275#define umask _umask
276#define utimbuf _utimbuf 276#define utimbuf _utimbuf
277#define index strchr
278#define rindex strrchr
279#define strdup _strdup 277#define strdup _strdup
280#define strupr _strupr 278#define strupr _strupr
281#define strnicmp _strnicmp 279#define strnicmp _strnicmp
diff --git a/src/s/usg5-4.h b/src/s/usg5-4.h
index e667ffdc106..b92a5bbb450 100644
--- a/src/s/usg5-4.h
+++ b/src/s/usg5-4.h
@@ -50,14 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#define _setjmp setjmp 50#define _setjmp setjmp
51#define _longjmp longjmp 51#define _longjmp longjmp
52 52
53/* On USG systems these have different names. */
54#ifndef HAVE_INDEX
55#define index strchr
56#endif /* ! defined (HAVE_INDEX) */
57#ifndef HAVE_RINDEX
58#define rindex strrchr
59#endif /* ! defined (HAVE_RINDEX) */
60
61/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */ 53/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */
62#define HAVE_SYSV_SIGPAUSE 54#define HAVE_SYSV_SIGPAUSE
63 55
diff --git a/src/sysdep.c b/src/sysdep.c
index daca9d12510..e45664a8bd6 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1555,7 +1555,7 @@ init_system_name (void)
1555#ifndef CANNOT_DUMP 1555#ifndef CANNOT_DUMP
1556 if (initialized) 1556 if (initialized)
1557#endif /* not CANNOT_DUMP */ 1557#endif /* not CANNOT_DUMP */
1558 if (! index (hostname, '.')) 1558 if (! strchr (hostname, '.'))
1559 { 1559 {
1560 int count; 1560 int count;
1561#ifdef HAVE_GETADDRINFO 1561#ifdef HAVE_GETADDRINFO
@@ -1584,7 +1584,7 @@ init_system_name (void)
1584 while (it) 1584 while (it)
1585 { 1585 {
1586 char *fqdn = it->ai_canonname; 1586 char *fqdn = it->ai_canonname;
1587 if (fqdn && index (fqdn, '.') 1587 if (fqdn && strchr (fqdn, '.')
1588 && strcmp (fqdn, "localhost.localdomain") != 0) 1588 && strcmp (fqdn, "localhost.localdomain") != 0)
1589 break; 1589 break;
1590 it = it->ai_next; 1590 it = it->ai_next;
@@ -1620,13 +1620,13 @@ init_system_name (void)
1620 { 1620 {
1621 char *fqdn = (char *) hp->h_name; 1621 char *fqdn = (char *) hp->h_name;
1622 1622
1623 if (!index (fqdn, '.')) 1623 if (!strchr (fqdn, '.'))
1624 { 1624 {
1625 /* We still don't have a fully qualified domain name. 1625 /* We still don't have a fully qualified domain name.
1626 Try to find one in the list of alternate names */ 1626 Try to find one in the list of alternate names */
1627 char **alias = hp->h_aliases; 1627 char **alias = hp->h_aliases;
1628 while (*alias 1628 while (*alias
1629 && (!index (*alias, '.') 1629 && (!strchr (*alias, '.')
1630 || !strcmp (*alias, "localhost.localdomain"))) 1630 || !strcmp (*alias, "localhost.localdomain")))
1631 alias++; 1631 alias++;
1632 if (*alias) 1632 if (*alias)
diff --git a/src/xfns.c b/src/xfns.c
index 988725ead00..5a96598eaee 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4005,7 +4005,7 @@ select_visual (struct x_display_info *dpyinfo)
4005 XVisualInfo vinfo; 4005 XVisualInfo vinfo;
4006 4006
4007 strcpy (s, SDATA (value)); 4007 strcpy (s, SDATA (value));
4008 dash = index (s, '-'); 4008 dash = strchr (s, '-');
4009 if (dash) 4009 if (dash)
4010 { 4010 {
4011 dpyinfo->n_planes = atoi (dash + 1); 4011 dpyinfo->n_planes = atoi (dash + 1);