diff options
author | peter <peter@FreeBSD.org> | 2000-06-26 09:53:37 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-06-26 09:53:37 +0000 |
commit | dff6e0da4684f04b150b76f97b09b88a607be6f5 (patch) | |
tree | ac86b3f696753ac3037b32c10ab6d4008dd36115 /sys/kern/subr_bus.c | |
parent | 07b15689bbec3d7f5024404fd5b6f0ec09cb0a2c (diff) | |
download | FreeBSD-src-dff6e0da4684f04b150b76f97b09b88a607be6f5.zip FreeBSD-src-dff6e0da4684f04b150b76f97b09b88a607be6f5.tar.gz |
Some changes and fixes from Bruce:
Use strtoul(), not strtol() in the hints decoder so that
'flags 0xa0ffa0ff' is not truncated to 0x7fffffff.
Use a stack buffer instead of a static 100 byte bss buffer.
Use \0 for the NUL character.
Remove some ``excessive'' parens.
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r-- | sys/kern/subr_bus.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 7690444..e6c6bcf 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1285,7 +1285,7 @@ static int resource_find_hard(const char *cp, const char *name, int unit, const char *resname, struct config_resource **result) { - static char match[100]; + char match[256]; int matchlen; char *op; long val; @@ -1307,7 +1307,7 @@ resource_find_hard(const char *cp, const char *name, int unit, cp += matchlen; /* skip over name and '=' */ else return ENOENT; - val = strtol(cp, &op, 0); + val = strtoul(cp, &op, 0); if (*cp != '\0' && *op == '\0') { (*result)->type = RES_INT; (*result)->u.intval = val; @@ -1562,7 +1562,7 @@ hint_load(char *cp) int unit; char resname[255]; - for (ep = cp; (*ep != '=') && (*ep != 0); ep++) + for (ep = cp; *ep != '=' && *ep != '\0'; ep++) ; len = ep - cp; if (*ep == '=') @@ -1586,7 +1586,7 @@ hint_load(char *cp) walker++; if (*walker != '.') return; - unit = strtol(op, &walker, 0); + unit = strtoul(op, &walker, 0); if (*walker != '.') return; walker++; @@ -1604,7 +1604,7 @@ hint_load(char *cp) return; if (bootverbose) printf("Setting %s %d %s to ", name, unit, resname); - val = strtol(ep, &op, 0); + val = strtoul(ep, &op, 0); if (*ep != '\0' && *op == '\0') { resource_set_int(name, unit, resname, val); if (bootverbose) @@ -1625,19 +1625,19 @@ hints_load(void *dummy __unused) cp = static_hints; while (cp) { hint_load(cp); - while (*cp != 0) + while (*cp != '\0') cp++; cp++; - if (*cp == 0) + if (*cp == '\0') break; } cp = kern_envp; while (cp) { hint_load(cp); - while (*cp != 0) + while (*cp != '\0') cp++; cp++; - if (*cp == 0) + if (*cp == '\0') break; } hints_loaded++; |