From: Sascha Schumann Date: Wed, 16 Apr 2003 09:12:37 +0000 (+0000) Subject: Simplify use of this header in external apps X-Git-Tag: php-4.3.2RC2~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ba9ff7b17f51027051d30cb7150305b4b94f92a;p=php Simplify use of this header in external apps --- diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index 47ef596eba..194cb04df2 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -22,7 +22,9 @@ #include "php_smart_str_public.h" #include +#ifndef SMART_STR_USE_REALLOC #include +#endif #define smart_str_0(x) do { if ((x)->c) { (x)->c[(x)->len] = '\0'; } } while (0) @@ -30,11 +32,17 @@ #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; \ }\ }