summaryrefslogtreecommitdiff
path: root/main/spprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/spprintf.c')
-rw-r--r--main/spprintf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/main/spprintf.c b/main/spprintf.c
index 6b15216aa..fef5b63f2 100644
--- a/main/spprintf.c
+++ b/main/spprintf.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spprintf.c 308525 2011-02-21 06:53:24Z cataphract $ */
+/* $Id: spprintf.c 314581 2011-08-09 02:37:02Z pierrick $ */
/* This is the spprintf implementation.
* It has emerged from apache snprintf. See original header:
@@ -119,8 +119,11 @@
* NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
*
* XXX: this is a magic number; do not decrease it
+ * Emax = 1023
+ * NDIG = 320
+ * NUM_BUF_SIZE >= strlen("-") + Emax + strlrn(".") + NDIG + strlen("E+1023") + 1;
*/
-#define NUM_BUF_SIZE 512
+#define NUM_BUF_SIZE 2048
/*
* The INS_CHAR macro inserts a character in the buffer.
@@ -195,7 +198,6 @@ static size_t strnlen(const char *s, size_t maxlen) {
static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) /* {{{ */
{
char *s = NULL;
- char *q;
int s_len, free_zcopy;
zval *zvp, zcopy;
@@ -676,7 +678,7 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap)
s_len = strlen(s);
- if (alternate_form && (q = strchr(s, '.')) == NULL)
+ if (alternate_form && (strchr(s, '.')) == NULL)
s[s_len++] = '.';
break;