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

index 8622a2efab6bf3d852b2ea911ec05f9a7ff2c6b6..8ee845079a4733802762dd0235bed50157d30c95 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) {                                                                                                   \
 #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_alloc4(d, n, what, newlen) do {                                      \
        if (!(d)->c) (d)->len = (d)->a = 0;                                                             \
        newlen = (d)->len + (n);                                                                                \
        if (newlen >= (d)->a) {                                                                                 \
                (d)->a = newlen + SMART_STR_PREALLOC;                                           \
-               (d)->c = perealloc((d)->c, (d)->a + 1, (what));                         \
+               (d)->c = SMART_STR_REALLOC((d)->c, (d)->a + 1, (what));         \
        }                                                                                                                               \
 } while (0)