]> granicus.if.org Git - php/commitdiff
Simplify use of this header in external apps
authorSascha Schumann <sas@php.net>
Wed, 16 Apr 2003 09:12:37 +0000 (09:12 +0000)
committerSascha Schumann <sas@php.net>
Wed, 16 Apr 2003 09:12:37 +0000 (09:12 +0000)
ext/standard/php_smart_str.h

index 47ef596ebacb9850eebcef0ffd8d8a68880f038d..194cb04df2460d4a3eb104c4ec3c811d63d2094d 100644 (file)
@@ -22,7 +22,9 @@
 #include "php_smart_str_public.h"
 
 #include <stdlib.h>
+#ifndef SMART_STR_USE_REALLOC
 #include <zend.h>
+#endif
 
 #define smart_str_0(x) do { if ((x)->c) { (x)->c[(x)->len] = '\0'; } } while (0)
 
 #define SMART_STR_PREALLOC 128
 #endif
 
+#ifdef SMART_STR_USE_REALLOC
+#define SMART_STR_REALLOC(a,b,c) realloc((a),(b))
+#else
+#define SMART_STR_REALLOC(a,b,c) perealloc((a),(b),(c))
+#endif
+
 #define smart_str_alloc(d, n, what) {\
        if (!d->c) d->len = d->a = 0; \
        newlen = d->len + n; \
        if (newlen >= d->a) {\
-               d->c = perealloc(d->c, newlen + SMART_STR_PREALLOC + 1, what); \
+               d->c = SMART_STR_REALLOC(d->c, newlen + SMART_STR_PREALLOC + 1, what); \
                d->a = newlen + SMART_STR_PREALLOC; \
        }\
 }