s = *((Bucket **) b);
if (f->nKeyLength == 0) {
- first.type = IS_LONG;
- first.value.lval = f->h;
+ Z_TYPE(first) = IS_LONG;
+ Z_LVAL(first) = f->h;
} else {
- first.type = IS_STRING;
- first.value.str.val = f->arKey;
- first.value.str.len = f->nKeyLength;
+ Z_TYPE(first) = IS_STRING;
+ Z_STRVAL(first) = f->arKey;
+ Z_STRLEN(first) = f->nKeyLength;
}
if (s->nKeyLength == 0) {
- second.type = IS_LONG;
- second.value.lval = s->h;
+ Z_TYPE(second) = IS_LONG;
+ Z_LVAL(second) = s->h;
} else {
- second.type = IS_STRING;
- second.value.str.val = s->arKey;
- second.value.str.len = s->nKeyLength;
+ Z_TYPE(second) = IS_STRING;
+ Z_STRVAL(second) = s->arKey;
+ Z_STRLEN(second) = s->nKeyLength;
}
if (ARRAYG(compare_func)(&result, &first, &second) == FAILURE) {
return 0;
}
- if (result.type == IS_DOUBLE) {
- if (result.value.dval < 0) {
+ if (Z_TYPE(result) == IS_DOUBLE) {
+ if (Z_DVAL(result) < 0) {
return -1;
- } else if (result.value.dval > 0) {
+ } else if (Z_DVAL(result) > 0) {
return 1;
} else {
return 0;
convert_to_long(&result);
- if (result.value.lval < 0) {
+ if (Z_LVAL(result) < 0) {
return -1;
- } else if (result.value.lval > 0) {
+ } else if (Z_LVAL(result) > 0) {
return 1;
}
}
target_hash = HASH_OF(*array);
if (!target_hash) {
- if ((*array)->type == IS_NULL) {
+ if (Z_TYPE_PP(array) == IS_NULL) {
RETURN_LONG(0);
} else {
RETURN_LONG(1);
return 0;
}
- if (result.type == IS_DOUBLE) {
- if (result.value.dval < 0) {
+ if (Z_TYPE(result) == IS_DOUBLE) {
+ if (Z_DVAL(result) < 0) {
return -1;
- } else if (result.value.dval > 0) {
+ } else if (Z_DVAL(result) > 0) {
return 1;
} else {
return 0;
convert_to_long(&result);
- if (result.value.lval < 0) {
+ if (Z_LVAL(result) < 0) {
return -1;
- } else if (result.value.lval > 0) {
+ } else if (Z_LVAL(result) > 0) {
return 1;
}
sval = *((pval **) s->pData);
first = *fval;
second = *sval;
- if (fval->type != IS_STRING) {
+ if (Z_TYPE_P(fval) != IS_STRING) {
zval_copy_ctor(&first);
convert_to_string(&first);
}
- if (sval->type != IS_STRING) {
+ if (Z_TYPE_P(sval) != IS_STRING) {
zval_copy_ctor(&first);
convert_to_string(&second);
}
- result = strnatcmp_ex(first.value.str.val, first.value.str.len,
- second.value.str.val, second.value.str.len, fold_case);
+ result = strnatcmp_ex(Z_STRVAL(first), Z_STRLEN(first),
+ Z_STRVAL(second), Z_STRLEN(second), fold_case);
- if (fval->type != IS_STRING)
+ if (Z_TYPE_P(fval) != IS_STRING)
zval_dtor(&first);
- if (sval->type != IS_STRING)
+ if (Z_TYPE_P(sval) != IS_STRING)
zval_dtor(&second);
return result;
first = *((pval **) f->pData);
second = *((pval **) s->pData);
- diff = first->type - second->type;
- if (diff && ((first->type == IS_STRING) || (second->type == IS_STRING)))
+ diff = Z_TYPE_P(first) - Z_TYPE_P(second);
+ if (diff && ((Z_TYPE_P(first) == IS_STRING) || (Z_TYPE_P(second) == IS_STRING)))
return diff;
if (ARRAYG(compare_func)(&result, first, second) == FAILURE) {
return 0;
}
- if (result.type == IS_DOUBLE) {
- if (result.value.dval < 0) {
+ if (Z_TYPE(result) == IS_DOUBLE) {
+ if (Z_DVAL(result) < 0) {
return -1;
- } else if (result.value.dval > 0) {
+ } else if (Z_DVAL(result) > 0) {
return 1;
} else {
return 0;
convert_to_long(&result);
- if (result.value.lval < 0) {
+ if (Z_LVAL(result) < 0) {
return -1;
- } else if (result.value.lval > 0) {
+ } else if (Z_LVAL(result) > 0) {
return 1;
}
long retval;
convert_to_long_ex(&retval_ptr);
- retval = retval_ptr->value.lval;
+ retval = Z_LVAL_P(retval_ptr);
zval_ptr_dtor(&retval_ptr);
return retval;
} else {
s = *((Bucket **) b);
if (f->nKeyLength) {
- key1.value.str.val = estrndup(f->arKey, f->nKeyLength);
- key1.value.str.len = f->nKeyLength-1;
- key1.type = IS_STRING;
+ Z_STRVAL(key1) = estrndup(f->arKey, f->nKeyLength);
+ Z_STRLEN(key1) = f->nKeyLength-1;
+ Z_TYPE(key1) = IS_STRING;
} else {
- key1.value.lval = f->h;
- key1.type = IS_LONG;
+ Z_LVAL(key1) = f->h;
+ Z_TYPE(key1) = IS_LONG;
}
if (s->nKeyLength) {
- key2.value.str.val = estrndup(s->arKey, s->nKeyLength);
- key2.value.str.len = s->nKeyLength-1;
- key2.type = IS_STRING;
+ Z_STRVAL(key2) = estrndup(s->arKey, s->nKeyLength);
+ Z_STRLEN(key2) = s->nKeyLength-1;
+ Z_TYPE(key2) = IS_STRING;
} else {
- key2.value.lval = s->h;
- key2.type = IS_LONG;
+ Z_LVAL(key2) = s->h;
+ Z_TYPE(key2) = IS_LONG;
}
status = call_user_function(CG(function_table), NULL, *BG(user_compare_func_name), &retval, 2, args);
if (status==SUCCESS) {
convert_to_long(&retval);
- return retval.value.lval;
+ return Z_LVAL(retval);
} else {
return 0;
}
}
switch (zend_hash_get_current_key(target_hash, &string_key, &num_key)) {
case HASH_KEY_IS_STRING:
- return_value->value.str.val = string_key;
- return_value->value.str.len = strlen(string_key);
- return_value->type = IS_STRING;
+ RETVAL_STRING(string_key, 0);
break;
case HASH_KEY_IS_LONG:
- return_value->type = IS_LONG;
- return_value->value.lval = num_key;
+ RETVAL_LONG(num_key);
break;
case HASH_KEY_NON_EXISTANT:
return;
if (argc == 1) {
pval **arr;
- if (zend_get_parameters_ex(1, &arr) == FAILURE || (*arr)->type != IS_ARRAY) {
+ if (zend_get_parameters_ex(1, &arr) == FAILURE || Z_TYPE_PP(arr) != IS_ARRAY) {
WRONG_PARAM_COUNT;
}
- if (zend_hash_minmax((*arr)->value.ht, array_data_compare, 0, (void **) &result)==SUCCESS) {
+ if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 0, (void **) &result)==SUCCESS) {
*return_value = **result;
zval_copy_ctor(return_value);
} else {
for (i=1; i<ZEND_NUM_ARGS(); i++) {
is_smaller_function(&result, *args[i], *min);
- if (result.value.lval == 1) {
+ if (Z_LVAL(result) == 1) {
min = args[i];
}
}
if (argc == 1) {
pval **arr;
- if (zend_get_parameters_ex(1, &arr) == FAILURE || (*arr)->type != IS_ARRAY) {
+ if (zend_get_parameters_ex(1, &arr) == FAILURE || Z_TYPE_PP(arr) != IS_ARRAY) {
WRONG_PARAM_COUNT;
}
- if (zend_hash_minmax((*arr)->value.ht, array_data_compare, 1, (void **) &result)==SUCCESS) {
+ if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 1, (void **) &result)==SUCCESS) {
*return_value = **result;
zval_copy_ctor(return_value);
} else {
for (i=1; i<ZEND_NUM_ARGS(); i++) {
is_smaller_or_equal_function(&result, *args[i], *max);
- if (result.value.lval == 0) {
+ if (Z_LVAL(result) == 0) {
max = args[i];
}
}
while(zend_hash_get_current_data(target_hash, (void **)&args[0]) == SUCCESS) {
/* Set up the key */
if (zend_hash_get_current_key(target_hash, &string_key, &num_key) == HASH_KEY_IS_LONG) {
- key->type = IS_LONG;
- key->value.lval = num_key;
+ Z_TYPE_P(key) = IS_LONG;
+ Z_LVAL_P(key) = num_key;
} else {
- key->type = IS_STRING;
- key->value.str.val = string_key;
- key->value.str.len = strlen(string_key);
+ Z_TYPE_P(key) = IS_STRING;
+ Z_STRVAL_P(key) = string_key;
+ Z_STRLEN_P(key) = strlen(string_key);
}
/* Call the userland function */
/* Clean up the key */
if (zend_hash_get_current_key_type(target_hash) == HASH_KEY_IS_STRING)
- efree(key->value.str.val);
+ efree(Z_STRVAL_P(key));
zend_hash_move_forward(target_hash);
}
WRONG_PARAM_COUNT;
}
- if ((*value)->type == IS_ARRAY || (*value)->type == IS_OBJECT) {
+ if (Z_TYPE_PP(value) == IS_ARRAY || Z_TYPE_PP(value) == IS_OBJECT) {
php_error(E_WARNING, "Wrong datatype for first argument in call to in_array()");
RETURN_FALSE;
}
- if ((*array)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(array) != IS_ARRAY) {
php_error(E_WARNING, "Wrong datatype for second argument in call to in_array()");
RETURN_FALSE;
}
WRONG_PARAM_COUNT;
}
convert_to_long_ex(etype);
- extype = (*etype)->value.lval;
+ extype = Z_LVAL_PP(etype);
if (extype > EXTR_SKIP && extype <= EXTR_PREFIX_ALL) {
WRONG_PARAM_COUNT;
}
WRONG_PARAM_COUNT;
}
convert_to_long_ex(etype);
- extype = (*etype)->value.lval;
+ extype = Z_LVAL_PP(etype);
convert_to_string_ex(prefix);
break;
RETURN_FALSE;
}
- if ((*var_array)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(var_array) != IS_ARRAY) {
php_error(E_WARNING, "Wrong datatype in call to extract()");
RETURN_FALSE;
}
- zend_hash_internal_pointer_reset((*var_array)->value.ht);
- while(zend_hash_get_current_data((*var_array)->value.ht, (void **)&entry) == SUCCESS) {
+ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(var_array));
+ while(zend_hash_get_current_data(Z_ARRVAL_PP(var_array), (void **)&entry) == SUCCESS) {
- if (zend_hash_get_current_key((*var_array)->value.ht, &varname, &lkey) == HASH_KEY_IS_STRING) {
+ if (zend_hash_get_current_key(Z_ARRVAL_PP(var_array), &varname, &lkey) == HASH_KEY_IS_STRING) {
if (_valid_var_name(varname)) {
finalname = NULL;
case EXTR_PREFIX_ALL:
if (!finalname) {
- finalname = emalloc(strlen(varname) + (*prefix)->value.str.len + 2);
- strcpy(finalname, (*prefix)->value.str.val);
+ finalname = emalloc(strlen(varname) + Z_STRLEN_PP(prefix) + 2);
+ strcpy(finalname, Z_STRVAL_PP(prefix));
strcat(finalname, "_");
strcat(finalname, varname);
}
efree(varname);
}
- zend_hash_move_forward((*var_array)->value.ht);
+ zend_hash_move_forward(Z_ARRVAL_PP(var_array));
}
}
/* }}} */
{
zval **value_ptr, *value, *data;
- if (entry->type == IS_STRING) {
- if (zend_hash_find(eg_active_symbol_table, entry->value.str.val,
- entry->value.str.len+1, (void **)&value_ptr) != FAILURE) {
+ if (Z_TYPE_P(entry) == IS_STRING) {
+ if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry),
+ Z_STRLEN_P(entry)+1, (void **)&value_ptr) != FAILURE) {
value = *value_ptr;
ALLOC_ZVAL(data);
*data = *value;
zval_copy_ctor(data);
INIT_PZVAL(data);
- zend_hash_update(return_value->value.ht, entry->value.str.val,
- entry->value.str.len+1, &data, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry),
+ Z_STRLEN_P(entry)+1, &data, sizeof(zval *), NULL);
}
}
- else if (entry->type == IS_ARRAY) {
- zend_hash_internal_pointer_reset(entry->value.ht);
+ else if (Z_TYPE_P(entry) == IS_ARRAY) {
+ zend_hash_internal_pointer_reset(Z_ARRVAL_P(entry));
- while(zend_hash_get_current_data(entry->value.ht, (void**)&value_ptr) == SUCCESS) {
+ while(zend_hash_get_current_data(Z_ARRVAL_P(entry), (void**)&value_ptr) == SUCCESS) {
value = *value_ptr;
_compact_var(eg_active_symbol_table, return_value, value);
- zend_hash_move_forward(entry->value.ht);
+ zend_hash_move_forward(Z_ARRVAL_P(entry));
}
}
}
}
convert_to_long_ex(zlow);
convert_to_long_ex(zhigh);
- low = (*zlow)->value.lval;
- high = (*zhigh)->value.lval;
+ low = Z_LVAL_PP(zlow);
+ high = Z_LVAL_PP(zhigh);
/* allocate an array for return */
if (array_init(return_value) == FAILURE) {
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if ((*array)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(array) != IS_ARRAY) {
php_error(E_WARNING, "Wrong datatype in shuffle() call");
RETURN_FALSE;
}
- if (zend_hash_sort((*array)->value.ht, (sort_func_t)php_mergesort, array_data_shuffle, 1) == FAILURE) {
+ if (zend_hash_sort(Z_ARRVAL_PP(array), (sort_func_t)php_mergesort, array_data_shuffle, 1) == FAILURE) {
RETURN_FALSE;
}
RETURN_TRUE;
/* Get first argument and check that it's an array */
stack = *args[0];
- if (stack->type != IS_ARRAY) {
+ if (Z_TYPE_P(stack) != IS_ARRAY) {
php_error(E_WARNING, "First argument to array_push() needs to be an array");
RETURN_FALSE;
}
new_var = *args[i];
new_var->refcount++;
- zend_hash_next_index_insert(stack->value.ht, &new_var, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL);
}
/* Clean up and return the number of values in the stack */
efree(args);
- RETVAL_LONG(zend_hash_num_elements(stack->value.ht));
+ RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
}
/* }}} */
WRONG_PARAM_COUNT;
}
- if ((*stack)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(stack) != IS_ARRAY) {
php_error(E_WARNING, "The argument needs to be an array");
return;
}
- if (zend_hash_num_elements((*stack)->value.ht) == 0) {
+ if (zend_hash_num_elements(Z_ARRVAL_PP(stack)) == 0) {
return;
}
/* Get the first or last value and copy it into the return value */
if (off_the_end)
- zend_hash_internal_pointer_end((*stack)->value.ht);
+ zend_hash_internal_pointer_end(Z_ARRVAL_PP(stack));
else
- zend_hash_internal_pointer_reset((*stack)->value.ht);
- zend_hash_get_current_data((*stack)->value.ht, (void **)&val);
+ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(stack));
+ zend_hash_get_current_data(Z_ARRVAL_PP(stack), (void **)&val);
*return_value = **val;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
/* Delete the first or last value */
- new_hash = php_splice((*stack)->value.ht, (off_the_end) ? -1 : 0, 1, NULL, 0, NULL);
- zend_hash_destroy((*stack)->value.ht);
- efree((*stack)->value.ht);
- (*stack)->value.ht = new_hash;
+ new_hash = php_splice(Z_ARRVAL_PP(stack), (off_the_end) ? -1 : 0, 1, NULL, 0, NULL);
+ zend_hash_destroy(Z_ARRVAL_PP(stack));
+ efree(Z_ARRVAL_PP(stack));
+ Z_ARRVAL_PP(stack) = new_hash;
}
/* }}} */
/* Get first argument and check that it's an array */
stack = *args[0];
- if (stack->type != IS_ARRAY) {
+ if (Z_TYPE_P(stack) != IS_ARRAY) {
php_error(E_WARNING, "First argument to array_unshift() needs to be an array");
RETURN_FALSE;
}
/* Use splice to insert the elements at the beginning. Destroy old
hashtable and replace it with new one */
- new_hash = php_splice(stack->value.ht, 0, 0, &args[1], argc-1, NULL);
- zend_hash_destroy(stack->value.ht);
- efree(stack->value.ht);
- stack->value.ht = new_hash;
+ new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[1], argc-1, NULL);
+ zend_hash_destroy(Z_ARRVAL_P(stack));
+ efree(Z_ARRVAL_P(stack));
+ Z_ARRVAL_P(stack) = new_hash;
/* Clean up and return the number of elements in the stack */
efree(args);
- RETVAL_LONG(zend_hash_num_elements(stack->value.ht));
+ RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
}
/* }}} */
/* Get first argument and check that it's an array */
array = *args[0];
- if (array->type != IS_ARRAY) {
+ if (Z_TYPE_P(array) != IS_ARRAY) {
php_error(E_WARNING, "First argument to array_splice() should be an array");
efree(args);
return;
/* Get the next two arguments. If length is omitted,
it's assumed to be until the end of the array */
convert_to_long_ex(args[1]);
- offset = (*args[1])->value.lval;
+ offset = Z_LVAL_PP(args[1]);
if (argc > 2) {
convert_to_long_ex(args[2]);
- length = (*args[2])->value.lval;
+ length = Z_LVAL_PP(args[2]);
} else
- length = zend_hash_num_elements(array->value.ht);
+ length = zend_hash_num_elements(Z_ARRVAL_P(array));
if (argc == 4) {
/* Make sure the last argument, if passed, is an array */
convert_to_array_ex(args[3]);
/* Create the array of replacement elements */
- repl_num = zend_hash_num_elements((*args[3])->value.ht);
+ repl_num = zend_hash_num_elements(Z_ARRVAL_PP(args[3]));
repl = (zval ***)emalloc(repl_num * sizeof(zval **));
- for (p=(*args[3])->value.ht->pListHead, i=0; p; p=p->pListNext, i++) {
+ for (p=Z_ARRVAL_PP(args[3])->pListHead, i=0; p; p=p->pListNext, i++) {
repl[i] = ((zval **)p->pData);
}
}
array_init(return_value);
/* Perform splice */
- new_hash = php_splice(array->value.ht, offset, length,
+ new_hash = php_splice(Z_ARRVAL_P(array), offset, length,
repl, repl_num,
- &return_value->value.ht);
+ &Z_ARRVAL_P(return_value));
/* Replace input array's hashtable with the new one */
- zend_hash_destroy(array->value.ht);
- efree(array->value.ht);
- array->value.ht = new_hash;
+ zend_hash_destroy(Z_ARRVAL_P(array));
+ efree(Z_ARRVAL_P(array));
+ Z_ARRVAL_P(array) = new_hash;
/* Clean up */
if (argc == 4)
WRONG_PARAM_COUNT;
}
- if ((*input)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(input) != IS_ARRAY) {
php_error(E_WARNING, "First argument to array_slice() should be an array");
return;
}
we want all entries from offset to the end if length
is not passed */
convert_to_long_ex(offset);
- offset_val = (*offset)->value.lval;
+ offset_val = Z_LVAL_PP(offset);
if (argc == 3) {
convert_to_long_ex(length);
- length_val = (*length)->value.lval;
+ length_val = Z_LVAL_PP(length);
} else
- length_val = zend_hash_num_elements((*input)->value.ht);
+ length_val = zend_hash_num_elements(Z_ARRVAL_PP(input));
/* Initialize returned array */
array_init(return_value);
/* Get number of entries in the input hash */
- num_in = zend_hash_num_elements((*input)->value.ht);
+ num_in = zend_hash_num_elements(Z_ARRVAL_PP(input));
/* Clamp the offset.. */
if (offset_val > num_in)
/* Start at the beginning and go until we hit offset */
pos = 0;
- zend_hash_internal_pointer_reset((*input)->value.ht);
+ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(input));
while(pos < offset_val &&
- zend_hash_get_current_data((*input)->value.ht, (void **)&entry) == SUCCESS) {
+ zend_hash_get_current_data(Z_ARRVAL_PP(input), (void **)&entry) == SUCCESS) {
pos++;
- zend_hash_move_forward((*input)->value.ht);
+ zend_hash_move_forward(Z_ARRVAL_PP(input));
}
/* Copy elements from input array to the one that's returned */
while(pos < offset_val+length_val &&
- zend_hash_get_current_data((*input)->value.ht, (void **)&entry) == SUCCESS) {
+ zend_hash_get_current_data(Z_ARRVAL_PP(input), (void **)&entry) == SUCCESS) {
(*entry)->refcount++;
- switch (zend_hash_get_current_key((*input)->value.ht, &string_key, &num_key)) {
+ switch (zend_hash_get_current_key(Z_ARRVAL_PP(input), &string_key, &num_key)) {
case HASH_KEY_IS_STRING:
- zend_hash_update(return_value->value.ht, string_key, strlen(string_key)+1,
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, strlen(string_key)+1,
entry, sizeof(zval *), NULL);
efree(string_key);
break;
case HASH_KEY_IS_LONG:
- zend_hash_next_index_insert(return_value->value.ht,
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value),
entry, sizeof(zval *), NULL);
break;
}
pos++;
- zend_hash_move_forward((*input)->value.ht);
+ zend_hash_move_forward(Z_ARRVAL_PP(input));
}
}
/* }}} */
WRONG_PARAM_COUNT;
}
- if ((*input)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(input) != IS_ARRAY) {
php_error(E_WARNING, "First argument to array_keys() should be an array");
return;
}
add_key = 1;
/* Go through input array and add keys to the return array */
- zend_hash_internal_pointer_reset((*input)->value.ht);
- while(zend_hash_get_current_data((*input)->value.ht, (void **)&entry) == SUCCESS) {
+ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(input));
+ while(zend_hash_get_current_data(Z_ARRVAL_PP(input), (void **)&entry) == SUCCESS) {
if (search_value != NULL) {
is_equal_function(&res, *search_value, *entry);
add_key = zval_is_true(&res);
if (add_key) {
MAKE_STD_ZVAL(new_val);
- switch (zend_hash_get_current_key((*input)->value.ht, &string_key, &num_key)) {
+ switch (zend_hash_get_current_key(Z_ARRVAL_PP(input), &string_key, &num_key)) {
case HASH_KEY_IS_STRING:
- new_val->type = IS_STRING;
- new_val->value.str.val = string_key;
- new_val->value.str.len = strlen(string_key);
- zend_hash_next_index_insert(return_value->value.ht, &new_val,
+ Z_TYPE_P(new_val) = IS_STRING;
+ Z_STRVAL_P(new_val) = string_key;
+ Z_STRLEN_P(new_val) = strlen(string_key);
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val,
sizeof(zval *), NULL);
break;
case HASH_KEY_IS_LONG:
- new_val->type = IS_LONG;
- new_val->value.lval = num_key;
- zend_hash_next_index_insert(return_value->value.ht, &new_val,
+ Z_TYPE_P(new_val) = IS_LONG;
+ Z_LVAL_P(new_val) = num_key;
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val,
sizeof(zval *), NULL);
break;
}
}
- zend_hash_move_forward((*input)->value.ht);
+ zend_hash_move_forward(Z_ARRVAL_PP(input));
}
}
/* }}} */
WRONG_PARAM_COUNT;
}
- if ((*input)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(input) != IS_ARRAY) {
php_error(E_WARNING, "Argument to array_values() should be an array");
return;
}
array_init(return_value);
/* Go through input array and add values to the return array */
- zend_hash_internal_pointer_reset((*input)->value.ht);
- while(zend_hash_get_current_data((*input)->value.ht, (void **)&entry) == SUCCESS) {
+ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(input));
+ while(zend_hash_get_current_data(Z_ARRVAL_PP(input), (void **)&entry) == SUCCESS) {
(*entry)->refcount++;
- zend_hash_next_index_insert(return_value->value.ht, entry,
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry,
sizeof(zval *), NULL);
- zend_hash_move_forward((*input)->value.ht);
+ zend_hash_move_forward(Z_ARRVAL_PP(input));
}
}
/* }}} */
WRONG_PARAM_COUNT;
}
- if ((*input)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(input) != IS_ARRAY) {
php_error(E_WARNING, "Argument to array_count_values() should be an array");
return;
}
array_init(return_value);
/* Go through input array and add values to the return array */
- myht = (*input)->value.ht;
+ myht = Z_ARRVAL_PP(input);
zend_hash_internal_pointer_reset(myht);
while (zend_hash_get_current_data(myht, (void **)&entry) == SUCCESS) {
- if ((*entry)->type == IS_LONG) {
- if (zend_hash_index_find(return_value->value.ht,
- (*entry)->value.lval,
+ if (Z_TYPE_PP(entry) == IS_LONG) {
+ if (zend_hash_index_find(Z_ARRVAL_P(return_value),
+ Z_LVAL_PP(entry),
(void**)&tmp) == FAILURE) {
zval *data;
MAKE_STD_ZVAL(data);
- data->type = IS_LONG;
- data->value.lval = 1;
- zend_hash_index_update(return_value->value.ht,(*entry)->value.lval, &data, sizeof(data), NULL);
+ Z_TYPE_P(data) = IS_LONG;
+ Z_LVAL_P(data) = 1;
+ zend_hash_index_update(Z_ARRVAL_P(return_value),Z_LVAL_PP(entry), &data, sizeof(data), NULL);
} else {
- (*tmp)->value.lval++;
+ Z_LVAL_PP(tmp)++;
}
- } else if ((*entry)->type == IS_STRING) {
- if (zend_hash_find(return_value->value.ht,
- (*entry)->value.str.val,
- (*entry)->value.str.len+1,
+ } else if (Z_TYPE_PP(entry) == IS_STRING) {
+ if (zend_hash_find(Z_ARRVAL_P(return_value),
+ Z_STRVAL_PP(entry),
+ Z_STRLEN_PP(entry)+1,
(void**)&tmp) == FAILURE) {
zval *data;
MAKE_STD_ZVAL(data);
- data->type = IS_LONG;
- data->value.lval = 1;
- zend_hash_update(return_value->value.ht,(*entry)->value.str.val,(*entry)->value.str.len + 1, &data, sizeof(data), NULL);
+ Z_TYPE_P(data) = IS_LONG;
+ Z_LVAL_P(data) = 1;
+ zend_hash_update(Z_ARRVAL_P(return_value),Z_STRVAL_PP(entry),Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
} else {
- (*tmp)->value.lval++;
+ Z_LVAL_PP(tmp)++;
}
} else {
php_error(E_WARNING, "Can only count STRING and INTEGER values!");
}
/* Make sure arguments are of the proper type */
- if ((*input)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(input) != IS_ARRAY) {
php_error(E_WARNING, "Argument to %s() should be an array",
get_active_function_name());
return;
convert_to_long_ex(pad_size);
/* Do some initial calculations */
- input_size = zend_hash_num_elements((*input)->value.ht);
- pad_size_abs = abs((*pad_size)->value.lval);
+ input_size = zend_hash_num_elements(Z_ARRVAL_PP(input));
+ pad_size_abs = abs(Z_LVAL_PP(pad_size));
do_pad = (input_size >= pad_size_abs) ? 0 : 1;
/* Copy the original array */
pads[i] = pad_value;
/* Pad on the right or on the left */
- if ((*pad_size)->value.lval > 0)
- new_hash = php_splice(return_value->value.ht, input_size, 0, pads, num_pads, NULL);
+ if (Z_LVAL_PP(pad_size) > 0)
+ new_hash = php_splice(Z_ARRVAL_P(return_value), input_size, 0, pads, num_pads, NULL);
else
- new_hash = php_splice(return_value->value.ht, 0, 0, pads, num_pads, NULL);
+ new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, num_pads, NULL);
/* Copy the result hash into return value */
- zend_hash_destroy(return_value->value.ht);
- efree(return_value->value.ht);
- return_value->value.ht = new_hash;
+ zend_hash_destroy(Z_ARRVAL_P(return_value));
+ efree(Z_ARRVAL_P(return_value));
+ Z_ARRVAL_P(return_value) = new_hash;
/* Clean up */
efree(pads);
MAKE_STD_ZVAL(data);
switch (zend_hash_get_current_key(target_hash, &string_key, &num_key)) {
case HASH_KEY_IS_STRING:
- data->value.str.val = string_key;
- data->value.str.len = strlen(string_key);
- data->type = IS_STRING;
+ Z_STRVAL_P(data) = string_key;
+ Z_STRLEN_P(data) = strlen(string_key);
+ Z_TYPE_P(data) = IS_STRING;
break;
case HASH_KEY_IS_LONG:
- data->type = IS_LONG;
- data->value.lval = num_key;
+ Z_TYPE_P(data) = IS_LONG;
+ Z_LVAL_P(data) = num_key;
break;
}
- if ((*entry)->type == IS_LONG) {
- zend_hash_index_update(return_value->value.ht,(*entry)->value.lval, &data, sizeof(data), NULL);
- } else if ((*entry)->type == IS_STRING) {
- zend_hash_update(return_value->value.ht,(*entry)->value.str.val,(*entry)->value.str.len + 1, &data, sizeof(data), NULL);
+ if (Z_TYPE_PP(entry) == IS_LONG) {
+ zend_hash_index_update(Z_ARRVAL_P(return_value),Z_LVAL_PP(entry), &data, sizeof(data), NULL);
+ } else if (Z_TYPE_PP(entry) == IS_STRING) {
+ zend_hash_update(Z_ARRVAL_P(return_value),Z_STRVAL_PP(entry),Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
} else {
zval_dtor(data);
php_error(E_WARNING, "Can only flip STRING and INTEGER values!");
} else {
p = *cmpdata;
if (p->nKeyLength)
- zend_hash_del(return_value->value.ht, p->arKey, p->nKeyLength);
+ zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
else
- zend_hash_index_del(return_value->value.ht, p->h);
+ zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
}
}
pefree(arTmp, target_hash->persistent);
ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
set_compare_func(SORT_REGULAR);
for (i=0; i<argc; i++) {
- if ((*args[i])->type != IS_ARRAY) {
+ if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
php_error(E_WARNING, "Argument #%d to array_intersect() is not an array", i+1);
argc = i; /* only free up to i-1 */
goto out;
if (!p)
goto out;
if (p->nKeyLength)
- zend_hash_del(return_value->value.ht, p->arKey, p->nKeyLength);
+ zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
else
- zend_hash_index_del(return_value->value.ht, p->h);
+ zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
}
}
if (c)
for (;;) {
p = *ptrs[0];
if (p->nKeyLength)
- zend_hash_del(return_value->value.ht, p->arKey, p->nKeyLength);
+ zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
else
- zend_hash_index_del(return_value->value.ht, p->h);
+ zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
if (!*++ptrs[0])
goto out;
if (0 <= array_type_data_compare(ptrs[0], ptrs[i]))
ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
set_compare_func(SORT_REGULAR);
for (i=0; i<argc; i++) {
- if ((*args[i])->type != IS_ARRAY) {
+ if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
php_error(E_WARNING, "Argument #%d to array_diff() is not an array", i+1);
argc = i; /* only free up to i-1 */
goto out;
for (;;) {
p = *ptrs[0];
if (p->nKeyLength)
- zend_hash_del(return_value->value.ht, p->arKey, p->nKeyLength);
+ zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
else
- zend_hash_index_del(return_value->value.ht, p->h);
+ zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
if (!*++ptrs[0])
goto out;
if (array_type_data_compare(ptrs[0]-1, ptrs[0]))
set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r]);
ARRAYG(compare_func)(&temp, *((zval **)ab[r]->pData), *((zval **)bb[r]->pData));
- result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * temp.value.lval;
+ result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp);
if (result != 0)
return result;
r++;
taken from zend_hash_sort() function. */
HANDLE_BLOCK_INTERRUPTIONS();
for (i = 0; i < num_arrays; i++) {
- hash = (*arrays[i])->value.ht;
+ hash = Z_ARRVAL_PP(arrays[i]);
hash->pListHead = indirect[0][i];;
hash->pListTail = NULL;
hash->pInternalPointer = hash->pListHead;
convert_to_string_ex(str);
- RETURN_LONG(ntohl(inet_addr((*str)->value.str.val)));
+ RETURN_LONG(ntohl(inet_addr(Z_STRVAL_PP(str))));
}
/* }}} */
}
convert_to_long_ex(num);
- myaddr.s_addr = htonl((unsigned long)(*num)->value.lval);
+ myaddr.s_addr = htonl((unsigned long)Z_LVAL_PP(num));
RETURN_STRING (inet_ntoa(myaddr), 1);
}
}
convert_to_string_ex(str);
- if ((*str)->type != IS_STRING) {
+ if (Z_TYPE_PP(str) != IS_STRING) {
RETURN_FALSE;
}
- ptr = sapi_getenv((*str)->value.str.val, (*str)->value.str.len);
+ ptr = sapi_getenv(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
if (!ptr) {
- ptr = getenv((*str)->value.str.val);
+ ptr = getenv(Z_STRVAL_PP(str));
}
if (ptr) {
RETURN_STRING(ptr, 1);
}
convert_to_string_ex(str);
- if ((*str)->value.str.val && *((*str)->value.str.val)) {
+ if (Z_STRVAL_PP(str) && *(Z_STRVAL_PP(str))) {
int ret;
char *p,**env;
putenv_entry pe;
PLS_FETCH();
- pe.putenv_string = estrndup((*str)->value.str.val,(*str)->value.str.len);
- pe.key = estrndup((*str)->value.str.val, (*str)->value.str.len);
+ pe.putenv_string = estrndup(Z_STRVAL_PP(str),Z_STRLEN_PP(str));
+ pe.key = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
if ((p=strchr(pe.key,'='))) { /* nullify the '=' if there is one */
*p='\0';
}
WRONG_PARAM_COUNT;
}
convert_to_long_ex(arg_base);
- base = (*arg_base)->value.lval;
+ base = Z_LVAL_PP(arg_base);
break;
default:
WRONG_PARAM_COUNT;
WRONG_PARAM_COUNT;
}
convert_to_long_ex(num);
- php_sleep((*num)->value.lval);
+ php_sleep(Z_LVAL_PP(num));
}
/* }}} */
WRONG_PARAM_COUNT;
}
convert_to_long_ex(num);
- usleep((*num)->value.lval);
+ usleep(Z_LVAL_PP(num));
#endif
}
/* }}} */
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
- switch ((*arg)->type) {
+ switch (Z_TYPE_PP(arg)) {
case IS_NULL:
RETVAL_STRING("NULL",1);
break;
WRONG_PARAM_COUNT;
}
convert_to_string_ex(type);
- new_type = (*type)->value.str.val;
+ new_type = Z_STRVAL_PP(type);
if (!strcasecmp(new_type, "integer")) {
convert_to_long(*var);
convert_to_string_ex(varname);
- if (cfg_get_string((*varname)->value.str.val,&value)==FAILURE) {
+ if (cfg_get_string(Z_STRVAL_PP(varname),&value)==FAILURE) {
RETURN_FALSE;
}
RETURN_STRING(value,1);
}
convert_to_boolean_ex(new_setting);
- PG(magic_quotes_runtime) = (zend_bool) (*new_setting)->value.lval;
+ PG(magic_quotes_runtime) = (zend_bool) Z_LVAL_PP(new_setting);
RETURN_TRUE;
}
/* }}} */
if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
RETURN_FALSE;
}
- if ((*arg)->type == type) {
+ if (Z_TYPE_PP(arg) == type) {
RETURN_TRUE;
} else {
RETURN_FALSE;
WRONG_PARAM_COUNT;
}
- switch ((*arg)->type) {
+ switch (Z_TYPE_PP(arg)) {
case IS_LONG:
case IS_DOUBLE:
RETURN_TRUE;
break;
case IS_STRING:
- result = is_numeric_string((*arg)->value.str.val, (*arg)->value.str.len, NULL, NULL);
+ result = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), NULL, NULL);
if (result == IS_LONG || result == IS_DOUBLE) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
convert_to_long_ex(erropt);
- opt_err=(*erropt)->value.lval;
+ opt_err=Z_LVAL_PP(erropt);
break;
case 3:
if (zend_get_parameters_ex(3,&string,&erropt,&option) == FAILURE){
RETURN_FALSE;
}
convert_to_long_ex(erropt);
- opt_err=(*erropt)->value.lval;
+ opt_err=Z_LVAL_PP(erropt);
convert_to_string_ex(option);
- opt=(*option)->value.str.val;
+ opt=Z_STRVAL_PP(option);
break;
case 4:
if (zend_get_parameters_ex(4,&string,&erropt,&option,&emailhead) == FAILURE){
}
convert_to_string_ex(string);
- message=(*string)->value.str.val;
+ message=Z_STRVAL_PP(string);
if (erropt != NULL) {
convert_to_long_ex(erropt);
- opt_err=(*erropt)->value.lval;
+ opt_err=Z_LVAL_PP(erropt);
}
if (option != NULL) {
convert_to_string_ex(option);
- opt=(*option)->value.str.val;
+ opt=Z_STRVAL_PP(option);
}
if (emailhead != NULL) {
convert_to_string_ex(emailhead);
- headers=(*emailhead)->value.str.val;
+ headers=Z_STRVAL_PP(emailhead);
}
if (_php_error_log(opt_err,message,opt,headers)==FAILURE) {
&& retval_ptr) {
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
} else {
- php_error(E_WARNING,"Unable to call %s() - function does not exist", (*params[0])->value.str.val);
+ php_error(E_WARNING,"Unable to call %s() - function does not exist", Z_STRVAL_PP(params[0]));
}
efree(params);
}
efree(params);
RETURN_FALSE;
}
- if ((*params[1])->type != IS_OBJECT) {
+ if (Z_TYPE_PP(params[1]) != IS_OBJECT) {
php_error(E_WARNING,"2nd argument is not an object\n");
efree(params);
RETURN_FALSE;
&& retval_ptr) {
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
} else {
- php_error(E_WARNING,"Unable to call %s() - function does not exist", (*params[0])->value.str.val);
+ php_error(E_WARNING,"Unable to call %s() - function does not exist", Z_STRVAL_PP(params[0]));
}
efree(params);
}
zval_dtor(&retval);
} else {
php_error(E_WARNING,"Unable to call %s() - function does not exist",
- shutdown_function_entry->arguments[0]->value.str.val);
+ Z_STRVAL_P(shutdown_function_entry->arguments[0]));
}
return 0;
}
php_error(E_WARNING, "Unable to call %s() - function does not exist",
Z_STRVAL_P(function));
} else if (Z_TYPE_P(function) == IS_ARRAY &&
- zend_hash_index_find(function->value.ht, 0, (void **) &obj) == SUCCESS &&
- zend_hash_index_find(function->value.ht, 1, (void **) &method) == SUCCESS &&
+ zend_hash_index_find(Z_ARRVAL_P(function), 0, (void **) &obj) == SUCCESS &&
+ zend_hash_index_find(Z_ARRVAL_P(function), 1, (void **) &method) == SUCCESS &&
Z_TYPE_PP(obj) == IS_OBJECT &&
Z_TYPE_PP(method) == IS_STRING) {
php_error(E_WARNING, "Unable to call %s::%s() - function does not exist",
php_get_highlight_struct(&syntax_highlighter_ini);
- if (highlight_file((*filename)->value.str.val, &syntax_highlighter_ini)==FAILURE) {
+ if (highlight_file(Z_STRVAL_PP(filename), &syntax_highlighter_ini)==FAILURE) {
RETURN_FALSE;
}
RETURN_TRUE;
for (element=property_reference->elements_list->head; element; element=element->next) {
overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
+ switch (Z_TYPE_P(overloaded_property)) {
case OE_IS_ARRAY:
printf("Array offset: ");
break;
printf("Object property: ");
break;
}
- switch (overloaded_property->element.type) {
+ switch (Z_TYPE(overloaded_property->element)) {
case IS_LONG:
- printf("%ld (numeric)\n", overloaded_property->element.value.lval);
+ printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
break;
case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
+ printf("'%s'\n", Z_STRVAL(overloaded_property->element));
break;
}
pval_destructor(&overloaded_property->element);
}
- result.value.str.val = estrndup("testing", 7);
- result.value.str.len = 7;
- result.type = IS_STRING;
+ Z_STRVAL(result) = estrndup("testing", 7);
+ Z_STRLEN(result) = 7;
+ Z_TYPE(result) = IS_STRING;
return result;
}
for (element=property_reference->elements_list->head; element; element=element->next) {
overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
+ switch (Z_TYPE_P(overloaded_property)) {
case OE_IS_ARRAY:
printf("Array offset: ");
break;
printf("Object property: ");
break;
}
- switch (overloaded_property->element.type) {
+ switch (Z_TYPE(overloaded_property->element)) {
case IS_LONG:
- printf("%ld (numeric)\n", overloaded_property->element.value.lval);
+ printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
break;
case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
+ printf("'%s'\n", Z_STRVAL(overloaded_property->element));
break;
}
pval_destructor(&overloaded_property->element);
for (element=property_reference->elements_list->head; element; element=element->next) {
overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
+ switch (Z_TYPE_P(overloaded_property)) {
case OE_IS_ARRAY:
printf("Array offset: ");
break;
case OE_IS_METHOD:
printf("Overloaded method: ");
}
- switch (overloaded_property->element.type) {
+ switch (Z_TYPE(overloaded_property->element)) {
case IS_LONG:
- printf("%ld (numeric)\n", overloaded_property->element.value.lval);
+ printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
break;
case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
+ printf("'%s'\n", Z_STRVAL(overloaded_property->element));
break;
}
pval_destructor(&overloaded_property->element);
}
printf("%d arguments\n", ZEND_NUM_ARGS());
- return_value->value.str.val = estrndup("testing", 7);
- return_value->value.str.len = 7;
- return_value->type = IS_STRING;
+ RETVAL_STRING("testing", 1);
}
convert_to_string_ex(varname);
- str = php_ini_string((*varname)->value.str.val, (*varname)->value.str.len+1, 0);
+ str = php_ini_string(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, 0);
if (!str) {
RETURN_FALSE;
convert_to_string_ex(varname);
convert_to_string_ex(new_value);
- old_value = php_ini_string((*varname)->value.str.val, (*varname)->value.str.len+1, 0);
+ old_value = php_ini_string(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, 0);
/* copy to return here, because alter might free it! */
if (old_value) {
RETVAL_STRING(old_value, 1);
RETVAL_FALSE;
}
- if (zend_alter_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, (*new_value)->value.str.val, (*new_value)->value.str.len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) {
+ if (zend_alter_ini_entry(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, Z_STRVAL_PP(new_value), Z_STRLEN_PP(new_value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) {
zval_dtor(return_value);
RETURN_FALSE;
}
convert_to_string_ex(varname);
- zend_restore_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, PHP_INI_STAGE_RUNTIME);
+ zend_restore_ini_entry(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, PHP_INI_STAGE_RUNTIME);
}
/* }}} */
RETURN_FALSE;
}
convert_to_boolean_ex(arg);
- PG(ignore_user_abort) = (zend_bool) (*arg)->value.lval;
+ PG(ignore_user_abort) = (zend_bool) Z_LVAL_PP(arg);
break;
default:
WRONG_PARAM_COUNT;
convert_to_string_ex(name);
convert_to_string_ex(proto);
- serv = getservbyname((*name)->value.str.val,(*proto)->value.str.val);
+ serv = getservbyname(Z_STRVAL_PP(name),Z_STRVAL_PP(proto));
if(serv == NULL)
RETURN_FALSE;
convert_to_long_ex(port);
convert_to_string_ex(proto);
- serv = getservbyport(htons((unsigned short) (*port)->value.lval),(*proto)->value.str.val);
+ serv = getservbyport(htons((unsigned short) Z_LVAL_PP(port)),Z_STRVAL_PP(proto));
if(serv == NULL)
RETURN_FALSE;
convert_to_string_ex(name);
- ent = getprotobyname((*name)->value.str.val);
+ ent = getprotobyname(Z_STRVAL_PP(name));
if(ent == NULL) {
- return_value->value.lval = -1;
- return_value->type = IS_LONG;
+ Z_LVAL_P(return_value) = -1;
+ Z_TYPE_P(return_value) = IS_LONG;
return;
}
convert_to_long_ex(proto);
- ent = getprotobynumber((*proto)->value.lval);
+ ent = getprotobynumber(Z_LVAL_PP(proto));
if(ent == NULL)
RETURN_FALSE;
}
convert_to_string_ex(extension_name);
- if (zend_hash_exists(&module_registry, (*extension_name)->value.str.val, (*extension_name)->value.str.len+1)) {
+ if (zend_hash_exists(&module_registry, Z_STRVAL_PP(extension_name), Z_STRLEN_PP(extension_name)+1)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
convert_to_string_ex(extension_name);
- if (zend_hash_find(&module_registry, (*extension_name)->value.str.val,
- (*extension_name)->value.str.len+1, (void**)&module) == FAILURE) {
+ if (zend_hash_find(&module_registry, Z_STRVAL_PP(extension_name),
+ Z_STRLEN_PP(extension_name)+1, (void**)&module) == FAILURE) {
return;
}
*element = *arg2;
zval_copy_ctor(element);
INIT_PZVAL(element);
- zend_hash_update(arr->value.ht, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
break;
case ZEND_INI_PARSER_SECTION:
break;
*element = *arg2;
zval_copy_ctor(element);
INIT_PZVAL(element);
- zend_hash_update(active_arr->value.ht, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(active_arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
}
break;
case ZEND_INI_PARSER_SECTION:
MAKE_STD_ZVAL(BG(active_ini_file_section));
array_init(BG(active_ini_file_section));
- zend_hash_update(arr->value.ht, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &BG(active_ini_file_section), sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &BG(active_ini_file_section), sizeof(zval *), NULL);
break;
}
}
convert_to_string_ex(filename);
fh.handle.fp = V_FOPEN(Z_STRVAL_PP(filename), "r");
if (!fh.handle.fp) {
- php_error(E_WARNING,"Cannot open '%s' for reading", (*filename)->value.str.val);
+ php_error(E_WARNING,"Cannot open '%s' for reading", Z_STRVAL_PP(filename));
return;
}
- fh.type = ZEND_HANDLE_FP;
+ Z_TYPE(fh) = ZEND_HANDLE_FP;
fh.filename = Z_STRVAL_PP(filename);
array_init(return_value);
zend_parse_ini_file(&fh, 0, ini_parser_cb, return_value);