mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 18:21:16 -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:
21
common.h
21
common.h
@@ -486,28 +486,15 @@ class scoped_lock {
|
||||
~scoped_lock();
|
||||
};
|
||||
|
||||
/* Wrapper around wcstok */
|
||||
class wcstokenizer {
|
||||
wchar_t *buffer, *str, *state;
|
||||
const wcstring sep;
|
||||
|
||||
public:
|
||||
wcstokenizer(const wcstring &s, const wcstring &separator) : sep(separator) {
|
||||
wchar_t *wcsdup(const wchar_t *s);
|
||||
buffer = wcsdup(s.c_str());
|
||||
str = buffer;
|
||||
state = NULL;
|
||||
}
|
||||
|
||||
bool next(wcstring &result) {
|
||||
wchar_t *tmp = wcstok(str, sep.c_str(), &state);
|
||||
str = NULL;
|
||||
if (tmp) result = tmp;
|
||||
return tmp != NULL;
|
||||
}
|
||||
|
||||
~wcstokenizer() {
|
||||
free(buffer);
|
||||
}
|
||||
wcstokenizer(const wcstring &s, const wcstring &separator);
|
||||
bool next(wcstring &result);
|
||||
~wcstokenizer();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user