[http/jsonapi] Use strtok_r instead of strtok

This commit is contained in:
chme
2018-12-31 08:26:40 +01:00
parent 3de2418b49
commit 0f4cbb3375
2 changed files with 15 additions and 11 deletions

View File

@@ -1756,21 +1756,23 @@ queue_tracks_add_byuris(const char *param, int pos, int *total_count)
{
char *uris;
char *uri;
char *ptr;
const char *id;
int count = 0;
int ret = 0;
*total_count = 0;
if (strlen(param) == 0)
CHECK_NULL(L_WEB, uris = strdup(param));
uri = strtok_r(uris, ",", &ptr);
if (!uri)
{
DPRINTF(E_LOG, L_WEB, "Empty query parameter 'uris'\n");
free(uris);
return -1;
}
uris = strdup(param);
uri = strtok(uris, ",");
do
{
count = 0;
@@ -1811,7 +1813,7 @@ queue_tracks_add_byuris(const char *param, int pos, int *total_count)
*total_count += count;
}
while ((uri = strtok(NULL, ",")));
while ((uri = strtok_r(NULL, ",", &ptr)));
free(uris);