@@ -213,33 +213,37 @@ zend_module_entry pspell_module_entry = {
213
213
ZEND_GET_MODULE (pspell )
214
214
#endif
215
215
216
- static void php_pspell_close (zend_rsrc_list_entry * rsrc TSRMLS_DC )
216
+ static void php_pspell_close (zend_resource * rsrc TSRMLS_DC )
217
217
{
218
218
PspellManager * manager = (PspellManager * )rsrc -> ptr ;
219
219
220
220
delete_pspell_manager (manager );
221
221
}
222
222
223
- static void php_pspell_close_config (zend_rsrc_list_entry * rsrc TSRMLS_DC )
223
+ static void php_pspell_close_config (zend_resource * rsrc TSRMLS_DC )
224
224
{
225
225
PspellConfig * config = (PspellConfig * )rsrc -> ptr ;
226
226
227
227
delete_pspell_config (config );
228
228
}
229
229
230
- #define PSPELL_FETCH_CONFIG \
231
- config = (PspellConfig *) zend_list_find(conf, &type); \
232
- if (config == NULL || type != le_pspell_config) { \
233
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", conf); \
234
- RETURN_FALSE; \
235
- } \
236
-
237
- #define PSPELL_FETCH_MANAGER \
238
- manager = (PspellManager *) zend_list_find(scin, &type); \
239
- if (!manager || type != le_pspell) { \
240
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", scin); \
241
- RETURN_FALSE; \
242
- } \
230
+ #define PSPELL_FETCH_CONFIG do { \
231
+ zval *res = zend_hash_index_find(&EG(regular_list), conf); \
232
+ if (res == NULL || Z_RES_P(res)->type != le_pspell_config) { \
233
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", conf); \
234
+ RETURN_FALSE; \
235
+ } \
236
+ config = (PspellConfig *)Z_RES_P(res)->ptr; \
237
+ } while (0)
238
+
239
+ #define PSPELL_FETCH_MANAGER do { \
240
+ zval *res = zend_hash_index_find(&EG(regular_list), scin); \
241
+ if (res == NULL || Z_RES_P(res)->type != le_pspell) { \
242
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", scin); \
243
+ RETURN_FALSE; \
244
+ } \
245
+ manager = (PspellManager *)Z_RES_P(res)->ptr; \
246
+ } while (0);
243
247
244
248
/* {{{ PHP_MINIT_FUNCTION
245
249
*/
@@ -263,7 +267,7 @@ static PHP_FUNCTION(pspell_new)
263
267
int language_len , spelling_len = 0 , jargon_len = 0 , encoding_len = 0 ;
264
268
long mode = 0L , speed = 0L ;
265
269
int argc = ZEND_NUM_ARGS ();
266
- int ind ;
270
+ zval * ind ;
267
271
268
272
#ifdef PHP_WIN32
269
273
TCHAR aspell_dir [200 ];
@@ -348,7 +352,7 @@ static PHP_FUNCTION(pspell_new)
348
352
349
353
manager = to_pspell_manager (ret );
350
354
ind = zend_list_insert (manager , le_pspell TSRMLS_CC );
351
- RETURN_LONG (ind );
355
+ RETURN_LONG (Z_RES_HANDLE_P ( ind ) );
352
356
}
353
357
/* }}} */
354
358
@@ -360,7 +364,7 @@ static PHP_FUNCTION(pspell_new_personal)
360
364
int personal_len , language_len , spelling_len = 0 , jargon_len = 0 , encoding_len = 0 ;
361
365
long mode = 0L , speed = 0L ;
362
366
int argc = ZEND_NUM_ARGS ();
363
- int ind ;
367
+ zval * ind ;
364
368
365
369
#ifdef PHP_WIN32
366
370
TCHAR aspell_dir [200 ];
@@ -453,16 +457,17 @@ static PHP_FUNCTION(pspell_new_personal)
453
457
454
458
manager = to_pspell_manager (ret );
455
459
ind = zend_list_insert (manager , le_pspell TSRMLS_CC );
456
- RETURN_LONG (ind );
460
+ RETURN_LONG (Z_RES_HANDLE_P ( ind ) );
457
461
}
458
462
/* }}} */
459
463
460
464
/* {{{ proto int pspell_new_config(int config)
461
465
Load a dictionary based on the given config */
462
466
static PHP_FUNCTION (pspell_new_config )
463
467
{
464
- int type , ind ;
468
+ int type ;
465
469
long conf ;
470
+ zval * ind ;
466
471
PspellCanHaveError * ret ;
467
472
PspellManager * manager ;
468
473
PspellConfig * config ;
@@ -483,7 +488,7 @@ static PHP_FUNCTION(pspell_new_config)
483
488
484
489
manager = to_pspell_manager (ret );
485
490
ind = zend_list_insert (manager , le_pspell TSRMLS_CC );
486
- RETURN_LONG (ind );
491
+ RETURN_LONG (Z_RES_HANDLE_P ( ind ) );
487
492
}
488
493
/* }}} */
489
494
@@ -685,7 +690,7 @@ static PHP_FUNCTION(pspell_config_create)
685
690
{
686
691
char * language , * spelling = NULL , * jargon = NULL , * encoding = NULL ;
687
692
int language_len , spelling_len = 0 , jargon_len = 0 , encoding_len = 0 ;
688
- int ind ;
693
+ zval * ind ;
689
694
PspellConfig * config ;
690
695
691
696
#ifdef PHP_WIN32
@@ -743,7 +748,7 @@ static PHP_FUNCTION(pspell_config_create)
743
748
pspell_config_replace (config , "save-repl" , "false" );
744
749
745
750
ind = zend_list_insert (config , le_pspell_config TSRMLS_CC );
746
- RETURN_LONG (ind );
751
+ RETURN_LONG (Z_RES_HANDLE_P ( ind ) );
747
752
}
748
753
/* }}} */
749
754
0 commit comments