Skip to content

Commit

Permalink
libout123: use strtok_r()
Browse files Browse the repository at this point in the history
git-svn-id: svn://scm.orgis.org/mpg123/trunk@5460 35dc7657-300d-0410-a2e5-dc2837fedb53
  • Loading branch information
thor committed Dec 8, 2024
1 parent dd62793 commit 4b29cac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
------
- scripts/tag_lyrics.py: fix for python3 (thanks to cclauss,
github PR 16)
- libout123: Use strtok_r() to avoid conflicts multithreaded contexts
(both sides should avoid plain strtok()!).

1.32.9
------
Expand Down
7 changes: 4 additions & 3 deletions src/libout123/libout123.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
audio: audio output interface
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2024 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp
*/
Expand Down Expand Up @@ -455,11 +455,12 @@ out123_open(out123_handle *ao, const char* driver, const char* device)
}

/* Now loop over the list of possible modules to find one that works. */
nextname = strtok(modnames, ",");
char *toksave = NULL;
nextname = strtok_r(modnames, ",", &toksave);
while(!ao->open && nextname)
{
char *curname = nextname;
nextname = strtok(NULL, ",");
nextname = strtok_r(NULL, ",", &toksave);
check_output_module(ao, curname, device, !nextname);
if(ao->open)
{
Expand Down

0 comments on commit 4b29cac

Please sign in to comment.