diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-08-06 12:59:04 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-08-06 12:59:04 -0700 |
commit | 6e003fd5f174a8e312d799d7f8812c2a5b87e433 (patch) | |
tree | fe1162855d4269bf70e4b8f7b6e79f5610b53586 | |
parent | 43dfc6be8128139888426d8c709aa78efc207953 (diff) |
Replace index/rindex with C89 standard strchr/strrchr
-rw-r--r-- | src/WrFFrI.c | 12 | ||||
-rw-r--r-- | src/data.c | 2 | ||||
-rw-r--r-- | src/parse.c | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/WrFFrI.c b/src/WrFFrI.c index 363f6c4..6477188 100644 --- a/src/WrFFrI.c +++ b/src/WrFFrI.c @@ -117,9 +117,9 @@ XpmWriteFileFromXpmImage(filename, image, info) #ifdef VMS name = filename; #else - if (!(name = rindex(filename, '/')) + if (!(name = strrchr(filename, '/')) #ifdef AMIGA - && !(name = rindex(filename, ':')) + && !(name = strrchr(filename, ':')) #endif ) name = filename; @@ -127,24 +127,24 @@ XpmWriteFileFromXpmImage(filename, image, info) name++; #endif /* let's try to make a valid C syntax name */ - if (index(name, '.')) { + if (strchr(name, '.')) { strncpy(new_name, name, sizeof(new_name)); new_name[sizeof(new_name)-1] = '\0'; /* change '.' to '_' */ name = s = new_name; - while ((dot = index(s, '.'))) { + while ((dot = strchr(s, '.'))) { *dot = '_'; s = dot; } } - if (index(name, '-')) { + if (strchr(name, '-')) { if (name != new_name) { strcpy(new_name, name); name = new_name; } /* change '-' to '_' */ s = name; - while ((dot = index(s, '-'))) { + while ((dot = strchr(s, '-'))) { *dot = '_'; s = dot; } @@ -422,7 +422,7 @@ xpmParseHeader(data) if (!l) return (XpmFileInvalid); buf[l] = '\0'; - ptr = rindex(buf, '_'); + ptr = strrchr(buf, '_'); if (!ptr || strncmp("_format", ptr, l - (ptr - buf))) return XpmFileInvalid; /* this is definitely an XPM 1 file */ diff --git a/src/parse.c b/src/parse.c index c5ec1a1..bd5b52c 100644 --- a/src/parse.c +++ b/src/parse.c @@ -138,7 +138,7 @@ xpmParseValues(data, width, height, ncolors, cpp, ptr = buf; got_one = False; while (!got_one) { - ptr = index(ptr, '_'); + ptr = strchr(ptr, '_'); if (!ptr) return (XpmFileInvalid); switch (l - (ptr - buf)) { |