aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-20 04:53:17 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-20 04:53:17 +0000
commitcbdee91e8373d87912ceb88111331ed1c6345517 (patch)
tree1283b173d9f6757a0c18d0c32f19215946885284 /include
parent591b532e8d5a1f68becfa2c6b03ceb319ea0dce4 (diff)
Fix ODBC to clear title each time (bug #3379)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4851 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/utils.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index dd1141985..0669c08a0 100755
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -134,6 +134,24 @@ extern int test_for_thread_safety(void);
extern const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia);
extern int ast_utils_init(void);
+/* The realloca lets us ast_restrdupa(), but you can't mix any other ast_strdup calls! */
+
+struct ast_realloca {
+ char *ptr;
+ int alloclen;
+};
+
+#define ast_restrdupa(ra, s) \
+ ({ \
+ if ((ra)->ptr && strlen(s) + 1 < (ra)->alloclen) { \
+ strcpy((ra)->ptr, s); \
+ } else { \
+ (ra)->ptr = alloca(strlen(s) + 1 - (ra)->alloclen); \
+ if ((ra)->ptr) (ra)->alloclen = strlen(s) + 1; \
+ } \
+ (ra)->ptr; \
+ })
+
#ifdef inet_ntoa
#undef inet_ntoa
#endif