summaryrefslogtreecommitdiffstats
path: root/runtime/unicode-helper.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-12 09:47:44 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-12 09:47:44 +0200
commit0917edf26da9055c6dc160aafca97896daea3e6c (patch)
treecaeee5f141e982597cd70070eb753ea1154d6720 /runtime/unicode-helper.h
parent1c8fe77b78a64d69138b30ec28b430677b197601 (diff)
downloadrsyslog-0917edf26da9055c6dc160aafca97896daea3e6c.tar.gz
rsyslog-0917edf26da9055c6dc160aafca97896daea3e6c.tar.xz
rsyslog-0917edf26da9055c6dc160aafca97896daea3e6c.zip
re-enabled outchannel functionality
Diffstat (limited to 'runtime/unicode-helper.h')
-rw-r--r--runtime/unicode-helper.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/runtime/unicode-helper.h b/runtime/unicode-helper.h
index 5289da3f..8216e992 100644
--- a/runtime/unicode-helper.h
+++ b/runtime/unicode-helper.h
@@ -4,6 +4,9 @@
* The following functions are wrappers which hopefully enable us to move
* from 8-bit chars to unicode with relative ease when we finally attack this
*
+ * Note: while we prefer inline functions, this leads to invalid references in
+ * core dumps. So in a debug build, we use macros where appropriate...
+ *
* Begun 2009-05-21 RGerhards
*
* Copyright (C) 2009 by Rainer Gerhards and Adiscon GmbH
@@ -31,10 +34,21 @@
#include <string.h>
-static inline char* ustrncpy(uchar *psz1, uchar *psz2, size_t len)
-{
- return strncpy((char*) psz1, (char*) psz2, len);
-}
+#ifdef DEBUG
+# define ustrncpy(psz1, psz2, len) strncpy((char*)(psz1), (char*)(psz2), (len))
+# define ustrdup(psz) (uchar*)strdup((char*)(psz))
+#else
+ static inline uchar* ustrncpy(uchar *psz1, uchar *psz2, size_t len)
+ {
+ return strncpy((char*) psz1, (char*) psz2, len);
+ }
+
+ static inline uchar* ustrdup(uchar *psz)
+ {
+ return (uchar*) strdup((char*)psz);
+ }
+
+#endif /* #ifdef DEBUG */
static inline int ustrcmp(uchar *psz1, uchar *psz2)
{
@@ -46,11 +60,6 @@ static inline int ustrlen(uchar *psz)
return strlen((char*) psz);
}
-static inline uchar* ustrdup(uchar *psz)
-{
- return (uchar*) strdup((char*)psz);
-}
-
#define UCHAR_CONSTANT(x) ((uchar*) (x))
#define CHAR_CONVERT(x) ((char*) (x))