diff options
author | ed <ed@FreeBSD.org> | 2012-01-03 18:51:58 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2012-01-03 18:51:58 +0000 |
commit | e7e5b53bf16ab3b35646f0580b36fa7d7afa9678 (patch) | |
tree | b751618c7a82d9c00cab91ea9f611585dbf14d84 /sys/boot | |
parent | d106f2fd7cf6be7617b1756d893b5b6fba5310f4 (diff) | |
download | FreeBSD-src-e7e5b53bf16ab3b35646f0580b36fa7d7afa9678.zip FreeBSD-src-e7e5b53bf16ab3b35646f0580b36fa7d7afa9678.tar.gz |
Replace index() and rindex() calls with strchr() and strrchr().
The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.
This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/common/interp_parse.c | 2 | ||||
-rw-r--r-- | sys/boot/ofw/common/main.c | 2 | ||||
-rw-r--r-- | sys/boot/ofw/libofw/ofw_net.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/sys/boot/common/interp_parse.c b/sys/boot/common/interp_parse.c index 32b01c8..32d4f48 100644 --- a/sys/boot/common/interp_parse.c +++ b/sys/boot/common/interp_parse.c @@ -137,7 +137,7 @@ parse(int *argc, char ***argv, char *str) case VAR: if (token) { - PARSE_FAIL((q = index(p, token)) == NULL); + PARSE_FAIL((q = strchr(p, token)) == NULL); } else { q = p; while (*q && !isspace(*q)) diff --git a/sys/boot/ofw/common/main.c b/sys/boot/ofw/common/main.c index 52e69199..940ca63 100644 --- a/sys/boot/ofw/common/main.c +++ b/sys/boot/ofw/common/main.c @@ -133,7 +133,7 @@ main(int (*openfirm)(void *)) printf("Memory: %lldKB\n", memsize() / 1024); OF_getprop(chosen, "bootpath", bootpath, 64); - ch = index(bootpath, ':'); + ch = strchr(bootpath, ':'); *ch = '\0'; printf("Booted from: %s\n", bootpath); diff --git a/sys/boot/ofw/libofw/ofw_net.c b/sys/boot/ofw/libofw/ofw_net.c index 36600ef..691deda 100644 --- a/sys/boot/ofw/libofw/ofw_net.c +++ b/sys/boot/ofw/libofw/ofw_net.c @@ -185,7 +185,7 @@ ofwn_init(struct iodesc *desc, void *machdep_hint) int pathlen; pathlen = OF_getprop(chosen, "bootpath", path, 64); - if ((ch = index(path, ':')) != NULL) + if ((ch = strchr(path, ':')) != NULL) *ch = '\0'; netdev = OF_finddevice(path); #ifdef __sparc64__ |