cvs commit
| From: | zeev | Date: | Fri, 09 Jul 1999 13:36:12 +0000 |
| Subject: | cvs commit | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-1953@lists.php.net to get a copy of this message | ||
From: zeev
Date: Fri Jul 9 13:36:12 1999
Modified files:
php4/configuration-parser.y
php4/ext/pcre/php_pcre.c
php4/ext/standard/basic_functions.c
php4/ext/standard/reg.c
Log message:
Step 1 in nuking the garbage collector:
- Change the hash destructor to return int
Index: php4/configuration-parser.y
diff -u php4/configuration-parser.y:1.14 php4/configuration-parser.y:1.15
--- php4/configuration-parser.y:1.14 Sat Jun 19 09:18:46 1999
+++ php4/configuration-parser.y Fri Jul 9 13:36:11 1999
@@ -30,7 +30,7 @@
-/* $Id: configuration-parser.y,v 1.14 1999/06/19 13:18:46 zeev Exp $ */
+/* $Id: configuration-parser.y,v 1.15 1999/07/09 17:36:11 zeev Exp $ */
#define DEBUG_CFG_PARSER 1
#include "php.h"
@@ -138,20 +138,22 @@
}
-static void pvalue_config_destructor(pval *pvalue)
+static int pvalue_config_destructor(pval *pvalue)
{
if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) {
free(pvalue->value.str.val);
}
+ return 1;
}
-static void pvalue_browscap_destructor(pval *pvalue)
+static int pvalue_browscap_destructor(pval *pvalue)
{
if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) {
_php3_hash_destroy(pvalue->value.ht);
free(pvalue->value.ht);
}
+ return 1;
}
@@ -159,7 +161,7 @@
{
PLS_FETCH();
- if (_php3_hash_init(&configuration_hash, 0, NULL, (void (*)(void *))pvalue_config_destructor,
1)==FAILURE) {
+ if (_php3_hash_init(&configuration_hash, 0, NULL, (int (*)(void *))pvalue_config_destructor,
1)==FAILURE) {
return FAILURE;
}
@@ -258,7 +260,7 @@
char *browscap = INI_STR("browscap");
if (browscap) {
- if (_php3_hash_init(&browser_hash, 0, NULL, (void (*)(void *))pvalue_browscap_destructor,
1)==FAILURE) {
+ if (_php3_hash_init(&browser_hash, 0, NULL, (int (*)(void *))pvalue_browscap_destructor,
1)==FAILURE) {
return FAILURE;
}
@@ -411,7 +413,7 @@
/*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
tmp.value.ht = (HashTable *) malloc(sizeof(HashTable));
- _php3_hash_init(tmp.value.ht, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1);
+ _php3_hash_init(tmp.value.ht, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1);
tmp.type = IS_OBJECT;
_php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, (void *)
&tmp, sizeof(pval), (void **) ¤t_section);
tmp.value.str.val = php3_strndup($1.value.str.val,$1.value.str.len);
Index: php4/ext/pcre/php_pcre.c
diff -u php4/ext/pcre/php_pcre.c:1.3 php4/ext/pcre/php_pcre.c:1.4
--- php4/ext/pcre/php_pcre.c:1.3 Thu Jul 8 17:42:29 1999
+++ php4/ext/pcre/php_pcre.c Fri Jul 9 13:36:12 1999
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcre.c,v 1.3 1999/07/08 21:42:29 andrey Exp $ */
+/* $Id: php_pcre.c,v 1.4 1999/07/09 17:36:12 zeev Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -84,10 +84,11 @@
}
-static void _php_free_pcre_cache(void *data)
+static int _php_free_pcre_cache(void *data)
{
pcre_cache_entry *pce = (pcre_cache_entry *) data;
pefree(pce->re, 1);
+ return 1;
}
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.38 php4/ext/standard/basic_functions.c:1.39
--- php4/ext/standard/basic_functions.c:1.38 Mon Jul 5 03:42:07 1999
+++ php4/ext/standard/basic_functions.c Fri Jul 9 13:36:12 1999
@@ -64,7 +64,7 @@
static HashTable *user_shutdown_function_names;
/* some prototypes for local functions */
-void user_shutdown_function_dtor(pval *user_shutdown_function_name);
+int user_shutdown_function_dtor(pval *user_shutdown_function_name);
int user_shutdown_function_executor(pval *user_shutdown_function_name);
void php3_call_shutdown_functions(void);
@@ -332,7 +332,7 @@
#ifdef HAVE_PUTENV
static HashTable putenv_ht;
-static void _php3_putenv_destructor(putenv_entry *pe)
+static int _php3_putenv_destructor(putenv_entry *pe)
{
if (pe->previous_value) {
putenv(pe->previous_value);
@@ -352,6 +352,7 @@
}
efree(pe->putenv_string);
efree(pe->key);
+ return 1;
}
#endif
@@ -395,7 +396,7 @@
{
strtok_string = NULL;
#ifdef HAVE_PUTENV
- if (_php3_hash_init(&putenv_ht, 1, NULL, (void (*)(void *)) _php3_putenv_destructor, 0) ==
FAILURE) {
+ if (_php3_hash_init(&putenv_ht, 1, NULL, (int (*)(void *)) _php3_putenv_destructor, 0) ==
FAILURE) {
return FAILURE;
}
#endif
@@ -1776,7 +1777,7 @@
}
-void user_shutdown_function_dtor(pval *user_shutdown_function_name)
+int user_shutdown_function_dtor(pval *user_shutdown_function_name)
{
pval retval;
CLS_FETCH();
@@ -1785,6 +1786,7 @@
pval_destructor(&retval);
}
pval_destructor(user_shutdown_function_name);
+ return 1;
}
@@ -1809,7 +1811,7 @@
convert_to_string(arg);
if (!user_shutdown_function_names) {
user_shutdown_function_names = (HashTable *) emalloc(sizeof(HashTable));
- _php3_hash_init(user_shutdown_function_names, 0, NULL, (void (*)(void
*))user_shutdown_function_dtor, 0);
+ _php3_hash_init(user_shutdown_function_names, 0, NULL, (int (*)(void
*))user_shutdown_function_dtor, 0);
}
shutdown_function_name = *arg;
Index: php4/ext/standard/reg.c
diff -u php4/ext/standard/reg.c:1.15 php4/ext/standard/reg.c:1.16
--- php4/ext/standard/reg.c:1.15 Mon Jun 21 19:07:46 1999
+++ php4/ext/standard/reg.c Fri Jul 9 13:36:12 1999
@@ -28,7 +28,7 @@
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.15 1999/06/21 23:07:46 andrey Exp $ */
+/* $Id: reg.c,v 1.16 1999/07/09 17:36:12 zeev Exp $ */
#include <stdio.h>
#include "php.h"
@@ -98,9 +98,10 @@
return r;
}
-static void _free_reg_cache(reg_cache *rc)
+static int _free_reg_cache(reg_cache *rc)
{
regfree(&rc->preg);
+ return 1;
}
#define regfree(a);
@@ -108,7 +109,7 @@
static void php_reg_init_globals(php_reg_globals *reg_globals)
{
- _php3_hash_init(®_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1);
+ _php3_hash_init(®_globals->ht_rc, 0, NULL, (int (*)(void *)) _free_reg_cache, 1);
}
static int php_minit_regex(INIT_FUNC_ARGS)