From f797b2c8e30a4a6f9370db293289a158729b2525 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 20 Nov 2012 03:14:52 +0100 Subject: CHR2STR() macro for common case of constructing an anonymous string on the stack given a single character --- sciteco.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3