summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-06-14 16:38:47 +0200
committerRobin Gareus <robin@gareus.org>2014-06-14 16:38:47 +0200
commit62ba8d23e33d009e202968408924d00441fe587a (patch)
treed2643232383960f49d04cc25e43831abd9af3295 /libs
parent51b475467a157735e4b72935a8aa2d03fb43a86f (diff)
tracking down concurrency issus is fun.
Diffstat (limited to 'libs')
-rw-r--r--libs/pbd/pathscanner.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/pbd/pathscanner.cc b/libs/pbd/pathscanner.cc
index 6d3cba8d77..b60e1eee1a 100644
--- a/libs/pbd/pathscanner.cc
+++ b/libs/pbd/pathscanner.cc
@@ -24,6 +24,7 @@
using PBD::readdir;
using PBD::opendir;
using PBD::closedir;
+#define strtok_r strtok_s // @john: this should probably go to msvc_extra_headers/ardourext/misc.h.input instead of the current define there
#else
#include <dirent.h>
#include <cstdlib>
@@ -105,8 +106,9 @@ PathScanner::run_scan_internal (vector<string *> *result,
string search_str;
string *newstr;
long nfound = 0;
+ char *saveptr;
- if ((thisdir = strtok (pathcopy, G_SEARCHPATH_SEPARATOR_S)) == 0 ||
+ if ((thisdir = strtok_r (pathcopy, G_SEARCHPATH_SEPARATOR_S, &saveptr)) == 0 ||
strlen (thisdir) == 0) {
free (pathcopy);
return 0;
@@ -170,7 +172,7 @@ PathScanner::run_scan_internal (vector<string *> *result,
}
closedir (dir);
- } while ((limit < 0 || (nfound < limit)) && (thisdir = strtok (0, G_SEARCHPATH_SEPARATOR_S)));
+ } while ((limit < 0 || (nfound < limit)) && (thisdir = strtok_r (0, G_SEARCHPATH_SEPARATOR_S, &saveptr)));
free (pathcopy);
return result;