cvs: pecl /hidef frozenarray.c hidef.c
| From: | Gopal Vijayaraghavan | Date: | Fri, 26 Sep 2008 14:47:01 +0000 |
| Subject: | cvs: pecl /hidef frozenarray.c hidef.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-11389@lists.php.net to get a copy of this message | ||
gopalv Fri Sep 26 14:47:01 2008 UTC
Modified files:
/pecl/hidef frozenarray.c hidef.c
Log:
Bug 14707 - patch from felipe to fix TSRM issues + cleanup
http://cvs.php.net/viewvc.cgi/pecl/hidef/frozenarray.c?r1=1.8&r2=1.9&diff_format=u
Index: pecl/hidef/frozenarray.c
diff -u pecl/hidef/frozenarray.c:1.8 pecl/hidef/frozenarray.c:1.9
--- pecl/hidef/frozenarray.c:1.8 Thu Sep 25 17:09:14 2008
+++ pecl/hidef/frozenarray.c Fri Sep 26 14:47:01 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: frozenarray.c,v 1.8 2008/09/25 17:09:14 gopalv Exp $ */
+/* $Id: frozenarray.c,v 1.9 2008/09/26 14:47:01 gopalv Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -108,7 +108,7 @@
frozen_array_object *intern = (frozen_array_object*) object;
frozen_array_object *clone = NULL;
- clone = frozen_array_object_new(intern->zo.ce);
+ clone = frozen_array_object_new(intern->zo.ce TSRMLS_CC);
/* move data across */
@@ -118,8 +118,6 @@
static void frozen_array_object_dtor(void *object, zend_object_handle handle TSRMLS_DC)
{
- frozen_array_object *intern = (frozen_array_object*) object;
-
/* nothing to do yet */
}
@@ -247,7 +245,7 @@
{
if(zend_hash_find(Z_ARRVAL_P(intern->data), Z_STRVAL_P(zindex), Z_STRLEN_P(zindex)+1,
(void**)(&hentry)) != FAILURE)
{
- retval = frozen_array_wrap_zval(hentry[0]);
+ retval = frozen_array_wrap_zval(hentry[0] TSRMLS_CC);
RETURN_ZVAL(retval, 0, 1);
}
}
@@ -255,7 +253,7 @@
{
if(zend_hash_index_find(Z_ARRVAL_P(intern->data), Z_LVAL_P(zindex), (void**)(&hentry)) !=
FAILURE)
{
- retval = frozen_array_wrap_zval(hentry[0]);
+ retval = frozen_array_wrap_zval(hentry[0] TSRMLS_CC);
RETURN_ZVAL(retval, 0, 1);
}
}
@@ -339,8 +337,6 @@
static void frozen_array_it_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
{
zval **hentry;
- zval *retval;
- zval **pretval;
frozen_array_it *iterator = (frozen_array_it*)(iter);
frozen_array_object *obj = iterator->object;
@@ -348,7 +344,7 @@
if(zend_hash_get_current_data_ex(Z_ARRVAL_P(obj->data), (void**)(&hentry),
&(iterator->pos)) != FAILURE)
{
if(iterator->current) zval_ptr_dtor(&iterator->current);
- iterator->current = frozen_array_wrap_zval(hentry[0]);
+ iterator->current = frozen_array_wrap_zval(hentry[0] TSRMLS_CC);
*data = &(iterator->current);
}
}
http://cvs.php.net/viewvc.cgi/pecl/hidef/hidef.c?r1=1.10&r2=1.11&diff_format=u
Index: pecl/hidef/hidef.c
diff -u pecl/hidef/hidef.c:1.10 pecl/hidef/hidef.c:1.11
--- pecl/hidef/hidef.c:1.10 Wed Aug 20 13:42:58 2008
+++ pecl/hidef/hidef.c Fri Sep 26 14:47:01 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hidef.c,v 1.10 2008/08/20 13:42:58 gopalv Exp $ */
+/* $Id: hidef.c,v 1.11 2008/09/26 14:47:01 gopalv Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -34,7 +34,7 @@
#include "php_hidef.h"
#include "frozenarray.h"
-typedef int (*hidef_walk_dir_cb)(const char* filename, void* ctxt);
+typedef int (*hidef_walk_dir_cb)(const char* filename, void* ctxt TSRMLS_DC);
/* {{{ stupid stringifcation */
#if DEFAULT_SLASH == '/'
@@ -219,7 +219,6 @@
/* {{{ hidef_ini_53parser_cb */
static void hidef_ini_53parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg
TSRMLS_DC)
{
- char *p;
char *key;
hidef_parser_ctxt * ctxt = (hidef_parser_ctxt*)arg;
@@ -257,7 +256,7 @@
}
else if(ctxt->type != IS_NULL && arg2)
{
- hidef_define_constant(key, arg2, ctxt);
+ hidef_define_constant(key, arg2, ctxt TSRMLS_CC);
ctxt->type = IS_NULL;
}
}
@@ -335,7 +334,7 @@
return;
}
- hidef_define_constant(p+1, arg2, ctxt);
+ hidef_define_constant(p+1, arg2, ctxt TSRMLS_CC);
}
break;
@@ -367,7 +366,6 @@
char file[MAXPATHLEN]={0,};
int ndir, i, k;
char *p = NULL;
- struct stat sb;
struct dirent **namelist = NULL;
if ((ndir = php_scandir(path, &namelist, 0, php_alphasort)) > 0)
@@ -383,7 +381,7 @@
}
snprintf(file, MAXPATHLEN, "%s%c%s",
path, DEFAULT_SLASH, namelist[i]->d_name);
- if(!cb(file, ctxt))
+ if(!cb(file, ctxt TSRMLS_CC))
{
goto cleanup;
}
@@ -406,7 +404,7 @@
/* }}} */
/* {{{ hidef_parse_ini */
-static int hidef_parse_ini(const char *ini_file, void* pctxt)
+static int hidef_parse_ini(const char *ini_file, void* pctxt TSRMLS_DC)
{
struct stat sb;
zend_file_handle fh = {0,};
@@ -450,17 +448,13 @@
return 0;
}
- return hidef_walk_dir(ini_path, ".ini", hidef_parse_ini, ctxt);
+ return hidef_walk_dir(ini_path, ".ini", hidef_parse_ini, ctxt TSRMLS_CC);
}
/* }}} */
-static int foo = 1;
-
/* {{{ hidef_load_data */
-static int hidef_load_data(const char *data_file, void* pctxt)
+static int hidef_load_data(const char *data_file, void* pctxt TSRMLS_DC)
{
- struct stat sb;
- hidef_parser_ctxt *ctxt = (hidef_parser_ctxt*)pctxt;
char *p;
char key[MAXPATHLEN] = {0,};
unsigned int key_len;
@@ -478,7 +472,7 @@
p[0] = '\0';
key_len = strlen(key);
- data = frozen_array_unserialize(data_file);
+ data = frozen_array_unserialize(data_file TSRMLS_CC);
if(zend_hash_add(hidef_data_hash, key, key_len+1, &data, sizeof(void*), NULL) == FAILURE)
{
@@ -506,7 +500,7 @@
return 0;
}
- return hidef_walk_dir(data_path, ".data", hidef_load_data, ctxt);
+ return hidef_walk_dir(data_path, ".data", hidef_load_data, ctxt TSRMLS_CC);
}
/* }}} */
@@ -623,23 +617,22 @@
*/
PHP_FUNCTION(hidef_fetch)
{
- zval **hentry;
+ zval **hentry;
zval *wrapped;
- char *strkey;
- int strkey_len;
- time_t t;
-
+ char *strkey;
+ int strkey_len;
+
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &strkey, &strkey_len)
== FAILURE)
{
return;
- }
+ }
if(zend_hash_find(hidef_data_hash, strkey, strkey_len+1, (void**)&hentry) == FAILURE)
{
return;
}
- wrapped = frozen_array_wrap_zval(hentry[0]);
+ wrapped = frozen_array_wrap_zval(hentry[0] TSRMLS_CC);
RETURN_ZVAL(wrapped, 0, 1);
}