X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fstring-util.h;h=1209e1e2e14c11853b526891d31b34584c36db68;hb=9eaebafed6dec1c3b5d1307b37f1b03a19530527;hp=8b87c1e23d356e4f3b7d2becf9c9174bc8df3b01;hpb=07de3e94bec7f426258007c4a790a78589d2fee3;p=elogind.git
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
index 8b87c1e23..1209e1e2e 100644
--- a/src/basic/string-util.h
+++ b/src/basic/string-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
@@ -21,7 +19,9 @@
along with systemd; If not, see .
***/
+#include
#include
+#include
#include
#include "macro.h"
@@ -37,6 +37,7 @@
#define UPPERCASE_LETTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define LETTERS LOWERCASE_LETTERS UPPERCASE_LETTERS
#define ALPHANUMERICAL LETTERS DIGITS
+#define HEXDIGITS DIGITS "abcdefABCDEF"
#define streq(a,b) (strcmp((a),(b)) == 0)
#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
@@ -65,6 +66,10 @@ static inline bool isempty(const char *p) {
return !p || !p[0];
}
+static inline const char *empty_to_null(const char *p) {
+ return isempty(p) ? NULL : p;
+}
+
static inline char *startswith(const char *s, const char *prefix) {
size_t l;
@@ -132,6 +137,9 @@ char ascii_tolower(char x);
char *ascii_strlower(char *s);
char *ascii_strlower_n(char *s, size_t n);
+int ascii_strcasecmp_n(const char *a, const char *b, size_t n);
+int ascii_strcasecmp_nn(const char *a, size_t n, const char *b, size_t m);
+
bool chars_intersect(const char *a, const char *b) _pure_;
static inline bool _pure_ in_charset(const char *s, const char* charset) {