]> granicus.if.org Git - php/commitdiff
Allow extensions to define custom prealloc sizes
authorSascha Schumann <sas@php.net>
Wed, 11 Jul 2001 23:13:55 +0000 (23:13 +0000)
committerSascha Schumann <sas@php.net>
Wed, 11 Jul 2001 23:13:55 +0000 (23:13 +0000)
ext/standard/php_smart_str.h

index 46d70a436a5c0f199cfe981eb157eaa26333784f..4681b4a6639cb2767088c39cd5808348f730f516 100644 (file)
 
 #define smart_str_0(x) ((x)->c[(x)->len] = '\0')
 
+#ifndef SMART_STR_PREALLOC
+#define SMART_STR_PREALLOC 128
+#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 + 129, what); \
-               d->a = newlen + 128; \
+               d->c = perealloc(d->c, newlen + SMART_STR_PREALLOC + 1, what); \
+               d->a = newlen + SMART_STR_PREALLOC; \
        }\
 }