cvs: php-src(PHP_4_4) /ext/pspell pspell.c

From: Date: Wed, 20 Dec 2006 15:14:37 +0000
Subject: cvs: php-src(PHP_4_4) /ext/pspell pspell.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-42221@lists.php.net to get a copy of this message
tony2001 Wed Dec 20 15:14:37 2006 UTC Modified files: (Branch: PHP_4_4) /php-src/ext/pspell pspell.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/pspell.c?r1=1.28.8.5.4.3&r2=1.28.8.5.4.4&diff_format=u Index: php-src/ext/pspell/pspell.c diff -u php-src/ext/pspell/pspell.c:1.28.8.5.4.3 php-src/ext/pspell/pspell.c:1.28.8.5.4.4 --- php-src/ext/pspell/pspell.c:1.28.8.5.4.3 Sun Jan 1 13:46:56 2006 +++ php-src/ext/pspell/pspell.c Wed Dec 20 15:14:37 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pspell.c,v 1.28.8.5.4.3 2006/01/01 13:46:56 sniper Exp $ */ +/* $Id: pspell.c,v 1.28.8.5.4.4 2006/12/20 15:14:37 tony2001 Exp $ */ #define IS_EXT_MODULE @@ -705,8 +705,7 @@ 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 @@ 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; } /* }}} */

« previous php.cvs (#42221) next »