chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tree-wide: htonl() is weird, let's use htobe32() instead (#3538)
[elogind.git]
/
src
/
basic
/
string-util.h
diff --git
a/src/basic/string-util.h
b/src/basic/string-util.h
index 7ed649ae6cd4a88c2ac5d8295f675a4a3b441481..1209e1e2e14c11853b526891d31b34584c36db68 100644
(file)
--- 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
/***
#pragma once
/***
@@
-21,7
+19,9
@@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <alloca.h>
#include <stdbool.h>
#include <stdbool.h>
+#include <stddef.h>
#include <string.h>
#include "macro.h"
#include <string.h>
#include "macro.h"
@@
-37,6
+37,7
@@
#define UPPERCASE_LETTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define LETTERS LOWERCASE_LETTERS UPPERCASE_LETTERS
#define ALPHANUMERICAL LETTERS DIGITS
#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)
#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];
}
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;
static inline char *startswith(const char *s, const char *prefix) {
size_t l;