diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-20 03:14:52 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-20 06:07:34 +0100 |
commit | f797b2c8e30a4a6f9370db293289a158729b2525 (patch) | |
tree | 915a00d5b58f59907f516cf95e914e8a7849e27d | |
parent | a94a7e8ba9080eb7a330fd64628e5cbe36be9fe6 (diff) | |
download | sciteco-f797b2c8e30a4a6f9370db293289a158729b2525.tar.gz |
CHR2STR() macro for common case of constructing an anonymous string on the stack given a single character
-rw-r--r-- | sciteco.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -36,6 +36,8 @@ typedef gint64 tecoBool; #define IS_SUCCESS(X) ((X) < 0) #define IS_FAILURE(X) (!IS_SUCCESS(X)) +#define CHR2STR(X) ((gchar []){X, '\0'}) + namespace String { static inline void @@ -50,7 +52,7 @@ append(gchar *&str1, const gchar *str2) static inline void append(gchar *&str, gchar chr) { - append(str, (gchar []){chr, '\0'}); + append(str, CHR2STR(chr)); } } /* namespace String */ |