summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-12-24 17:39:27 +0000
committerAndi Gutmans <andi@php.net>1999-12-24 17:39:27 +0000
commit3bf1b04cb45a6b9c6ddbf81d74804a582f6361c0 (patch)
tree6877a95133675e50757726515246ca7e0ded8d6e
parente28aff2f7aa02824142bf425b65c74b0bcd9622a (diff)
downloadphp-git-3bf1b04cb45a6b9c6ddbf81d74804a582f6361c0.tar.gz
- Move more stuff to ALLOC_ZVAL(). We need to add those FREE_ZVAL()'s now.
-rw-r--r--apidoc-zend.txt2
-rw-r--r--ext/dav/dav.c2
-rw-r--r--ext/java/java.c2
-rw-r--r--ext/odbc/php_odbc.c2
-rw-r--r--ext/rpc/com/COM.c4
-rw-r--r--ext/rpc/java/java.c2
-rw-r--r--ext/standard/iptc.c2
-rw-r--r--ext/standard/post.c6
-rw-r--r--ext/standard/var.c12
-rw-r--r--ext/sybase_ct/php_sybase_ct.c4
-rw-r--r--main/main.c18
-rw-r--r--main/rfc1867.c2
12 files changed, 29 insertions, 29 deletions
diff --git a/apidoc-zend.txt b/apidoc-zend.txt
index 4667ed501a..1b4a4f7f91 100644
--- a/apidoc-zend.txt
+++ b/apidoc-zend.txt
@@ -64,7 +64,7 @@ php3_write()
php4_write()
{
- pval *newval = (pval *) emalloc(sizeof(pval));
+ pval *newval = ALLOC_ZVAL();
newval->refcount=1;
newval->is_ref=0;
diff --git a/ext/dav/dav.c b/ext/dav/dav.c
index 4bd40f14f8..0b520f206a 100644
--- a/ext/dav/dav.c
+++ b/ext/dav/dav.c
@@ -192,7 +192,7 @@ dav_call_handler(char *funcName, int argc, pval **argv)
HashTable *function_table;
func = php3i_string_pval(funcName);
- retval = emalloc(sizeof(pval));
+ retval = ALLOC_ZVAL();
function_table = php3i_get_function_table();
if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) {
php3tls_pval_destructor(retval);
diff --git a/ext/java/java.c b/ext/java/java.c
index 037e43bdbd..db8188f2c5 100644
--- a/ext/java/java.c
+++ b/ext/java/java.c
@@ -500,7 +500,7 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
};
- handle = (pval *) emalloc(sizeof(pval));
+ handle = ALLOC_ZVAL();
handle->type = IS_LONG;
handle->value.lval =
zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index b5e3165a4e..adde6bce15 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -1096,7 +1096,7 @@ PHP_FUNCTION(odbc_fetch_into)
result->fetched++;
for(i = 0; i < result->numcols; i++) {
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->refcount = 1;
tmp->type = IS_STRING;
tmp->value.str.len = 0;
diff --git a/ext/rpc/com/COM.c b/ext/rpc/com/COM.c
index d86d5c2770..f8659f0f78 100644
--- a/ext/rpc/com/COM.c
+++ b/ext/rpc/com/COM.c
@@ -416,7 +416,7 @@ static void php_variant_to_pval(VARIANTARG *var_arg, pval *pval_arg, int persist
pval_arg->refcount=1;
zend_hash_init(pval_arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- handle = (pval *) emalloc(sizeof(pval));
+ handle = ALLOC_ZVAL();
handle->type = IS_LONG;
handle->value.lval = zend_list_insert(var_arg->pdispVal, le_idispatch);
pval_copy_constructor(handle);
@@ -915,7 +915,7 @@ void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_r
var_reset(object);
return;
}
- object_handle = (pval *) emalloc(sizeof(pval));
+ object_handle = ALLOC_ZVAL();
*object_handle = *return_value;
pval_copy_constructor(object_handle);
INIT_PZVAL(object_handle);
diff --git a/ext/rpc/java/java.c b/ext/rpc/java/java.c
index 037e43bdbd..db8188f2c5 100644
--- a/ext/rpc/java/java.c
+++ b/ext/rpc/java/java.c
@@ -500,7 +500,7 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
};
- handle = (pval *) emalloc(sizeof(pval));
+ handle = ALLOC_ZVAL();
handle->type = IS_LONG;
handle->value.lval =
zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index cd6d107f4f..64e886faa5 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -356,7 +356,7 @@ PHP_FUNCTION(iptcparse)
}
if (zend_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) == FAILURE) {
- values = emalloc(sizeof(pval));
+ values = ALLOC_ZVAL();
INIT_PZVAL(values);
if (array_init(values) == FAILURE) {
php_error(E_ERROR, "Unable to initialize array");
diff --git a/ext/standard/post.c b/ext/standard/post.c
index 4984b82837..b41007239a 100644
--- a/ext/standard/post.c
+++ b/ext/standard/post.c
@@ -112,7 +112,7 @@ void php_parse_gpc_data(char *val, char *var, pval *track_vars_array ELS_DC PLS_
}
/* Create the element */
- array_element = (pval *) emalloc(sizeof(pval));
+ array_element = ALLOC_ZVAL();
INIT_PZVAL(array_element);
array_element->value.str.val = val;
array_element->value.str.len = val_len;
@@ -315,7 +315,7 @@ void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC)
case PARSE_GET:
case PARSE_COOKIE:
if (PG(track_vars)) {
- array_ptr = (pval *) emalloc(sizeof(pval));
+ array_ptr = ALLOC_ZVAL();
array_init(array_ptr);
INIT_PZVAL(array_ptr);
switch (arg) {
@@ -369,7 +369,7 @@ void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC)
if((NULL != SG(request_info).content_type) && (0 == strcmp(SG(request_info).content_type, "application/vnd.fdf"))) {
pval *tmp;
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->value.str.len = SG(request_info).post_data_length;
tmp->value.str.val = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
tmp->type = IS_STRING;
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 736971a724..263dfad42c 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -96,7 +96,7 @@ void php_var_dump(pval **struc, int level)
}
switch (i) {
case HASH_KEY_IS_LONG:{
- pval *d = emalloc(sizeof(pval));
+ pval *d = ALLOC_ZVAL();
d->type = IS_LONG;
d->value.lval = index;
@@ -106,7 +106,7 @@ void php_var_dump(pval **struc, int level)
break;
case HASH_KEY_IS_STRING:{
- pval *d = emalloc(sizeof(pval));
+ pval *d = ALLOC_ZVAL();
d->type = IS_STRING;
d->value.str.val = key;
@@ -253,14 +253,14 @@ void php_var_serialize(pval *buf, pval **struc)
switch (i) {
case HASH_KEY_IS_LONG:
- d = emalloc(sizeof(pval));
+ d = ALLOC_ZVAL();
d->type = IS_LONG;
d->value.lval = index;
php_var_serialize(buf, &d);
efree(d);
break;
case HASH_KEY_IS_STRING:
- d = emalloc(sizeof(pval));
+ d = ALLOC_ZVAL();
d->type = IS_STRING;
d->value.str.val = key;
d->value.str.len = strlen(key);
@@ -431,8 +431,8 @@ int php_var_unserialize(pval **rval, const char **p, const char *max)
return 0;
}
for ((*p) += 2; **p && **p != '}' && i > 0; i--) {
- pval *key = emalloc(sizeof(pval));
- pval *data = emalloc(sizeof(pval));
+ pval *key = ALLOC_ZVAL();
+ pval *data = ALLOC_ZVAL();
if (!php_var_unserialize(&key, p, max)) {
zval_dtor(key);
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
index 201156e06e..d241e9a21c 100644
--- a/ext/sybase_ct/php_sybase_ct.c
+++ b/ext/sybase_ct/php_sybase_ct.c
@@ -1224,7 +1224,7 @@ PHP_FUNCTION(sybase_fetch_row)
array_init(return_value);
for (i=0; i<result->num_fields; i++) {
- field_content = (pval *) emalloc(sizeof(pval));
+ field_content = ALLOC_ZVAL();
*field_content = result->data[result->cur_row][i];
INIT_PZVAL(field_content);
pval_copy_constructor(field_content);
@@ -1257,7 +1257,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS)
}
for (i=0; i<result->num_fields; i++) {
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
*tmp = result->data[result->cur_row][i];
INIT_PZVAL(tmp);
if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) {
diff --git a/main/main.c b/main/main.c
index 62cd683dc0..a5ec189660 100644
--- a/main/main.c
+++ b/main/main.c
@@ -446,7 +446,7 @@ PHPAPI void php_error(int type, const char *format,...)
va_end(args);
buffer[sizeof(buffer) - 1] = 0;
- tmp = (pval *)emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
INIT_PZVAL(tmp);
tmp->value.str.val = (char *) estrndup(buffer, size);
tmp->value.str.len = size;
@@ -1079,7 +1079,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
continue;
}
t = estrndup(*env, p - *env);
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->value.str.len = strlen(p + 1);
tmp->value.str.val = estrndup(p + 1, tmp->value.str.len);
tmp->type = IS_STRING;
@@ -1100,7 +1100,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
for (i = 0; i < arr->nelts; i++) {
len = strlen(elts[i].key);
t = elts[i].key;
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
if (elts[i].val) {
tmp->value.str.len = strlen(elts[i].val);
tmp->value.str.val = estrndup(elts[i].val, tmp->value.str.len);
@@ -1117,7 +1117,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
(*tmp_ptr)->refcount++;
zend_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL);
}
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->value.str.len = strlen(((request_rec *) SG(server_context))->uri);
tmp->value.str.val = estrndup(((request_rec *) SG(server_context))->uri, tmp->value.str.len);
INIT_PZVAL(tmp);
@@ -1130,7 +1130,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
char *pi;
#if FORCE_CGI_REDIRECT
pi = SG(request_info).request_uri;
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1);
tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s", (pi ? pi : "")); /* SAFE */
tmp->type = IS_STRING;
@@ -1148,7 +1148,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
l -= strlen(pi);
pi = NULL;
}
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->value.str.val = emalloc(l + 1);
tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */
tmp->type = IS_STRING;
@@ -1171,7 +1171,7 @@ void _php_build_argv(char *s ELS_DC)
int count = 0;
char *ss, *space;
- arr = (pval *) emalloc(sizeof(pval));
+ arr = ALLOC_ZVAL();
arr->value.ht = (HashTable *) emalloc(sizeof(HashTable));
if (zend_hash_init(arr->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0) == FAILURE) {
php_error(E_WARNING, "Unable to create argv array");
@@ -1188,7 +1188,7 @@ void _php_build_argv(char *s ELS_DC)
*space = '\0';
}
/* auto-type */
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->type = IS_STRING;
tmp->value.str.len = strlen(ss);
tmp->value.str.val = estrndup(ss, tmp->value.str.len);
@@ -1206,7 +1206,7 @@ void _php_build_argv(char *s ELS_DC)
ss = space;
}
}
- tmp = (pval *) emalloc(sizeof(pval));
+ tmp = ALLOC_ZVAL();
tmp->value.lval = count;
tmp->type = IS_LONG;
INIT_PZVAL(tmp);
diff --git a/main/rfc1867.c b/main/rfc1867.c
index a32fd3f057..cb39d54db3 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -45,7 +45,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary)
PLS_FETCH();
if (PG(track_vars)) {
- http_post_vars = (pval *) emalloc(sizeof(pval));
+ http_post_vars = ALLOC_ZVAL();
array_init(http_post_vars);
INIT_PZVAL(http_post_vars);