cvs: php4(PHP_4_3) /ext/standard php_smart_str.h

From: Date: Wed, 16 Apr 2003 09:12:37 +0000
Subject: cvs: php4(PHP_4_3) /ext/standard php_smart_str.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20305@lists.php.net to get a copy of this message
sas Wed Apr 16 05:12:37 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/standard php_smart_str.h Log: Simplify use of this header in external apps Index: php4/ext/standard/php_smart_str.h diff -u php4/ext/standard/php_smart_str.h:1.22.4.1 php4/ext/standard/php_smart_str.h:1.22.4.2 --- php4/ext/standard/php_smart_str.h:1.22.4.1 Tue Dec 31 11:35:33 2002 +++ php4/ext/standard/php_smart_str.h Wed Apr 16 05:12:37 2003 @@ -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) @@ -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; \ }\ }

« previous php.cvs (#20305) next »