chiark / gitweb /
util: Make in_charset a static inline in util.h
authorJosh Triplett <josh@joshtriplett.org>
Wed, 12 Mar 2014 01:51:17 +0000 (18:51 -0700)
committerLennart Poettering <lennart@poettering.net>
Wed, 12 Mar 2014 16:02:09 +0000 (17:02 +0100)
With in_charset now reduced to a one-liner (plus asserts), make it a
static inline.

src/shared/util.c
src/shared/util.h

index e1a11684565f4bc8780422af492238271a988fa1..9e8cd54d04991e131499c48dfce6d3dae91c42ef 100644 (file)
@@ -920,12 +920,6 @@ char *delete_chars(char *s, const char *bad) {
         return s;
 }
 
-bool in_charset(const char *s, const char* charset) {
-        assert(s);
-        assert(charset);
-        return s[strspn(s, charset)] == '\0';
-}
-
 char *file_in_same_dir(const char *path, const char *filename) {
         char *e, *r;
         size_t k;
index cc52ae750387371ae2dbc0d74b02b613fa393f32..81831e277154996b76be4e11dbf1edb5f8748963 100644 (file)
@@ -531,7 +531,11 @@ char *strjoin(const char *x, ...) _sentinel_;
 
 bool is_main_thread(void);
 
-bool in_charset(const char *s, const char* charset) _pure_;
+static inline bool _pure_ in_charset(const char *s, const char* charset) {
+        assert(s);
+        assert(charset);
+        return s[strspn(s, charset)] == '\0';
+}
 
 int block_get_whole_disk(dev_t d, dev_t *ret);