diff options
Diffstat (limited to 'libutil/op_string.c')
-rw-r--r-- | libutil/op_string.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/libutil/op_string.c b/libutil/op_string.c deleted file mode 100644 index d440299..0000000 --- a/libutil/op_string.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file op_string.c - * general purpose C string handling implementation. - * - * @remark Copyright 2003 OProfile authors - * @remark Read the file COPYING - * - * @author John Levon - * @author Philippe Elie - */ - -#include <string.h> -#include "op_libiberty.h" - - -char * op_xstrndup(char const * s, size_t len) -{ - return xmemdup(s, len, len + 1); -} - - -size_t op_hash_string(char const * str) -{ - size_t hash = 0; - for (; *str; ++str) - hash ^= (hash << 16) ^ (hash >> 8) ^ *str; - return hash; -} - - -int strisprefix(char const * str, char const * prefix) -{ - return strstr(str, prefix) == str; -} - - -char const * skip_ws(char const * c) -{ - while (*c == ' ' || *c == '\t' || *c == '\n') - ++c; - return c; -} - - -char const * skip_nonws(char const * c) -{ - while (*c && *c != ' ' && *c != '\t' && *c != '\n') - ++c; - return c; -} - - -int empty_line(char const * c) -{ - return !*skip_ws(c); -} - - -int comment_line(char const * c) -{ - return *skip_ws(c) == '#'; -} |