Commit da6b4703 authored by Dave Jones's avatar Dave Jones

[PATCH] The last? strtok fixes.

Hopefully this is all of them..
parent 3c22e98a
...@@ -44,7 +44,7 @@ EXPORT_SYMBOL_NOVERS(strncpy); ...@@ -44,7 +44,7 @@ EXPORT_SYMBOL_NOVERS(strncpy);
EXPORT_SYMBOL_NOVERS(strnlen); EXPORT_SYMBOL_NOVERS(strnlen);
EXPORT_SYMBOL_NOVERS(strrchr); EXPORT_SYMBOL_NOVERS(strrchr);
EXPORT_SYMBOL_NOVERS(strstr); EXPORT_SYMBOL_NOVERS(strstr);
EXPORT_SYMBOL_NOVERS(strtok); EXPORT_SYMBOL_NOVERS(strsep);
EXPORT_SYMBOL_NOVERS(strpbrk); EXPORT_SYMBOL_NOVERS(strpbrk);
/* /*
......
...@@ -47,7 +47,7 @@ EXPORT_SYMBOL_NOVERS(strncpy); ...@@ -47,7 +47,7 @@ EXPORT_SYMBOL_NOVERS(strncpy);
EXPORT_SYMBOL_NOVERS(strnlen); EXPORT_SYMBOL_NOVERS(strnlen);
EXPORT_SYMBOL_NOVERS(strrchr); EXPORT_SYMBOL_NOVERS(strrchr);
EXPORT_SYMBOL_NOVERS(strstr); EXPORT_SYMBOL_NOVERS(strstr);
EXPORT_SYMBOL_NOVERS(strtok); EXPORT_SYMBOL_NOVERS(strsep);
EXPORT_SYMBOL_NOVERS(strpbrk); EXPORT_SYMBOL_NOVERS(strpbrk);
/* /*
......
...@@ -1463,11 +1463,11 @@ static int tokenize (char *str, char **tokens) ...@@ -1463,11 +1463,11 @@ static int tokenize (char *str, char **tokens)
{ {
int cnt = 0; int cnt = 0;
tokens[0] = strtok(str, "/"); tokens[0] = strsep(&str, "/");
while (tokens[cnt] && (cnt < 32 - 1)) while (tokens[cnt] && (cnt < 32 - 1))
{ {
tokens[cnt] = strstrip(tokens[cnt], " \t"); tokens[cnt] = strstrip(tokens[cnt], " \t");
tokens[++cnt] = strtok(NULL, "/"); tokens[++cnt] = strsep(&str, "/");
} }
return cnt; return cnt;
} }
......
...@@ -906,7 +906,7 @@ ahc_softc_comp(struct ahc_softc *lahc, struct ahc_softc *rahc) ...@@ -906,7 +906,7 @@ ahc_softc_comp(struct ahc_softc *lahc, struct ahc_softc *rahc)
} }
static void static void
ahc_linux_setup_tag_info(char *p, char *end) ahc_linux_setup_tag_info(char *p, char *end, char *s)
{ {
char *base; char *base;
char *tok; char *tok;
...@@ -986,7 +986,7 @@ ahc_linux_setup_tag_info(char *p, char *end) ...@@ -986,7 +986,7 @@ ahc_linux_setup_tag_info(char *p, char *end)
} }
} }
while ((p != base) && (p != NULL)) while ((p != base) && (p != NULL))
p = strtok(NULL, ",."); p = strsep(&s, ",.");
} }
/* /*
...@@ -1018,7 +1018,8 @@ aic7xxx_setup(char *s) ...@@ -1018,7 +1018,8 @@ aic7xxx_setup(char *s)
end = strchr(s, '\0'); end = strchr(s, '\0');
for (p = strtok(s, ",."); p; p = strtok(NULL, ",.")) { while ((p = strsep(&s, ",.")) != NULL) {
if (!*p) continue;
for (i = 0; i < NUM_ELEMENTS(options); i++) { for (i = 0; i < NUM_ELEMENTS(options); i++) {
n = strlen(options[i].name); n = strlen(options[i].name);
...@@ -1026,7 +1027,7 @@ aic7xxx_setup(char *s) ...@@ -1026,7 +1027,7 @@ aic7xxx_setup(char *s)
continue; continue;
if (strncmp(p, "tag_info", n) == 0) { if (strncmp(p, "tag_info", n) == 0) {
ahc_linux_setup_tag_info(p + n, end); ahc_linux_setup_tag_info(p + n, end, s);
} else if (p[n] == ':') { } else if (p[n] == ':') {
*(options[i].flag) = *(options[i].flag) =
simple_strtoul(p + n + 1, NULL, 0); simple_strtoul(p + n + 1, NULL, 0);
......
...@@ -1443,7 +1443,7 @@ aic7xxx_setup(char *s) ...@@ -1443,7 +1443,7 @@ aic7xxx_setup(char *s)
end = strchr(s, '\0'); end = strchr(s, '\0');
for (p = strtok(s, ",."); p; p = strtok(NULL, ",.")) while ((p = strsep(&s, ",.")) != NULL)
{ {
for (i = 0; i < NUMBER(options); i++) for (i = 0; i < NUMBER(options); i++)
{ {
...@@ -1525,7 +1525,7 @@ aic7xxx_setup(char *s) ...@@ -1525,7 +1525,7 @@ aic7xxx_setup(char *s)
} }
} }
while((p != base) && (p != NULL)) while((p != base) && (p != NULL))
p = strtok(NULL, ",."); p = strsep(&s, ",.");
} }
} }
else if (p[n] == ':') else if (p[n] == ':')
......
This diff is collapsed.
...@@ -1132,7 +1132,6 @@ static int flash_cursor(void); ...@@ -1132,7 +1132,6 @@ static int flash_cursor(void);
static void amifb_interrupt(int irq, void *dev_id, struct pt_regs *fp); static void amifb_interrupt(int irq, void *dev_id, struct pt_regs *fp);
static u_long chipalloc(u_long size); static u_long chipalloc(u_long size);
static void chipfree(void); static void chipfree(void);
static char *strtoke(char *s,const char *ct);
/* /*
* Hardware routines * Hardware routines
...@@ -1224,22 +1223,22 @@ int __init amifb_setup(char *options) ...@@ -1224,22 +1223,22 @@ int __init amifb_setup(char *options)
* <H*> horizontal freq. in kHz * <H*> horizontal freq. in kHz
*/ */
if (!(p = strtoke(mcap_spec, ";")) || !*p) if (!(p = strsep(&mcap_spec, ";")) || !*p)
goto cap_invalid; goto cap_invalid;
vmin = simple_strtoul(p, NULL, 10); vmin = simple_strtoul(p, NULL, 10);
if (vmin <= 0) if (vmin <= 0)
goto cap_invalid; goto cap_invalid;
if (!(p = strtoke(NULL, ";")) || !*p) if (!(p = strsep(&mcap_spec, ";")) || !*p)
goto cap_invalid; goto cap_invalid;
vmax = simple_strtoul(p, NULL, 10); vmax = simple_strtoul(p, NULL, 10);
if (vmax <= 0 || vmax <= vmin) if (vmax <= 0 || vmax <= vmin)
goto cap_invalid; goto cap_invalid;
if (!(p = strtoke(NULL, ";")) || !*p) if (!(p = strsep(&mcap_spec, ";")) || !*p)
goto cap_invalid; goto cap_invalid;
hmin = 1000 * simple_strtoul(p, NULL, 10); hmin = 1000 * simple_strtoul(p, NULL, 10);
if (hmin <= 0) if (hmin <= 0)
goto cap_invalid; goto cap_invalid;
if (!(p = strtoke(NULL, "")) || !*p) if (!(p = strsep(&mcap_spec, "")) || !*p)
goto cap_invalid; goto cap_invalid;
hmax = 1000 * simple_strtoul(p, NULL, 10); hmax = 1000 * simple_strtoul(p, NULL, 10);
if (hmax <= 0 || hmax <= hmin) if (hmax <= 0 || hmax <= hmin)
...@@ -1915,29 +1914,6 @@ static void amifb_interrupt(int irq, void *dev_id, struct pt_regs *fp) ...@@ -1915,29 +1914,6 @@ static void amifb_interrupt(int irq, void *dev_id, struct pt_regs *fp)
} }
} }
/*
* A strtok which returns empty strings, too
*/
static char __init *strtoke(char *s,const char *ct)
{
char *sbegin, *send;
static char *ssave = NULL;
sbegin = s ? s : ssave;
if (!sbegin)
return NULL;
if (*sbegin == '\0') {
ssave = NULL;
return NULL;
}
send = strpbrk(sbegin, ct);
if (send && *send != '\0')
*send++ = '\0';
ssave = send;
return sbegin;
}
/* --------------------------- Hardware routines --------------------------- */ /* --------------------------- Hardware routines --------------------------- */
/* /*
......
...@@ -2860,28 +2860,6 @@ int __init atafb_init(void) ...@@ -2860,28 +2860,6 @@ int __init atafb_init(void)
return 0; return 0;
} }
/* a strtok which returns empty strings, too */
static char * strtoke(char * s,const char * ct)
{
char *sbegin, *send;
static char *ssave = NULL;
sbegin = s ? s : ssave;
if (!sbegin) {
return NULL;
}
if (*sbegin == '\0') {
ssave = NULL;
return NULL;
}
send = strpbrk(sbegin, ct);
if (send && *send != '\0')
*send++ = '\0';
ssave = send;
return sbegin;
}
int __init atafb_setup( char *options ) int __init atafb_setup( char *options )
{ {
char *this_opt; char *this_opt;
...@@ -2956,18 +2934,18 @@ int __init atafb_setup( char *options ) ...@@ -2956,18 +2934,18 @@ int __init atafb_setup( char *options )
int xres; int xres;
char *p; char *p;
if (!(p = strtoke(int_str, ";")) ||!*p) goto int_invalid; if (!(p = strsep(&int_str, ";")) || !*p) goto int_invalid;
xres = simple_strtoul(p, NULL, 10); xres = simple_strtoul(p, NULL, 10);
if (!(p = strtoke(NULL, ";")) || !*p) goto int_invalid; if (!(p = strsep(&int_str, ";")) || !*p) goto int_invalid;
sttt_xres=xres; sttt_xres=xres;
tt_yres=st_yres=simple_strtoul(p, NULL, 10); tt_yres=st_yres=simple_strtoul(p, NULL, 10);
if ((p=strtoke(NULL, ";")) && *p) { if ((p=strsep(&int_str, ";")) && *p) {
sttt_xres_virtual=simple_strtoul(p, NULL, 10); sttt_xres_virtual=simple_strtoul(p, NULL, 10);
} }
if ((p=strtoke(NULL, ";")) && *p) { if ((p=strsep(&int_str, ";")) && *p) {
sttt_yres_virtual=simple_strtoul(p, NULL, 0); sttt_yres_virtual=simple_strtoul(p, NULL, 0);
} }
if ((p=strtoke(NULL, ";")) && *p) { if ((p=strsep(&int_str, ";")) && *p) {
ovsc_offset=simple_strtoul(p, NULL, 0); ovsc_offset=simple_strtoul(p, NULL, 0);
} }
...@@ -2993,20 +2971,20 @@ int __init atafb_setup( char *options ) ...@@ -2993,20 +2971,20 @@ int __init atafb_setup( char *options )
* *
* Even xres_virtual is available, we neither support panning nor hw-scrolling! * Even xres_virtual is available, we neither support panning nor hw-scrolling!
*/ */
if (!(p = strtoke(ext_str, ";")) ||!*p) goto ext_invalid; if (!(p = strsep(&ext_str, ";")) || !*p) goto ext_invalid;
xres_virtual = xres = simple_strtoul(p, NULL, 10); xres_virtual = xres = simple_strtoul(p, NULL, 10);
if (xres <= 0) goto ext_invalid; if (xres <= 0) goto ext_invalid;
if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid; if (!(p = strsep(&ext_str, ";")) || !*p) goto ext_invalid;
yres = simple_strtoul(p, NULL, 10); yres = simple_strtoul(p, NULL, 10);
if (yres <= 0) goto ext_invalid; if (yres <= 0) goto ext_invalid;
if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid; if (!(p = strsep(&ext_str, ";")) || !*p) goto ext_invalid;
depth = simple_strtoul(p, NULL, 10); depth = simple_strtoul(p, NULL, 10);
if (depth != 1 && depth != 2 && depth != 4 && depth != 8 && if (depth != 1 && depth != 2 && depth != 4 && depth != 8 &&
depth != 16 && depth != 24) goto ext_invalid; depth != 16 && depth != 24) goto ext_invalid;
if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid; if (!(p = strsep(&ext_str, ";")) || !*p) goto ext_invalid;
if (*p == 'i') if (*p == 'i')
planes = FB_TYPE_INTERLEAVED_PLANES; planes = FB_TYPE_INTERLEAVED_PLANES;
else if (*p == 'p') else if (*p == 'p')
...@@ -3019,19 +2997,19 @@ int __init atafb_setup( char *options ) ...@@ -3019,19 +2997,19 @@ int __init atafb_setup( char *options )
goto ext_invalid; goto ext_invalid;
if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid; if (!(p = strsep(&ext_str, ";")) || !*p) goto ext_invalid;
addr = simple_strtoul(p, NULL, 0); addr = simple_strtoul(p, NULL, 0);
if (!(p = strtoke(NULL, ";")) ||!*p) if (!(p = strsep(&ext_str, ";")) || !*p)
len = xres*yres*depth/8; len = xres*yres*depth/8;
else else
len = simple_strtoul(p, NULL, 0); len = simple_strtoul(p, NULL, 0);
if ((p = strtoke(NULL, ";")) && *p) { if ((p = strsep(&ext_str, ";")) && *p) {
external_vgaiobase=simple_strtoul(p, NULL, 0); external_vgaiobase=simple_strtoul(p, NULL, 0);
} }
if ((p = strtoke(NULL, ";")) && *p) { if ((p = strsep(&ext_str, ";")) && *p) {
external_bitspercol = simple_strtoul(p, NULL, 0); external_bitspercol = simple_strtoul(p, NULL, 0);
if (external_bitspercol > 8) if (external_bitspercol > 8)
external_bitspercol = 8; external_bitspercol = 8;
...@@ -3039,14 +3017,14 @@ int __init atafb_setup( char *options ) ...@@ -3039,14 +3017,14 @@ int __init atafb_setup( char *options )
external_bitspercol = 1; external_bitspercol = 1;
} }
if ((p = strtoke(NULL, ";")) && *p) { if ((p = strsep(&ext_str, ";")) && *p) {
if (!strcmp(p, "vga")) if (!strcmp(p, "vga"))
external_card_type = IS_VGA; external_card_type = IS_VGA;
if (!strcmp(p, "mv300")) if (!strcmp(p, "mv300"))
external_card_type = IS_MV300; external_card_type = IS_MV300;
} }
if ((p = strtoke(NULL, ";")) && *p) { if ((p = strsep(&ext_str, ";")) && *p) {
xres_virtual = simple_strtoul(p, NULL, 10); xres_virtual = simple_strtoul(p, NULL, 10);
if (xres_virtual < xres) if (xres_virtual < xres)
xres_virtual = xres; xres_virtual = xres;
...@@ -3089,16 +3067,16 @@ int __init atafb_setup( char *options ) ...@@ -3089,16 +3067,16 @@ int __init atafb_setup( char *options )
* <V*> vertical freq. in Hz * <V*> vertical freq. in Hz
* <H*> horizontal freq. in kHz * <H*> horizontal freq. in kHz
*/ */
if (!(p = strtoke(mcap_spec, ";")) || !*p) goto cap_invalid; if (!(p = strsep(&mcap_spec, ";")) || !*p) goto cap_invalid;
vmin = simple_strtoul(p, NULL, 10); vmin = simple_strtoul(p, NULL, 10);
if (vmin <= 0) goto cap_invalid; if (vmin <= 0) goto cap_invalid;
if (!(p = strtoke(NULL, ";")) || !*p) goto cap_invalid; if (!(p = strsep(&mcap_spec, ";")) || !*p) goto cap_invalid;
vmax = simple_strtoul(p, NULL, 10); vmax = simple_strtoul(p, NULL, 10);
if (vmax <= 0 || vmax <= vmin) goto cap_invalid; if (vmax <= 0 || vmax <= vmin) goto cap_invalid;
if (!(p = strtoke(NULL, ";")) || !*p) goto cap_invalid; if (!(p = strsep(&mcap_spec, ";")) || !*p) goto cap_invalid;
hmin = 1000 * simple_strtoul(p, NULL, 10); hmin = 1000 * simple_strtoul(p, NULL, 10);
if (hmin <= 0) goto cap_invalid; if (hmin <= 0) goto cap_invalid;
if (!(p = strtoke(NULL, "")) || !*p) goto cap_invalid; if (!(p = strsep(&mcap_spec, "")) || !*p) goto cap_invalid;
hmax = 1000 * simple_strtoul(p, NULL, 10); hmax = 1000 * simple_strtoul(p, NULL, 10);
if (hmax <= 0 || hmax <= hmin) goto cap_invalid; if (hmax <= 0 || hmax <= hmin) goto cap_invalid;
...@@ -3117,11 +3095,11 @@ int __init atafb_setup( char *options ) ...@@ -3117,11 +3095,11 @@ int __init atafb_setup( char *options )
char *p; char *p;
int xres, yres, depth, temp; int xres, yres, depth, temp;
if (!(p = strtoke(user_mode, ";")) || !*p) goto user_invalid; if (!(p = strsep(&user_mode, ";")) || !*p) goto user_invalid;
xres = simple_strtoul(p, NULL, 10); xres = simple_strtoul(p, NULL, 10);
if (!(p = strtoke(NULL, ";")) || !*p) goto user_invalid; if (!(p = strsep(&user_mode, ";")) || !*p) goto user_invalid;
yres = simple_strtoul(p, NULL, 10); yres = simple_strtoul(p, NULL, 10);
if (!(p = strtoke(NULL, "")) || !*p) goto user_invalid; if (!(p = strsep(&user_mode, "")) || !*p) goto user_invalid;
depth = simple_strtoul(p, NULL, 10); depth = simple_strtoul(p, NULL, 10);
if ((temp=get_video_mode("user0"))) { if ((temp=get_video_mode("user0"))) {
default_par=temp; default_par=temp;
......
...@@ -178,7 +178,6 @@ static void atyfbcon_blank(int blank, struct fb_info *fb); ...@@ -178,7 +178,6 @@ static void atyfbcon_blank(int blank, struct fb_info *fb);
static int aty_init(struct fb_info_aty *info, const char *name); static int aty_init(struct fb_info_aty *info, const char *name);
#ifdef CONFIG_ATARI #ifdef CONFIG_ATARI
static int store_video_par(char *videopar, unsigned char m64_num); static int store_video_par(char *videopar, unsigned char m64_num);
static char *strtoke(char *s, const char *ct);
#endif #endif
static void aty_set_crtc(const struct fb_info_aty *info, static void aty_set_crtc(const struct fb_info_aty *info,
...@@ -2595,13 +2594,13 @@ static int __init store_video_par(char *video_str, unsigned char m64_num) ...@@ -2595,13 +2594,13 @@ static int __init store_video_par(char *video_str, unsigned char m64_num)
printk("store_video_par() '%s' \n", video_str); printk("store_video_par() '%s' \n", video_str);
if (!(p = strtoke(video_str, ";")) || !*p) if (!(p = strsep(&video_str, ";")) || !*p)
goto mach64_invalid; goto mach64_invalid;
vmembase = simple_strtoul(p, NULL, 0); vmembase = simple_strtoul(p, NULL, 0);
if (!(p = strtoke(NULL, ";")) || !*p) if (!(p = strsep(&video_str, ";")) || !*p)
goto mach64_invalid; goto mach64_invalid;
size = simple_strtoul(p, NULL, 0); size = simple_strtoul(p, NULL, 0);
if (!(p = strtoke(NULL, ";")) || !*p) if (!(p = strsep(&video_str, ";")) || !*p)
goto mach64_invalid; goto mach64_invalid;
guiregbase = simple_strtoul(p, NULL, 0); guiregbase = simple_strtoul(p, NULL, 0);
...@@ -2616,25 +2615,6 @@ static int __init store_video_par(char *video_str, unsigned char m64_num) ...@@ -2616,25 +2615,6 @@ static int __init store_video_par(char *video_str, unsigned char m64_num)
phys_vmembase[m64_num] = 0; phys_vmembase[m64_num] = 0;
return -1; return -1;
} }
static char __init *strtoke(char *s, const char *ct)
{
static char *ssave = NULL;
char *sbegin, *send;
sbegin = s ? s : ssave;
if (!sbegin)
return NULL;
if (*sbegin == '\0') {
ssave = NULL;
return NULL;
}
send = strpbrk(sbegin, ct);
if (send && *send != '\0')
*send++ = '\0';
ssave = send;
return sbegin;
}
#endif /* CONFIG_ATARI */ #endif /* CONFIG_ATARI */
static int atyfbcon_switch(int con, struct fb_info *fb) static int atyfbcon_switch(int con, struct fb_info *fb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment