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:
ridiculousfish
2012-07-20 14:33:08 -07:00
parent cf9bfe9e66
commit 966bbd476f
5 changed files with 99 additions and 72 deletions

View File

@@ -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();
};
/**