mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
Use weak linking of wcsdup and wcscasecmp on OS X
Fixes https://github.com/fish-shell/fish-shell/issues/240
This commit is contained in:
17
common.cpp
17
common.cpp
@@ -2060,3 +2060,20 @@ scoped_lock::scoped_lock(pthread_mutex_t &mutex) : lock_obj(&mutex), locked(fals
|
||||
scoped_lock::~scoped_lock() {
|
||||
if (locked) this->unlock();
|
||||
}
|
||||
|
||||
wcstokenizer::wcstokenizer(const wcstring &s, const wcstring &separator) : sep(separator) {
|
||||
buffer = wcsdup(s.c_str());
|
||||
str = buffer;
|
||||
state = NULL;
|
||||
}
|
||||
|
||||
bool wcstokenizer::next(wcstring &result) {
|
||||
wchar_t *tmp = wcstok(str, sep.c_str(), &state);
|
||||
str = NULL;
|
||||
if (tmp) result = tmp;
|
||||
return tmp != NULL;
|
||||
}
|
||||
|
||||
wcstokenizer::~wcstokenizer() {
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user