cvs: php4 /ext/standard php_smart_str.h
| From: | Sascha Schumann | Date: | Wed, 11 Jul 2001 23:13:55 +0000 |
| Subject: | cvs: php4 /ext/standard php_smart_str.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6195@lists.php.net to get a copy of this message | ||
sas Wed Jul 11 19:13:55 2001 EDT
Modified files:
/php4/ext/standard php_smart_str.h
Log:
Allow extensions to define custom prealloc sizes
Index: php4/ext/standard/php_smart_str.h
diff -u php4/ext/standard/php_smart_str.h:1.7 php4/ext/standard/php_smart_str.h:1.8
--- php4/ext/standard/php_smart_str.h:1.7 Mon Feb 26 01:07:23 2001
+++ php4/ext/standard/php_smart_str.h Wed Jul 11 19:13:55 2001
@@ -26,12 +26,16 @@
#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; \
}\
}