summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7b909d7)
This simplifies in_charset down to a one-liner, and allows for possible
optimizations of strspn in libc.
}
bool in_charset(const char *s, const char* charset) {
}
bool in_charset(const char *s, const char* charset) {
assert(s);
assert(charset);
assert(s);
assert(charset);
-
- for (i = s; *i; i++)
- if (!strchr(charset, *i))
- return false;
-
- return true;
+ return s[strspn(s, charset)] == '\0';
}
char *file_in_same_dir(const char *path, const char *filename) {
}
char *file_in_same_dir(const char *path, const char *filename) {