string: remove incorrect lock on strtok
This commit is contained in:
parent
41493b4f46
commit
a6ffef77b9
1 changed files with 12 additions and 2 deletions
14
lib/string.c
14
lib/string.c
|
|
@ -1,4 +1,5 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#include "kernel/pio.h"
|
||||||
#include <kernel/slab.h>
|
#include <kernel/slab.h>
|
||||||
#include <kernel/lock.h>
|
#include <kernel/lock.h>
|
||||||
|
|
||||||
|
|
@ -16,6 +17,17 @@ void *memcpy(void *dest, const void *src, size_t num)
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int strcmp(const char *a, const char *b)
|
||||||
|
{
|
||||||
|
while (*a && *b) {
|
||||||
|
if (*a != *b)
|
||||||
|
return *a - *b;
|
||||||
|
a++;
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
return *a - *b;
|
||||||
|
}
|
||||||
|
|
||||||
char *strcpy(char *dest, const char *src)
|
char *strcpy(char *dest, const char *src)
|
||||||
{
|
{
|
||||||
while ((*dest++ = *src++))
|
while ((*dest++ = *src++))
|
||||||
|
|
@ -92,7 +104,6 @@ char *strchr(const char *s, int c)
|
||||||
|
|
||||||
char *strtok(char *str, const char *delim)
|
char *strtok(char *str, const char *delim)
|
||||||
{
|
{
|
||||||
spinlock_acquire(&strtok_lock);
|
|
||||||
static char *last = NULL;
|
static char *last = NULL;
|
||||||
if (str)
|
if (str)
|
||||||
last = str;
|
last = str;
|
||||||
|
|
@ -110,7 +121,6 @@ char *strtok(char *str, const char *delim)
|
||||||
last++;
|
last++;
|
||||||
}
|
}
|
||||||
|
|
||||||
spinlock_release(&strtok_lock);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue