From: Antony Dovgal Date: Wed, 20 Dec 2006 15:14:37 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.4.5RC1~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5cf4ead3549f8b5e95bb5f3d479a07e0f5e68b8;p=php MFH --- diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index 3f5c07d413..2bcdf2fe83 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -705,8 +705,7 @@ PHP_FUNCTION(pspell_config_ignore) zval **conf, **pignore; int argc; - int loc = PSPELL_LARGEST_WORD; - char ignore_str[PSPELL_LARGEST_WORD + 1]; + char ignore_str[MAX_LENGTH_OF_LONG + 1]; long ignore = 0L; PspellConfig *config; @@ -721,23 +720,9 @@ PHP_FUNCTION(pspell_config_ignore) convert_to_long_ex(pignore); ignore = Z_LVAL_PP(pignore); - /* The following is a very hackish way to convert a long to a string - (actually only the numbers 0-999 will get converted properly, but that should - be sufficient). If anyone knows of a better way to convert an integer to a string, - please, fix it.*/ - ignore_str[loc] = '\0'; - while(ignore > 0){ - if(loc == 0){ - break; - } - ignore_str[--loc] = '0' + (ignore % 10); - ignore /= 10; - } - if(ignore_str[loc] == '\0'){ - ignore_str[--loc] = '0'; - } + sprintf(ignore_str, "%ld", ignore); - pspell_config_replace(config, "ignore", &ignore_str[loc]); + pspell_config_replace(config, "ignore", ignore_str); RETURN_TRUE; } /* }}} */