summaryrefslogtreecommitdiff
path: root/ext/pspell/pspell.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-06-27 02:58:13 +0000
committerFelipe Pena <felipe@php.net>2008-06-27 02:58:13 +0000
commitfe0403d30d39c74add75abb676fdf9310e4f109a (patch)
tree7e0c7c03918f58a4c4f874c07a6d0e88fa41547e /ext/pspell/pspell.c
parent37c684ab3da9899046c221e207074f91cd405800 (diff)
downloadphp-git-fe0403d30d39c74add75abb676fdf9310e4f109a.tar.gz
- New parameter parsing API
Diffstat (limited to 'ext/pspell/pspell.c')
-rw-r--r--ext/pspell/pspell.c329
1 files changed, 132 insertions, 197 deletions
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 2141811c05..cb8455c6c3 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -124,18 +124,16 @@ static void php_pspell_close_config(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
#define PSPELL_FETCH_CONFIG \
- convert_to_long_ex(conf); \
- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), &type); \
+ config = (PspellConfig *) zend_list_find(conf, &type); \
if (config == NULL || type != le_pspell_config) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(conf)); \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", conf); \
RETURN_FALSE; \
} \
#define PSPELL_FETCH_MANAGER \
- convert_to_long_ex(scin); \
- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); \
+ manager = (PspellManager *) zend_list_find(scin, &type); \
if (!manager || type != le_pspell) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin)); \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", scin); \
RETURN_FALSE; \
} \
@@ -157,9 +155,10 @@ static PHP_MINIT_FUNCTION(pspell)
Load a dictionary */
static PHP_FUNCTION(pspell_new)
{
- zval **language,**spelling,**jargon,**encoding,**pmode;
+ char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
+ int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
long mode = 0L, speed = 0L;
- int argc;
+ int argc = ZEND_NUM_ARGS();
int ind;
#ifdef PHP_WIN32
@@ -174,9 +173,9 @@ static PHP_FUNCTION(pspell_new)
PspellManager *manager;
PspellConfig *config;
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding,&pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(argc TSRMLS_CC, "s|sssl", &language, &language_len, &spelling, &spelling_len,
+ &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) {
+ return;
}
config = new_pspell_config();
@@ -202,33 +201,21 @@ static PHP_FUNCTION(pspell_new)
}
#endif
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
+ pspell_config_replace(config, "language-tag", language);
- if(argc > 1){
- convert_to_string_ex(spelling);
- if(Z_STRLEN_PP(spelling) > 0){
- pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling));
- }
+ if (spelling_len) {
+ pspell_config_replace(config, "spelling", spelling);
}
- if(argc > 2){
- convert_to_string_ex(jargon);
- if(Z_STRLEN_PP(jargon) > 0){
- pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon));
- }
+ if (jargon_len) {
+ pspell_config_replace(config, "jargon", jargon);
}
- if(argc > 3){
- convert_to_string_ex(encoding);
- if(Z_STRLEN_PP(encoding) > 0){
- pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding));
- }
+ if (encoding_len) {
+ pspell_config_replace(config, "encoding", encoding);
}
- if(argc > 4){
- convert_to_long_ex(pmode);
- mode = Z_LVAL_PP(pmode);
+ if (argc > 4) {
speed = mode & PSPELL_SPEED_MASK_INTERNAL;
/* First check what mode we want (how many suggestions) */
@@ -265,9 +252,10 @@ static PHP_FUNCTION(pspell_new)
Load a dictionary with a personal wordlist*/
static PHP_FUNCTION(pspell_new_personal)
{
- zval **personal, **language,**spelling,**jargon,**encoding,**pmode;
+ char *personal, *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
+ int personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
long mode = 0L, speed = 0L;
- int argc;
+ int argc = ZEND_NUM_ARGS();
int ind;
#ifdef PHP_WIN32
@@ -281,10 +269,10 @@ static PHP_FUNCTION(pspell_new_personal)
PspellCanHaveError *ret;
PspellManager *manager;
PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 6 || zend_get_parameters_ex(argc,&personal,&language,&spelling,&jargon,&encoding,&pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
+
+ if (zend_parse_parameters(argc TSRMLS_CC, "ss|sssl", &personal, &personal_len, &language, &language_len,
+ &spelling, &spelling_len, &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) {
+ return;
}
config = new_pspell_config();
@@ -310,48 +298,34 @@ static PHP_FUNCTION(pspell_new_personal)
}
#endif
- convert_to_string_ex(personal);
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(personal), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (PG(safe_mode) && (!php_checkuid(personal, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
delete_pspell_config(config);
RETURN_FALSE;
}
- if (php_check_open_basedir(Z_STRVAL_PP(personal) TSRMLS_CC)) {
+ if (php_check_open_basedir(personal TSRMLS_CC)) {
delete_pspell_config(config);
RETURN_FALSE;
}
- pspell_config_replace(config, "personal", Z_STRVAL_PP(personal));
+ pspell_config_replace(config, "personal", personal);
pspell_config_replace(config, "save-repl", "false");
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
+ pspell_config_replace(config, "language-tag", language);
- if(argc > 2){
- convert_to_string_ex(spelling);
- if(Z_STRLEN_PP(spelling) > 0){
- pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling));
- }
+ if (spelling_len) {
+ pspell_config_replace(config, "spelling", spelling);
}
- if(argc > 3){
- convert_to_string_ex(jargon);
- if(Z_STRLEN_PP(jargon) > 0){
- pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon));
- }
+ if (jargon_len) {
+ pspell_config_replace(config, "jargon", jargon);
}
- if(argc > 4){
- convert_to_string_ex(encoding);
- if(Z_STRLEN_PP(encoding) > 0){
- pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding));
- }
+ if (encoding_len) {
+ pspell_config_replace(config, "encoding", encoding);
}
- if(argc > 5){
- convert_to_long_ex(pmode);
- mode = Z_LVAL_PP(pmode);
+ if (argc > 5) {
speed = mode & PSPELL_SPEED_MASK_INTERNAL;
/* First check what mode we want (how many suggestions) */
@@ -388,18 +362,15 @@ static PHP_FUNCTION(pspell_new_personal)
Load a dictionary based on the given config */
static PHP_FUNCTION(pspell_new_config)
{
- int type;
- zval **conf;
- int argc;
- int ind;
+ int type, ind;
+ long conf;
PspellCanHaveError *ret;
PspellManager *manager;
PspellConfig *config;
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc,&conf) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &conf) == FAILURE) {
+ return;
}
PSPELL_FETCH_CONFIG;
@@ -422,23 +393,20 @@ static PHP_FUNCTION(pspell_new_config)
Returns true if word is valid */
static PHP_FUNCTION(pspell_check)
{
- int type;
- zval **scin,**word;
+ int type, word_len;
+ long scin;
+ char *word;
PspellManager *manager;
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(word);
PSPELL_FETCH_MANAGER;
- if(pspell_manager_check(manager, Z_STRVAL_PP(word))){
+ if (pspell_manager_check(manager, word)) {
RETURN_TRUE;
- }else{
+ } else {
RETURN_FALSE;
}
}
@@ -448,24 +416,23 @@ static PHP_FUNCTION(pspell_check)
Returns array of suggestions */
static PHP_FUNCTION(pspell_suggest)
{
- zval **scin, **word;
- int argc;
+ long scin;
+ char *word;
+ int word_len;
PspellManager *manager;
int type;
const PspellWordList *wl;
const char *sug;
- argc = ZEND_NUM_ARGS();
- if(argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(word);
+
PSPELL_FETCH_MANAGER;
array_init(return_value);
- wl = pspell_manager_suggest(manager, Z_STRVAL_PP(word));
+ wl = pspell_manager_suggest(manager, word);
if(wl){
PspellStringEmulation *els = pspell_word_list_elements(wl);
while((sug = pspell_string_emulation_next(els)) != 0){
@@ -483,21 +450,18 @@ static PHP_FUNCTION(pspell_suggest)
Notify the dictionary of a user-selected replacement */
static PHP_FUNCTION(pspell_store_replacement)
{
- int type;
- zval **scin,**miss,**corr;
+ int type, miss_len, corr_len;
+ long scin;
+ char *miss, *corr;
PspellManager *manager;
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 3 || zend_get_parameters_ex(argc, &scin,&miss,&corr) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(miss);
- convert_to_string_ex(corr);
+
PSPELL_FETCH_MANAGER;
- pspell_manager_store_replacement(manager, Z_STRVAL_PP(miss), Z_STRVAL_PP(corr));
+ pspell_manager_store_replacement(manager, miss, corr);
if(pspell_manager_error_number(manager) == 0){
RETURN_TRUE;
}else{
@@ -511,25 +475,23 @@ static PHP_FUNCTION(pspell_store_replacement)
Adds a word to a personal list */
static PHP_FUNCTION(pspell_add_to_personal)
{
- int type;
- zval **scin,**word;
+ int type, word_len;
+ long scin;
+ char *word;
PspellManager *manager;
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(word);
+
PSPELL_FETCH_MANAGER;
/*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
- if(Z_STRLEN_PP(word) == 0){
+ if (word_len == 0){
RETURN_FALSE;
}
- pspell_manager_add_to_personal(manager, Z_STRVAL_PP(word));
+ pspell_manager_add_to_personal(manager, word);
if(pspell_manager_error_number(manager) == 0){
RETURN_TRUE;
}else{
@@ -543,25 +505,23 @@ static PHP_FUNCTION(pspell_add_to_personal)
Adds a word to the current session */
static PHP_FUNCTION(pspell_add_to_session)
{
- int type;
- zval **scin,**word;
+ int type, word_len;
+ long scin;
+ char *word;
PspellManager *manager;
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(word);
+
PSPELL_FETCH_MANAGER;
/*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
- if(Z_STRLEN_PP(word) == 0){
+ if (word_len == 0){
RETURN_FALSE;
}
- pspell_manager_add_to_session(manager, Z_STRVAL_PP(word));
+ pspell_manager_add_to_session(manager, word);
if(pspell_manager_error_number(manager) == 0){
RETURN_TRUE;
}else{
@@ -576,13 +536,11 @@ static PHP_FUNCTION(pspell_add_to_session)
static PHP_FUNCTION(pspell_clear_session)
{
int type;
- zval **scin;
+ long scin;
PspellManager *manager;
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) {
+ return;
}
PSPELL_FETCH_MANAGER;
@@ -602,13 +560,11 @@ static PHP_FUNCTION(pspell_clear_session)
static PHP_FUNCTION(pspell_save_wordlist)
{
int type;
- zval **scin;
+ long scin;
PspellManager *manager;
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) {
+ return;
}
PSPELL_FETCH_MANAGER;
@@ -629,8 +585,8 @@ static PHP_FUNCTION(pspell_save_wordlist)
Create a new config to be used later to create a manager */
static PHP_FUNCTION(pspell_config_create)
{
- zval **language,**spelling,**jargon,**encoding;
- int argc;
+ char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
+ int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
int ind;
PspellConfig *config;
@@ -643,9 +599,9 @@ static PHP_FUNCTION(pspell_config_create)
DWORD dwType,dwLen;
#endif
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 4 || zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sss", &language, &language_len, &spelling, &spelling_len,
+ &jargon, &jargon_len, &encoding, &encoding_len) == FAILURE) {
+ return;
}
config = new_pspell_config();
@@ -671,28 +627,18 @@ static PHP_FUNCTION(pspell_config_create)
}
#endif
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
+ pspell_config_replace(config, "language-tag", language);
- if(argc > 1){
- convert_to_string_ex(spelling);
- if(Z_STRLEN_PP(spelling) > 0){
- pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling));
- }
+ if (spelling_len) {
+ pspell_config_replace(config, "spelling", spelling);
}
- if(argc > 2){
- convert_to_string_ex(jargon);
- if(Z_STRLEN_PP(jargon) > 0){
- pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon));
- }
+ if (jargon_len){
+ pspell_config_replace(config, "jargon", jargon);
}
- if(argc > 3){
- convert_to_string_ex(encoding);
- if(Z_STRLEN_PP(encoding) > 0){
- pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding));
- }
+ if (encoding_len) {
+ pspell_config_replace(config, "encoding", encoding);
}
/* By default I do not want to write anything anywhere because it'll try to write to $HOME
@@ -709,20 +655,20 @@ static PHP_FUNCTION(pspell_config_create)
static PHP_FUNCTION(pspell_config_runtogether)
{
int type;
- zval **conf, **runtogether;
+ long conf;
+ zend_bool runtogether;
int argc;
PspellConfig *config;
argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&conf,&runtogether) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &runtogether) == FAILURE) {
+ return;
}
PSPELL_FETCH_CONFIG;
- convert_to_boolean_ex(runtogether);
- pspell_config_replace(config, "run-together", Z_LVAL_PP(runtogether) ? "true" : "false");
+ pspell_config_replace(config, "run-together", runtogether ? "true" : "false");
RETURN_TRUE;
}
@@ -733,26 +679,22 @@ static PHP_FUNCTION(pspell_config_runtogether)
static PHP_FUNCTION(pspell_config_mode)
{
int type;
- zval **conf, **mode;
- int argc;
+ long conf, mode;
PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&conf,&mode) == FAILURE) {
- WRONG_PARAM_COUNT;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &mode) == FAILURE) {
+ return;
}
PSPELL_FETCH_CONFIG;
- convert_to_long_ex(mode);
-
/* First check what mode we want (how many suggestions) */
- if(Z_LVAL_PP(mode) == PSPELL_FAST){
+ if (mode == PSPELL_FAST){
pspell_config_replace(config, "sug-mode", "fast");
- }else if(Z_LVAL_PP(mode) == PSPELL_NORMAL){
+ }else if (mode == PSPELL_NORMAL){
pspell_config_replace(config, "sug-mode", "normal");
- }else if(Z_LVAL_PP(mode) == PSPELL_BAD_SPELLERS){
+ }else if (mode == PSPELL_BAD_SPELLERS){
pspell_config_replace(config, "sug-mode", "bad-spellers");
}
@@ -765,7 +707,7 @@ static PHP_FUNCTION(pspell_config_mode)
static PHP_FUNCTION(pspell_config_ignore)
{
int type;
- zval **conf, **pignore;
+ long conf, pignore;
int argc;
char ignore_str[MAX_LENGTH_OF_LONG + 1];
@@ -774,14 +716,13 @@ static PHP_FUNCTION(pspell_config_ignore)
PspellConfig *config;
argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&conf,&pignore) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &pignore) == FAILURE) {
+ return;
}
PSPELL_FETCH_CONFIG;
- convert_to_long_ex(pignore);
- ignore = Z_LVAL_PP(pignore);
+ ignore = pignore;
snprintf(ignore_str, sizeof(ignore_str), "%ld", ignore);
@@ -793,28 +734,26 @@ static PHP_FUNCTION(pspell_config_ignore)
static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option)
{
int type;
- zval **conf, **value;
- int argc;
+ long conf;
+ char *value;
+ int value_len;
PspellConfig *config;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &conf, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &conf, &value, &value_len) == FAILURE) {
+ return;
}
PSPELL_FETCH_CONFIG;
- convert_to_string_ex(value);
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(value), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (PG(safe_mode) && (!php_checkuid(value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
- if (php_check_open_basedir(Z_STRVAL_PP(value) TSRMLS_CC)) {
+ if (php_check_open_basedir(value TSRMLS_CC)) {
RETURN_FALSE;
}
- pspell_config_replace(config, option, Z_STRVAL_PP(value));
+ pspell_config_replace(config, option, value);
RETURN_TRUE;
}
@@ -848,31 +787,29 @@ static PHP_FUNCTION(pspell_config_data_dir)
static PHP_FUNCTION(pspell_config_repl)
{
int type;
- zval **conf, **repl;
- int argc;
+ long conf;
+ char *repl;
+ int repl_len;
PspellConfig *config;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&conf,&repl) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &conf, &repl, &repl_len) == FAILURE) {
+ return;
}
PSPELL_FETCH_CONFIG;
pspell_config_replace(config, "save-repl", "true");
- convert_to_string_ex(repl);
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(repl), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (PG(safe_mode) && (!php_checkuid(repl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
- if (php_check_open_basedir(Z_STRVAL_PP(repl) TSRMLS_CC)) {
+ if (php_check_open_basedir(repl TSRMLS_CC)) {
RETURN_FALSE;
}
- pspell_config_replace(config, "repl", Z_STRVAL_PP(repl));
+ pspell_config_replace(config, "repl", repl);
RETURN_TRUE;
}
@@ -883,20 +820,18 @@ static PHP_FUNCTION(pspell_config_repl)
static PHP_FUNCTION(pspell_config_save_repl)
{
int type;
- zval **conf, **save;
- int argc;
+ long conf;
+ zend_bool save;
PspellConfig *config;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&conf,&save) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &save) == FAILURE) {
+ return;
}
PSPELL_FETCH_CONFIG;
- convert_to_boolean_ex(save);
- pspell_config_replace(config, "save-repl", Z_LVAL_PP(save) ? "true" : "false");
+ pspell_config_replace(config, "save-repl", save ? "true" : "false");
RETURN_TRUE;
}