diff options
| author | Antony Dovgal <tony2001@php.net> | 2006-12-20 15:12:38 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2006-12-20 15:12:38 +0000 |
| commit | 40f6288fa30a26ae14dbdcbc759fffbb3e0709c2 (patch) | |
| tree | 251da321cbe44d4a244d73be35e9ab3c8c63fdaa /ext | |
| parent | a9d0abf82c716f32b472d4d78fbfd2fd11f372b0 (diff) | |
| download | php-git-40f6288fa30a26ae14dbdcbc759fffbb3e0709c2.tar.gz | |
MFH
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/pspell/pspell.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index be4076fc3a..1af1ba0048 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -751,8 +751,7 @@ static 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; @@ -767,23 +766,9 @@ static 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; } /* }}} */ |
