Change the prototype of the strto* routines to make the second
parameter a char ** instead of a const char **. This make these kernel routines consistent with the corresponding libc userland routines. Which is actually 'correct' is debatable, but consistency and following the spec was deemed more important in this case. Reviewed by (in concept): phk, bde
This commit is contained in:
parent
a86ab8174f
commit
25792ef324
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53648
@ -1590,7 +1590,7 @@ getmemsize(int first)
|
||||
*/
|
||||
if ((cp = getenv("hw.physmem")) != NULL) {
|
||||
u_int64_t AllowMem, sanity;
|
||||
const char *ep;
|
||||
char *ep;
|
||||
|
||||
sanity = AllowMem = strtouq(cp, &ep, 0);
|
||||
if ((ep != cp) && (*ep != 0)) {
|
||||
|
@ -1590,7 +1590,7 @@ getmemsize(int first)
|
||||
*/
|
||||
if ((cp = getenv("hw.physmem")) != NULL) {
|
||||
u_int64_t AllowMem, sanity;
|
||||
const char *ep;
|
||||
char *ep;
|
||||
|
||||
sanity = AllowMem = strtouq(cp, &ep, 0);
|
||||
if ((ep != cp) && (*ep != 0)) {
|
||||
|
@ -2764,7 +2764,7 @@ static int
|
||||
parse_args(const char *cmd, CmdParm *parms)
|
||||
{
|
||||
while (1) {
|
||||
const char *ptr;
|
||||
char *ptr;
|
||||
|
||||
if (*cmd == ' ' || *cmd == '\t') {
|
||||
++cmd;
|
||||
@ -2960,7 +2960,7 @@ set_pnp_parms(CmdParm *parms)
|
||||
{
|
||||
u_long idx, val, ldn, csn;
|
||||
int i;
|
||||
const char *q;
|
||||
char *q;
|
||||
const char *p = parms[0].parm.u.sparm;
|
||||
struct pnp_cinfo d;
|
||||
|
||||
|
@ -86,14 +86,15 @@ getenv_int(char *name, int *data)
|
||||
quad_t
|
||||
getenv_quad(char *name, quad_t *data)
|
||||
{
|
||||
const char *value, *vtp;
|
||||
const char *value;
|
||||
char *vtp;
|
||||
quad_t iv;
|
||||
|
||||
if ((value = getenv(name)) == NULL)
|
||||
return(0);
|
||||
|
||||
iv = strtoq(value, &vtp, 0);
|
||||
if ((vtp == value) || (*vtp != 0))
|
||||
if ((vtp == value) || (*vtp != '\0'))
|
||||
return(0);
|
||||
|
||||
*data = iv;
|
||||
|
@ -83,7 +83,7 @@
|
||||
#define CT_CCL 1 /* %[...] conversion */
|
||||
#define CT_STRING 2 /* %s conversion */
|
||||
#define CT_INT 3 /* integer, i.e., strtoq or strtouq */
|
||||
typedef u_quad_t (*ccfntype)(const char *, const char **, int);
|
||||
typedef u_quad_t (*ccfntype)(const char *, char **, int);
|
||||
|
||||
static const u_char *__sccl(char *, const u_char *);
|
||||
|
||||
@ -508,7 +508,7 @@ again: c = *fmt++;
|
||||
u_quad_t res;
|
||||
|
||||
*p = 0;
|
||||
res = (*ccfn)(buf, (const char **)NULL, base);
|
||||
res = (*ccfn)(buf, (char **)NULL, base);
|
||||
if (flags & POINTER)
|
||||
*va_arg(ap, void **) =
|
||||
(void *)(uintptr_t)res;
|
||||
|
@ -52,7 +52,7 @@
|
||||
long
|
||||
strtol(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
const char **endptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
{
|
||||
const char *s = nptr;
|
||||
@ -127,6 +127,6 @@ strtol(nptr, endptr, base)
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
if (endptr != 0)
|
||||
*endptr = (const char *)(any ? s - 1 : nptr);
|
||||
*endptr = (char *)(any ? s - 1 : nptr);
|
||||
return (acc);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
quad_t
|
||||
strtoq(const char *nptr, const char **endptr, int base)
|
||||
strtoq(const char *nptr, char **endptr, int base)
|
||||
{
|
||||
const char *s;
|
||||
u_quad_t acc;
|
||||
@ -128,6 +128,6 @@ strtoq(const char *nptr, const char **endptr, int base)
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
if (endptr != 0)
|
||||
*endptr = (const char *)(any ? s - 1 : nptr);
|
||||
*endptr = (char *)(any ? s - 1 : nptr);
|
||||
return (acc);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@
|
||||
unsigned long
|
||||
strtoul(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
const char **endptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
{
|
||||
const char *s = nptr;
|
||||
@ -106,6 +106,6 @@ strtoul(nptr, endptr, base)
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
if (endptr != 0)
|
||||
*endptr = (const char *)(any ? s - 1 : nptr);
|
||||
*endptr = (char *)(any ? s - 1 : nptr);
|
||||
return (acc);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
u_quad_t
|
||||
strtouq(const char *nptr, const char **endptr, int base)
|
||||
strtouq(const char *nptr, char **endptr, int base)
|
||||
{
|
||||
const char *s = nptr;
|
||||
u_quad_t acc;
|
||||
@ -106,6 +106,6 @@ strtouq(const char *nptr, const char **endptr, int base)
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
if (endptr != 0)
|
||||
*endptr = (const char *)(any ? s - 1 : nptr);
|
||||
*endptr = (char *)(any ? s - 1 : nptr);
|
||||
return (acc);
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ static ng_ID_t
|
||||
ng_decodeidname(const char *name)
|
||||
{
|
||||
const int len = strlen(name);
|
||||
const char *eptr;
|
||||
char *eptr;
|
||||
u_long val;
|
||||
|
||||
/* Check for proper length, brackets, no leading junk */
|
||||
|
@ -247,9 +247,10 @@ static int
|
||||
ngfrm_newhook(node_p node, hook_p hook, const char *name)
|
||||
{
|
||||
const sc_p sc = node->private;
|
||||
const char *cp, *eptr;
|
||||
int dlci = 0;
|
||||
int ctxnum;
|
||||
const char *cp;
|
||||
char *eptr;
|
||||
int dlci = 0;
|
||||
int ctxnum;
|
||||
|
||||
/* Check if it's our friend the control hook */
|
||||
if (strcmp(name, NG_FRAMERELAY_HOOK_DEBUG) == 0) {
|
||||
|
@ -469,7 +469,7 @@ ng_ksocket_parse(const struct ng_ksocket_alias *aliases,
|
||||
const char *s, int family)
|
||||
{
|
||||
int k, val;
|
||||
const char *eptr;
|
||||
char *eptr;
|
||||
|
||||
/* Try aliases */
|
||||
for (k = 0; aliases[k].name != NULL; k++) {
|
||||
|
@ -276,7 +276,8 @@ ng_ppp_newhook(node_p node, hook_p hook, const char *name)
|
||||
/* Figure out which hook it is */
|
||||
if (strncmp(name, NG_PPP_HOOK_LINK_PREFIX, /* a link hook? */
|
||||
strlen(NG_PPP_HOOK_LINK_PREFIX)) == 0) {
|
||||
const char *cp, *eptr;
|
||||
const char *cp;
|
||||
char *eptr;
|
||||
|
||||
cp = name + strlen(NG_PPP_HOOK_LINK_PREFIX);
|
||||
if (!isdigit(*cp) || (cp[0] == '0' && cp[1] != '\0'))
|
||||
|
@ -178,7 +178,7 @@ ng_xxx_newhook(node_p node, hook_p hook, const char *name)
|
||||
* file. */
|
||||
if (strncmp(name,
|
||||
NG_XXX_HOOK_DLCI_LEADIN, strlen(NG_XXX_HOOK_DLCI_LEADIN)) == 0) {
|
||||
const char *eptr;
|
||||
char *eptr;
|
||||
|
||||
cp = name + sizeof(NG_XXX_HOOK_DLCI_LEADIN);
|
||||
if (!isdigit(*cp) || (cp[0] == '0' && cp[1] != '\0'))
|
||||
|
@ -1805,7 +1805,7 @@ getmemsize(int first)
|
||||
*/
|
||||
if ((cp = getenv("hw.physmem")) != NULL) {
|
||||
u_int64_t AllowMem, sanity;
|
||||
const char *ep;
|
||||
char *ep;
|
||||
|
||||
sanity = AllowMem = strtouq(cp, &ep, 0);
|
||||
if ((ep != cp) && (*ep != 0)) {
|
||||
|
@ -2787,7 +2787,7 @@ static int
|
||||
parse_args(const char *cmd, CmdParm *parms)
|
||||
{
|
||||
while (1) {
|
||||
const char *ptr;
|
||||
char *ptr;
|
||||
|
||||
if (*cmd == ' ' || *cmd == '\t') {
|
||||
++cmd;
|
||||
@ -2816,7 +2816,7 @@ parse_args(const char *cmd, CmdParm *parms)
|
||||
return 1;
|
||||
}
|
||||
/* XXX else should require end of token. */
|
||||
cmd = ptr;
|
||||
cmd = (const char *)ptr;
|
||||
}
|
||||
if ((parms->parm.dparm = find_device(devname, unit)) == NULL) {
|
||||
printf("No such device: %s%d\n", devname, unit);
|
||||
@ -2831,7 +2831,7 @@ parse_args(const char *cmd, CmdParm *parms)
|
||||
printf("Invalid numeric argument\n");
|
||||
return 1;
|
||||
}
|
||||
cmd = ptr;
|
||||
cmd = (const char *)ptr;
|
||||
++parms;
|
||||
continue;
|
||||
}
|
||||
@ -2841,7 +2841,7 @@ parse_args(const char *cmd, CmdParm *parms)
|
||||
printf("Invalid address argument\n");
|
||||
return 1;
|
||||
}
|
||||
cmd = ptr;
|
||||
cmd = (const char *)ptr;
|
||||
++parms;
|
||||
continue;
|
||||
}
|
||||
@ -2987,7 +2987,7 @@ set_pnp_parms(CmdParm *parms)
|
||||
{
|
||||
u_long idx, val, ldn, csn;
|
||||
int i;
|
||||
const char *q;
|
||||
char *q;
|
||||
const char *p = parms[0].parm.u.sparm;
|
||||
struct pnp_cinfo d;
|
||||
|
||||
|
@ -1805,7 +1805,7 @@ getmemsize(int first)
|
||||
*/
|
||||
if ((cp = getenv("hw.physmem")) != NULL) {
|
||||
u_int64_t AllowMem, sanity;
|
||||
const char *ep;
|
||||
char *ep;
|
||||
|
||||
sanity = AllowMem = strtouq(cp, &ep, 0);
|
||||
if ((ep != cp) && (*ep != 0)) {
|
||||
|
@ -424,7 +424,7 @@ mn_parse_ts(const char *s)
|
||||
{
|
||||
unsigned r;
|
||||
int i, j;
|
||||
const char *p;
|
||||
char *p;
|
||||
|
||||
r = 0;
|
||||
j = 0;
|
||||
@ -438,11 +438,11 @@ mn_parse_ts(const char *s)
|
||||
j = 0;
|
||||
r |= 1 << i;
|
||||
if (*p == ',') {
|
||||
s = p + 1;
|
||||
s = (const char *)p + 1;
|
||||
continue;
|
||||
} else if (*p == '-') {
|
||||
j = i;
|
||||
s = p + 1;
|
||||
s = (const char *)p + 1;
|
||||
continue;
|
||||
} else if (!*p) {
|
||||
break;
|
||||
|
@ -117,10 +117,10 @@ int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_)) __printflike(2, 0
|
||||
int ttyprintf __P((struct tty *, const char *, ...)) __printflike(2, 3);
|
||||
int sscanf __P((const char *, char const *, ...));
|
||||
int vsscanf __P((const char *, char const *, _BSD_VA_LIST_));
|
||||
long strtol __P((const char *, const char **, int base));
|
||||
u_long strtoul __P((const char *, const char **, int base));
|
||||
quad_t strtoq __P((const char *, const char **, int base));
|
||||
u_quad_t strtouq __P((const char *, const char **, int base));
|
||||
long strtol __P((const char *, char **, int base));
|
||||
u_long strtoul __P((const char *, char **, int base));
|
||||
quad_t strtoq __P((const char *, char **, int base));
|
||||
u_quad_t strtouq __P((const char *, char **, int base));
|
||||
|
||||
void bcopy __P((const void *from, void *to, size_t len));
|
||||
void ovbcopy __P((const void *from, void *to, size_t len));
|
||||
|
Loading…
Reference in New Issue
Block a user