aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-20 03:14:52 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-20 06:07:34 +0100
commitf797b2c8e30a4a6f9370db293289a158729b2525 (patch)
tree915a00d5b58f59907f516cf95e914e8a7849e27d
parenta94a7e8ba9080eb7a330fd64628e5cbe36be9fe6 (diff)
downloadsciteco-f797b2c8e30a4a6f9370db293289a158729b2525.tar.gz
CHR2STR() macro for common case of constructing an anonymous string on the stack given a single character
-rw-r--r--sciteco.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sciteco.h b/sciteco.h
index fca4434..88ab109 100644
--- a/sciteco.h
+++ b/sciteco.h
@@ -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 */