summaryrefslogtreecommitdiff
path: root/ext/dbase
diff options
context:
space:
mode:
authorJeroen van Wolffelaar <jeroen@php.net>2001-09-25 21:58:48 +0000
committerJeroen van Wolffelaar <jeroen@php.net>2001-09-25 21:58:48 +0000
commitc03328857394bef36ffa9678d33079ad96e4a4e4 (patch)
treec0fb250db3b1bb996fc305bf56c2b74eb6d00935 /ext/dbase
parent158d34c9a57816326e141e88e1409d9f377dc2ea (diff)
downloadphp-git-c03328857394bef36ffa9678d33079ad96e4a4e4.tar.gz
Back-substitute for Z_* macro's. If it breaks some extension (the script isn't optimal, it parses for example var->zval.value incorrect) please let me know.
Diffstat (limited to 'ext/dbase')
-rw-r--r--ext/dbase/dbase.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
index c3ae16c722..598521695a 100644
--- a/ext/dbase/dbase.c
+++ b/ext/dbase/dbase.c
@@ -129,17 +129,17 @@ PHP_FUNCTION(dbase_open)
convert_to_string(dbf_name);
convert_to_long(options);
- if (PG(safe_mode) && (!php_checkuid(dbf_name->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(dbf_name), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
- if (php_check_open_basedir(dbf_name->value.str.val TSRMLS_CC)) {
+ if (php_check_open_basedir(Z_STRVAL_P(dbf_name) TSRMLS_CC)) {
RETURN_FALSE;
}
- dbh = dbf_open(dbf_name->value.str.val, options->value.lval TSRMLS_CC);
+ dbh = dbf_open(Z_STRVAL_P(dbf_name), Z_LVAL_P(options) TSRMLS_CC);
if (dbh == NULL) {
- php_error(E_WARNING, "unable to open database %s", dbf_name->value.str.val);
+ php_error(E_WARNING, "unable to open database %s", Z_STRVAL_P(dbf_name));
RETURN_FALSE;
}
@@ -161,13 +161,13 @@ PHP_FUNCTION(dbase_close)
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
- zend_list_delete(dbh_id->value.lval);
+ zend_list_delete(Z_LVAL_P(dbh_id));
RETURN_TRUE;
}
/* }}} */
@@ -185,9 +185,9 @@ PHP_FUNCTION(dbase_numrecords)
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
@@ -208,9 +208,9 @@ PHP_FUNCTION(dbase_numfields)
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
@@ -231,9 +231,9 @@ PHP_FUNCTION(dbase_pack)
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
@@ -261,18 +261,18 @@ PHP_FUNCTION(dbase_add_record)
WRONG_PARAM_COUNT;
}
convert_to_long(dbh_id);
- if (fields->type != IS_ARRAY) {
+ if (Z_TYPE_P(fields) != IS_ARRAY) {
php_error(E_WARNING, "Expected array as second parameter");
RETURN_FALSE;
}
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
- num_fields = zend_hash_num_elements(fields->value.ht);
+ num_fields = zend_hash_num_elements(Z_ARRVAL_P(fields));
if (num_fields != dbh->db_nfields) {
php_error(E_WARNING, "Wrong number of fields specified");
@@ -289,7 +289,7 @@ PHP_FUNCTION(dbase_add_record)
dbf = dbh->db_fields;
for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
zval tmp;
- if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
+ if (zend_hash_index_find(Z_ARRVAL_P(fields), i, (void **)&field) == FAILURE) {
php_error(E_WARNING, "unexpected error");
efree(cp);
RETURN_FALSE;
@@ -298,7 +298,7 @@ PHP_FUNCTION(dbase_add_record)
tmp = **field;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
- sprintf(t_cp, cur_f->db_format, tmp.value.str.val);
+ sprintf(t_cp, cur_f->db_format, Z_STRVAL(tmp));
zval_dtor(&tmp);
t_cp += cur_f->db_flen;
}
@@ -336,18 +336,18 @@ PHP_FUNCTION(dbase_replace_record)
}
convert_to_long(dbh_id);
convert_to_long(recnum);
- if (fields->type != IS_ARRAY) {
+ if (Z_TYPE_P(fields) != IS_ARRAY) {
php_error(E_WARNING, "Expected array as second parameter");
RETURN_FALSE;
}
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
- num_fields = zend_hash_num_elements(fields->value.ht);
+ num_fields = zend_hash_num_elements(Z_ARRVAL_P(fields));
if (num_fields != dbh->db_nfields) {
php_error(E_WARNING, "Wrong number of fields specified");
@@ -363,7 +363,7 @@ PHP_FUNCTION(dbase_replace_record)
dbf = dbh->db_fields;
for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
- if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
+ if (zend_hash_index_find(Z_ARRVAL_P(fields), i, (void **)&field) == FAILURE) {
php_error(E_WARNING, "unexpected error");
efree(cp);
RETURN_FALSE;
@@ -373,7 +373,7 @@ PHP_FUNCTION(dbase_replace_record)
t_cp += cur_f->db_flen;
}
- if (put_dbf_record(dbh, recnum->value.lval, cp) < 0) {
+ if (put_dbf_record(dbh, Z_LVAL_P(recnum), cp) < 0) {
php_error(E_WARNING, "unable to put record at %ld", dbh->db_records);
efree(cp);
RETURN_FALSE;
@@ -401,17 +401,17 @@ PHP_FUNCTION(dbase_delete_record)
convert_to_long(dbh_id);
convert_to_long(record);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
- if (del_dbf_record(dbh, record->value.lval) < 0) {
- if (record->value.lval > dbh->db_records) {
- php_error(E_WARNING, "record %d out of bounds", record->value.lval);
+ if (del_dbf_record(dbh, Z_LVAL_P(record)) < 0) {
+ if (Z_LVAL_P(record) > dbh->db_records) {
+ php_error(E_WARNING, "record %d out of bounds", Z_LVAL_P(record));
} else {
- php_error(E_WARNING, "unable to delete record %d", record->value.lval);
+ php_error(E_WARNING, "unable to delete record %d", Z_LVAL_P(record));
}
RETURN_FALSE;
}
@@ -439,14 +439,14 @@ PHP_FUNCTION(dbase_get_record)
convert_to_long(dbh_id);
convert_to_long(record);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
- if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
- php_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
+ if ((data = get_dbf_record(dbh, Z_LVAL_P(record))) == NULL) {
+ php_error(E_WARNING, "Tried to read bad record %d", Z_LVAL_P(record));
RETURN_FALSE;
}
@@ -535,14 +535,14 @@ PHP_FUNCTION(dbase_get_record_with_names)
convert_to_long(dbh_id);
convert_to_long(record);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
+ dbh = zend_list_find(Z_LVAL_P(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
+ php_error(E_WARNING, "Unable to find database for identifier %d", Z_LVAL_P(dbh_id));
RETURN_FALSE;
}
- if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
- php_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
+ if ((data = get_dbf_record(dbh, Z_LVAL_P(record))) == NULL) {
+ php_error(E_WARNING, "Tried to read bad record %d", Z_LVAL_P(record));
RETURN_FALSE;
}
@@ -624,7 +624,7 @@ PHP_FUNCTION(dbase_create)
}
convert_to_string(filename);
- if (fields->type != IS_ARRAY) {
+ if (Z_TYPE_P(fields) != IS_ARRAY) {
php_error(E_WARNING, "Expected array as second parameter");
RETURN_FALSE;
}
@@ -642,7 +642,7 @@ PHP_FUNCTION(dbase_create)
RETURN_FALSE;
}
- num_fields = zend_hash_num_elements(fields->value.ht);
+ num_fields = zend_hash_num_elements(Z_ARRVAL_P(fields));
/* have to use regular malloc() because this gets free()d by
code in the dbase library */
@@ -679,7 +679,7 @@ PHP_FUNCTION(dbase_create)
for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
/* look up the first field */
- if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
+ if (zend_hash_index_find(Z_ARRVAL_P(fields), i, (void **)&field) == FAILURE) {
php_error(E_WARNING, "unable to find field %d", i);
free_dbf_head(dbh);
RETURN_FALSE;
@@ -698,12 +698,12 @@ PHP_FUNCTION(dbase_create)
RETURN_FALSE;
}
convert_to_string_ex(value);
- if ((*value)->value.str.len > 10 || (*value)->value.str.len == 0) {
- php_error(E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", (*value)->value.str.val);
+ if (Z_STRLEN_PP(value) > 10 || Z_STRLEN_PP(value) == 0) {
+ php_error(E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", Z_STRVAL_PP(value));
free_dbf_head(dbh);
RETURN_FALSE;
}
- copy_crimp(cur_f->db_fname, (*value)->value.str.val, (*value)->value.str.len);
+ copy_crimp(cur_f->db_fname, Z_STRVAL_PP(value), Z_STRLEN_PP(value));
/* field type */
if (zend_hash_index_find(Z_ARRVAL_PP (field), 1, (void **)&value) == FAILURE) {
@@ -711,7 +711,7 @@ PHP_FUNCTION(dbase_create)
RETURN_FALSE;
}
convert_to_string_ex(value);
- cur_f->db_type = toupper(*(*value)->value.str.val);
+ cur_f->db_type = toupper(*Z_STRVAL_PP(value));
cur_f->db_fdc = 0;
@@ -737,7 +737,7 @@ PHP_FUNCTION(dbase_create)
RETURN_FALSE;
}
convert_to_long_ex(value);
- cur_f->db_flen = (*value)->value.lval;
+ cur_f->db_flen = Z_LVAL_PP(value);
if (cur_f->db_type == 'N') {
if (zend_hash_index_find(Z_ARRVAL_PP (field), 3, (void **)&value) == FAILURE) {
@@ -746,7 +746,7 @@ PHP_FUNCTION(dbase_create)
RETURN_FALSE;
}
convert_to_long_ex(value);
- cur_f->db_fdc = (*value)->value.lval;
+ cur_f->db_fdc = Z_LVAL_PP(value);
}
break;
default: