summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-01-18 10:27:42 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2015-01-25 19:51:29 -0800
commitf3e5903536f80cb42ee6841f85e013284eb4c2fc (patch)
tree6c20182826991c3fc8e7d4be1f4b50e7d158f527
parentaed2c4d3493cf3a06ad1240f317552fd8bfd687a (diff)
downloadxorg-lib-libXt-f3e5903536f80cb42ee6841f85e013284eb4c2fc.tar.gz
makestrs: use strchr() instead of index()
Besides being supported by more standards, strchr() has the important characteristic of having a prototype included in <string.h> on Solaris so that 64-bit compiles know it returns a pointer, not an integer. (On Solaris, index() is only found in <strings.h>, for SunOS compatibility.) Without this fix, makestrs segfaulted in 64-bit builds on Solaris after commit f9baaf55ff8cbd4bf018a34f181eda30d03b20dc switched to <string.h>. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--util/makestrs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/util/makestrs.c b/util/makestrs.c
index ce0a0a3..2c4dcc8 100644
--- a/util/makestrs.c
+++ b/util/makestrs.c
@@ -583,7 +583,7 @@ static void DoLine(char *buf)
int rlen;
int len;
- if ((right = index(buf, ' ')))
+ if ((right = strchr(buf, ' ')))
*right++ = 0;
else
right = buf + 1;
@@ -666,8 +666,8 @@ static char* DoComment (char *line)
int len;
/* assume that the first line with two '$' in it is the RCS tag line */
- if ((tag = index (line, '$')) == NULL) return NULL;
- if ((eol = index (tag + 1, '$')) == NULL) return NULL;
+ if ((tag = strchr (line, '$')) == NULL) return NULL;
+ if ((eol = strchr (tag + 1, '$')) == NULL) return NULL;
len = eol - tag;
if ((ret = malloc (len)) == NULL)
exit (1);