[Asterisk-cvs] asterisk/include/asterisk utils.h,1.17,1.18
markster at lists.digium.com
markster at lists.digium.com
Wed Jan 19 22:50:18 CST 2005
Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv13227/include/asterisk
Modified Files:
utils.h
Log Message:
Fix ODBC to clear title each time (bug #3379)
Index: utils.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/utils.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- utils.h 15 Jan 2005 21:51:38 -0000 1.17
+++ utils.h 20 Jan 2005 04:53:17 -0000 1.18
@@ -134,6 +134,24 @@
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
More information about the svn-commits
mailing list