summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2013-08-01 23:09:46 +0300
committerRan Benita <ran234@gmail.com>2013-08-02 11:40:27 +0300
commite91d2653dd18e6dcace8923596c1f1a29bb9d1d4 (patch)
tree21e30277f51e22c6287dacffbe89bf21abd13633 /src/utils.h
parente731b2514b96fcf92513c3f680a84666c0de3173 (diff)
downloadxorg-lib-libxkbcommon-e91d2653dd18e6dcace8923596c1f1a29bb9d1d4.tar.gz
scanner: allow empty key name literals
Some keymaps actually have this, like the quartz.xkb which is tested. We need to support these. https://bugs.freedesktop.org/show_bug.cgi?id=67654 Reported-By: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index eca6368..5cd6e57 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -72,6 +72,12 @@ strdup_safe(const char *s)
return s ? strdup(s) : NULL;
}
+static inline size_t
+strlen_safe(const char *s)
+{
+ return s ? strlen(s) : 0;
+}
+
static inline bool
isempty(const char *s)
{
@@ -84,6 +90,12 @@ strnull(const char *s)
return s ? s : "(null)";
}
+static inline const char *
+strempty(const char *s)
+{
+ return s ? s : "";
+}
+
static inline void *
memdup(const void *mem, size_t nmemb, size_t size)
{