diff options
author | Jeroen van Wolffelaar <jeroen@php.net> | 2001-09-25 21:58:48 +0000 |
---|---|---|
committer | Jeroen van Wolffelaar <jeroen@php.net> | 2001-09-25 21:58:48 +0000 |
commit | c03328857394bef36ffa9678d33079ad96e4a4e4 (patch) | |
tree | c0fb250db3b1bb996fc305bf56c2b74eb6d00935 | |
parent | 158d34c9a57816326e141e88e1409d9f377dc2ea (diff) | |
download | php-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.
138 files changed, 2902 insertions, 2902 deletions
diff --git a/ext/aspell/aspell.c b/ext/aspell/aspell.c index f07e26683b..d8e5a5387b 100644 --- a/ext/aspell/aspell.c +++ b/ext/aspell/aspell.c @@ -94,10 +94,10 @@ PHP_FUNCTION(aspell_new) if(argc==2) { convert_to_string_ex(personal) ; - sc=aspell_new((*master)->value.str.val, (*personal)->value.str.val); + sc=aspell_new(Z_STRVAL_PP(master), Z_STRVAL_PP(personal)); } else - sc=aspell_new((*master)->value.str.val, ""); + sc=aspell_new(Z_STRVAL_PP(master), ""); ind = zend_list_insert(sc, le_aspell); RETURN_LONG(ind); @@ -122,10 +122,10 @@ PHP_FUNCTION(aspell_suggest) } convert_to_long_ex(scin); convert_to_string_ex(word); - sc = (aspell *)zend_list_find((*scin)->value.lval, &type); + sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type); if(!sc) { - php_error(E_WARNING, "%d is not an ASPELL result index", (*scin)->value.lval); + php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin)); RETURN_FALSE; } @@ -133,7 +133,7 @@ PHP_FUNCTION(aspell_suggest) RETURN_FALSE; } - sug = aspell_suggest(sc, (*word)->value.str.val); + sug = aspell_suggest(sc, Z_STRVAL_PP(word)); for (i = 0; i != sug->size; ++i) { add_next_index_string(return_value, (char *)sug->data[i], 1); } @@ -156,13 +156,13 @@ PHP_FUNCTION(aspell_check) } convert_to_long_ex(scin); convert_to_string_ex(word); - sc= (aspell *) zend_list_find((*scin)->value.lval, &type); + sc= (aspell *) zend_list_find(Z_LVAL_PP(scin), &type); if(!sc) { - php_error(E_WARNING, "%d is not an ASPELL result index", (*scin)->value.lval); + php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin)); RETURN_FALSE; } - if (aspell_check(sc, (*word)->value.str.val)) + if (aspell_check(sc, Z_STRVAL_PP(word))) { RETURN_TRUE; } @@ -188,13 +188,13 @@ PHP_FUNCTION(aspell_check_raw) } convert_to_long_ex(scin); convert_to_string_ex(word); - sc = (aspell *)zend_list_find((*scin)->value.lval, &type); + sc = (aspell *)zend_list_find(Z_LVAL_PP(scin), &type); if(!sc) { - php_error(E_WARNING, "%d is not an ASPELL result index", (*scin)->value.lval); + php_error(E_WARNING, "%d is not an ASPELL result index", Z_LVAL_PP(scin)); RETURN_FALSE; } - if (aspell_check_raw(sc, (*word)->value.str.val)) + if (aspell_check_raw(sc, Z_STRVAL_PP(word))) { RETURN_TRUE; } diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index 5b50d92944..0cb4f11a2b 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -150,7 +150,7 @@ PHP_FUNCTION(bcadd) WRONG_PARAM_COUNT; } convert_to_long_ex(scale_param); - scale = (int) (*scale_param)->value.lval; + scale = (int) Z_LVAL_PP(scale_param); break; default: WRONG_PARAM_COUNT; @@ -161,12 +161,12 @@ PHP_FUNCTION(bcadd) bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); - bc_str2num(&first, (*left)->value.str.val, scale); - bc_str2num(&second, (*right)->value.str.val, scale); + bc_str2num(&first, Z_STRVAL_PP(left), scale); + bc_str2num(&second, Z_STRVAL_PP(right), scale); bc_add (first, second, &result, scale); - return_value->value.str.val = bc_num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = bc_num2str(result); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -193,7 +193,7 @@ PHP_FUNCTION(bcsub) WRONG_PARAM_COUNT; } convert_to_long_ex(scale_param); - scale = (int) (*scale_param)->value.lval; + scale = (int) Z_LVAL_PP(scale_param); break; default: WRONG_PARAM_COUNT; @@ -204,12 +204,12 @@ PHP_FUNCTION(bcsub) bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); - bc_str2num(&first, (*left)->value.str.val, scale); - bc_str2num(&second, (*right)->value.str.val, scale); + bc_str2num(&first, Z_STRVAL_PP(left), scale); + bc_str2num(&second, Z_STRVAL_PP(right), scale); bc_sub (first, second, &result, scale); - return_value->value.str.val = bc_num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = bc_num2str(result); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -236,7 +236,7 @@ PHP_FUNCTION(bcmul) WRONG_PARAM_COUNT; } convert_to_long_ex(scale_param); - scale = (int) (*scale_param)->value.lval; + scale = (int) Z_LVAL_PP(scale_param); break; default: WRONG_PARAM_COUNT; @@ -247,12 +247,12 @@ PHP_FUNCTION(bcmul) bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); - bc_str2num(&first, (*left)->value.str.val, scale); - bc_str2num(&second, (*right)->value.str.val, scale); + bc_str2num(&first, Z_STRVAL_PP(left), scale); + bc_str2num(&second, Z_STRVAL_PP(right), scale); bc_multiply (first, second, &result, scale); - return_value->value.str.val = bc_num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = bc_num2str(result); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -279,7 +279,7 @@ PHP_FUNCTION(bcdiv) WRONG_PARAM_COUNT; } convert_to_long_ex(scale_param); - scale = (int) (*scale_param)->value.lval; + scale = (int) Z_LVAL_PP(scale_param); break; default: WRONG_PARAM_COUNT; @@ -290,13 +290,13 @@ PHP_FUNCTION(bcdiv) bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); - bc_str2num(&first, (*left)->value.str.val, scale); - bc_str2num(&second, (*right)->value.str.val, scale); + bc_str2num(&first, Z_STRVAL_PP(left), scale); + bc_str2num(&second, Z_STRVAL_PP(right), scale); switch (bc_divide (first, second, &result, scale)) { case 0: /* OK */ - return_value->value.str.val = bc_num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = bc_num2str(result); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case -1: /* division by zero */ php_error(E_WARNING, "Division by zero"); @@ -331,13 +331,13 @@ PHP_FUNCTION(bcmod) bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); - bc_str2num(&first, (*left)->value.str.val, 0); - bc_str2num(&second, (*right)->value.str.val, 0); + bc_str2num(&first, Z_STRVAL_PP(left), 0); + bc_str2num(&second, Z_STRVAL_PP(right), 0); switch (bc_modulo(first, second, &result, 0)) { case 0: - return_value->value.str.val = bc_num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = bc_num2str(result); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case -1: php_error(E_WARNING, "Division by zero"); @@ -369,7 +369,7 @@ PHP_FUNCTION(bcpow) WRONG_PARAM_COUNT; } convert_to_long_ex(scale_param); - scale = (int) (*scale_param)->value.lval; + scale = (int) Z_LVAL_PP(scale_param); break; default: WRONG_PARAM_COUNT; @@ -380,12 +380,12 @@ PHP_FUNCTION(bcpow) bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); - bc_str2num(&first, (*left)->value.str.val, scale); - bc_str2num(&second, (*right)->value.str.val, scale); + bc_str2num(&first, Z_STRVAL_PP(left), scale); + bc_str2num(&second, Z_STRVAL_PP(right), scale); bc_raise (first, second, &result, scale); - return_value->value.str.val = bc_num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = bc_num2str(result); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; bc_free_num(&first); bc_free_num(&second); bc_free_num(&result); @@ -412,7 +412,7 @@ PHP_FUNCTION(bcsqrt) WRONG_PARAM_COUNT; } convert_to_long_ex(scale_param); - scale = (int) (*scale_param)->value.lval; + scale = (int) Z_LVAL_PP(scale_param); break; default: WRONG_PARAM_COUNT; @@ -420,11 +420,11 @@ PHP_FUNCTION(bcsqrt) } convert_to_string_ex(left); bc_init_num(&result); - bc_str2num(&result, (*left)->value.str.val, scale); + bc_str2num(&result, Z_STRVAL_PP(left), scale); if (bc_sqrt (&result, scale) != 0) { - return_value->value.str.val = bc_num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = bc_num2str(result); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } else { php_error(E_WARNING, "Square root of negative number"); } @@ -452,7 +452,7 @@ PHP_FUNCTION(bccomp) WRONG_PARAM_COUNT; } convert_to_long_ex(scale_param); - scale = (int) (*scale_param)->value.lval; + scale = (int) Z_LVAL_PP(scale_param); break; default: WRONG_PARAM_COUNT; @@ -464,10 +464,10 @@ PHP_FUNCTION(bccomp) bc_init_num(&first); bc_init_num(&second); - bc_str2num(&first, (*left)->value.str.val, scale); - bc_str2num(&second, (*right)->value.str.val, scale); - return_value->value.lval = bc_compare(first, second); - return_value->type = IS_LONG; + bc_str2num(&first, Z_STRVAL_PP(left), scale); + bc_str2num(&second, Z_STRVAL_PP(right), scale); + Z_LVAL_P(return_value) = bc_compare(first, second); + Z_TYPE_P(return_value) = IS_LONG; bc_free_num(&first); bc_free_num(&second); @@ -486,7 +486,7 @@ PHP_FUNCTION(bcscale) } convert_to_long_ex(new_scale); - bc_precision = (*new_scale)->value.lval; + bc_precision = Z_LVAL_PP(new_scale); RETURN_TRUE; } /* }}} */ diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index 2bf9b2454c..5d7f99a996 100644 --- a/ext/calendar/cal_unix.c +++ b/ext/calendar/cal_unix.c @@ -40,7 +40,7 @@ PHP_FUNCTION(unixtojd) if(myargc==1) { convert_to_long(timestamp); - t = timestamp->value.lval; + t = Z_LVAL_P(timestamp); } else { t = time(NULL); } @@ -69,7 +69,7 @@ PHP_FUNCTION(jdtounix) convert_to_long(jday); - uday = jday->value.lval - 2440588 /* J.D. of 1.1.1970 */; + uday = Z_LVAL_P(jday) - 2440588 /* J.D. of 1.1.1970 */; if(uday<0) RETURN_FALSE; /* before beginning of unix epoch */ if(uday>24755) RETURN_FALSE; /* behind end of unix epoch */ diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index acf55e923d..b10bc42036 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -296,7 +296,7 @@ PHP_FUNCTION(jdtogregorian) } convert_to_long_ex(julday); - SdnToGregorian((*julday)->value.lval, &year, &month, &day); + SdnToGregorian(Z_LVAL_PP(julday), &year, &month, &day); sprintf(date, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); @@ -318,7 +318,7 @@ PHP_FUNCTION(jdtogregorian) convert_to_long_ex(day); convert_to_long_ex(year); - jdate = GregorianToSdn((*year)->value.lval, (*month)->value.lval, (*day)->value.lval); + jdate = GregorianToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); RETURN_LONG(jdate); } @@ -337,7 +337,7 @@ PHP_FUNCTION(jdtogregorian) } convert_to_long_ex(julday); - SdnToJulian((*julday)->value.lval, &year, &month, &day); + SdnToJulian(Z_LVAL_PP(julday), &year, &month, &day); sprintf(date, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); @@ -359,7 +359,7 @@ PHP_FUNCTION(jdtogregorian) convert_to_long_ex(day); convert_to_long_ex(year); - jdate = JulianToSdn((*year)->value.lval, (*month)->value.lval, (*day)->value.lval); + jdate = JulianToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); RETURN_LONG(jdate); } @@ -379,7 +379,7 @@ PHP_FUNCTION(jdtogregorian) convert_to_long_ex(julday); - SdnToJewish((*julday)->value.lval, &year, &month, &day); + SdnToJewish(Z_LVAL_PP(julday), &year, &month, &day); sprintf(date, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); @@ -401,7 +401,7 @@ PHP_FUNCTION(jdtogregorian) convert_to_long_ex(day); convert_to_long_ex(year); - jdate = JewishToSdn((*year)->value.lval, (*month)->value.lval, (*day)->value.lval); + jdate = JewishToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); RETURN_LONG(jdate); } @@ -421,7 +421,7 @@ PHP_FUNCTION(jdtogregorian) convert_to_long_ex(julday); - SdnToFrench((*julday)->value.lval, &year, &month, &day); + SdnToFrench(Z_LVAL_PP(julday), &year, &month, &day); sprintf(date, "%i/%i/%i", month, day, year); RETURN_STRING(date, 1); @@ -443,7 +443,7 @@ PHP_FUNCTION(jdtogregorian) convert_to_long_ex(day); convert_to_long_ex(year); - jdate = FrenchToSdn((*year)->value.lval, (*month)->value.lval, (*day)->value.lval); + jdate = FrenchToSdn(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); RETURN_LONG(jdate); } @@ -465,10 +465,10 @@ PHP_FUNCTION(jdtogregorian) convert_to_long(julday); if(myargc==2) { convert_to_long(mode); - mymode = mode->value.lval; + mymode = Z_LVAL_P(mode); } - day = DayOfWeek(julday->value.lval); + day = DayOfWeek(Z_LVAL_P(julday)); daynamel = DayNameLong[day]; daynames = DayNameShort[day]; @@ -502,30 +502,30 @@ PHP_FUNCTION(jdtogregorian) convert_to_long_ex(julday); convert_to_long_ex(mode); - switch((*mode)->value.lval) { + switch(Z_LVAL_PP(mode)) { case CAL_MONTH_GREGORIAN_LONG: /* gregorian or julian month */ - SdnToGregorian((*julday)->value.lval, &year, &month, &day); + SdnToGregorian(Z_LVAL_PP(julday), &year, &month, &day); monthname = MonthNameLong[month]; break; case CAL_MONTH_JULIAN_SHORT: /* gregorian or julian month */ - SdnToJulian((*julday)->value.lval, &year, &month, &day); + SdnToJulian(Z_LVAL_PP(julday), &year, &month, &day); monthname = MonthNameShort[month]; break; case CAL_MONTH_JULIAN_LONG: /* gregorian or julian month */ - SdnToJulian((*julday)->value.lval, &year, &month, &day); + SdnToJulian(Z_LVAL_PP(julday), &year, &month, &day); monthname = MonthNameLong[month]; break; case CAL_MONTH_JEWISH: /* jewish month */ - SdnToJewish((*julday)->value.lval, &year, &month, &day); + SdnToJewish(Z_LVAL_PP(julday), &year, &month, &day); monthname = JewishMonthName[month]; break; case CAL_MONTH_FRENCH: /* french month */ - SdnToFrench((*julday)->value.lval, &year, &month, &day); + SdnToFrench(Z_LVAL_PP(julday), &year, &month, &day); monthname = FrenchMonthName[month]; break; default: /* default gregorian */ case CAL_MONTH_GREGORIAN_SHORT: /* gregorian or julian month */ - SdnToGregorian((*julday)->value.lval, &year, &month, &day); + SdnToGregorian(Z_LVAL_PP(julday), &year, &month, &day); monthname = MonthNameShort[month]; break; } diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c index 70c9dbffc9..525cb15bcc 100644 --- a/ext/calendar/easter.c +++ b/ext/calendar/easter.c @@ -45,7 +45,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm) WRONG_PARAM_COUNT; } convert_to_long(year_arg); - year = year_arg->value.lval; + year = Z_LVAL_P(year_arg); break; default: WRONG_PARAM_COUNT; @@ -109,12 +109,12 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm) te.tm_mday = easter-10; } - return_value->value.lval = mktime(&te); + Z_LVAL_P(return_value) = mktime(&te); } else { /* return the days after March 21 */ - return_value->value.lval = easter; + Z_LVAL_P(return_value) = easter; } - return_value->type = IS_LONG; + Z_TYPE_P(return_value) = IS_LONG; } diff --git a/ext/ccvs/ccvs.c b/ext/ccvs/ccvs.c index 59fb891afd..903e8c00f2 100644 --- a/ext/ccvs/ccvs.c +++ b/ext/ccvs/ccvs.c @@ -126,7 +126,7 @@ PHP_FUNCTION(ccvs_init) /* cv_init() */ convert_to_string_ex(name); - vsess = cv_init((*name)->value.str.val); + vsess = cv_init(Z_STRVAL_PP(name)); /* * -- In the case that we don't run error checking on the return value... -- @@ -173,7 +173,7 @@ PHP_FUNCTION(ccvs_done) /* cv_done() */ convert_to_string_ex(sess); /* Convert from the string representation back to a (void*) */ - vsess = hks_ptr_stringtoptr((*sess)->value.str.val); + vsess = hks_ptr_stringtoptr(Z_STRVAL_PP(sess)); cv_done(vsess); RETURN_STRING("OK", 1); @@ -201,10 +201,10 @@ PHP_FUNCTION(ccvs_new) /* cv_new() */ RETURN_FALSE; } - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; + invoice = Z_STRVAL_PP(pinvoice); r = cv_new(sess, invoice); @@ -236,10 +236,10 @@ PHP_FUNCTION(ccvs_add) /* cv_add() */ convert_to_string_ex(pinvoice); convert_to_string_ex(pargtype); convert_to_string_ex(pargval); - sess = hks_ptr_stringtoptr((*psess)->value.str.val); - invoice = (*pinvoice)->value.str.val; - argtype = cv_str2arg((*pargtype)->value.str.val); - argval = (*pargval)->value.str.val; + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); + invoice = Z_STRVAL_PP(pinvoice); + argtype = cv_str2arg(Z_STRVAL_PP(pargtype)); + argval = Z_STRVAL_PP(pargval); r = cv_add(sess, invoice, argtype, argval); @@ -274,8 +274,8 @@ PHP_FUNCTION(ccvs_delete) /* cv_delete() */ convert_to_string_ex(psess); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + invoice = Z_STRVAL_PP(pinvoice); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_delete(sess, invoice); @@ -300,8 +300,8 @@ PHP_FUNCTION(ccvs_auth) /* cv_auth() */ convert_to_string_ex(psess); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + invoice = Z_STRVAL_PP(pinvoice); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_auth(sess, invoice); @@ -326,8 +326,8 @@ PHP_FUNCTION(ccvs_return) /* cv_return() */ convert_to_string_ex(psess); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + invoice = Z_STRVAL_PP(pinvoice); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_return(sess, invoice); @@ -352,8 +352,8 @@ PHP_FUNCTION(ccvs_reverse) /* cv_reverse() */ convert_to_string_ex(psess); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + invoice = Z_STRVAL_PP(pinvoice); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_reverse(sess, invoice); @@ -378,8 +378,8 @@ PHP_FUNCTION(ccvs_sale) /* cv_sale() */ convert_to_string_ex(psess); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + invoice = Z_STRVAL_PP(pinvoice); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_sale(sess, invoice); @@ -404,8 +404,8 @@ PHP_FUNCTION(ccvs_void) /* cv_void() */ convert_to_string_ex(psess); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + invoice = Z_STRVAL_PP(pinvoice); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_void(sess, invoice); @@ -430,8 +430,8 @@ PHP_FUNCTION(ccvs_status) /* cv_status() */ convert_to_string_ex(psess); convert_to_string_ex(pinvoice); - invoice = (*pinvoice)->value.str.val; - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + invoice = Z_STRVAL_PP(pinvoice); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_status(sess, invoice); @@ -456,8 +456,8 @@ PHP_FUNCTION(ccvs_count) /* cv_count() */ convert_to_string_ex(psess); convert_to_string_ex(ptype); - type = cv_str2stat((*ptype)->value.str.val); - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + type = cv_str2stat(Z_STRVAL_PP(ptype)); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); r = cv_count(sess, type); @@ -483,11 +483,11 @@ PHP_FUNCTION(ccvs_lookup) /* cv_lookup() */ } convert_to_string_ex(psess); - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); convert_to_string_ex(ptype); - type = cv_str2stat((*ptype)->value.str.val); + type = cv_str2stat(Z_STRVAL_PP(ptype)); convert_to_long_ex(pinum); - inum = (*pinum)->value.lval; + inum = Z_LVAL_PP(pinum); r = cv_lookup(sess, type, inum); @@ -512,9 +512,9 @@ PHP_FUNCTION(ccvs_report) /* cv_report() */ } convert_to_string_ex(psess); - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); convert_to_string_ex(ptype); - type = cv_str2rep((*ptype)->value.str.val); + type = cv_str2rep(Z_STRVAL_PP(ptype)); r = cv_report(sess, type); @@ -540,11 +540,11 @@ PHP_FUNCTION(ccvs_command) /* cv_command() */ } convert_to_string_ex(psess); - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); convert_to_string_ex(ptype); - type = cv_str2cmd((*ptype)->value.str.val); + type = cv_str2cmd(Z_STRVAL_PP(ptype)); convert_to_string_ex(pargval); - argval = (*pargval)->value.str.val; + argval = Z_STRVAL_PP(pargval); r = cv_command(sess, type, argval); @@ -565,7 +565,7 @@ PHP_FUNCTION(ccvs_textvalue) /* cv_textvalue() */ } convert_to_string_ex(psess); - sess = hks_ptr_stringtoptr((*psess)->value.str.val); + sess = hks_ptr_stringtoptr(Z_STRVAL_PP(psess)); RETURN_STRING(cv_textvalue(sess), 1); } diff --git a/ext/com/COM.c b/ext/com/COM.c index e67084523b..93f296280d 100644 --- a/ext/com/COM.c +++ b/ext/com/COM.c @@ -433,7 +433,7 @@ PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_di PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) -PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange) +PHP_INI_ENTRY("Z_TYPE(com)lib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange) PHP_INI_END() @@ -467,7 +467,7 @@ PHP_FUNCTION(com_load) zend_get_parameters(ht, 3, &module_name, &server_name, &code_page); convert_to_long_ex(&code_page); - codepage = code_page->value.lval; + codepage = Z_LVAL_P(code_page); break; case 4: @@ -1123,7 +1123,7 @@ PHP_FUNCTION(com_load_typelib) case 2: zend_get_parameters(ht, 2, &arg_typelib, &arg_cis); convert_to_boolean_ex(&arg_cis); - if (arg_cis->value.lval) { + if (Z_LVAL_P(arg_cis)) { mode &= ~CONST_CS; } break; @@ -1171,7 +1171,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer 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: if (do_COM_offget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) { FREE_VARIANT(var_result); @@ -1261,7 +1261,7 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere for (element=property_reference->elements_list->head; element != property_reference->elements_list->tail; element=element->next) { overloaded_property = (zend_overloaded_element *) element->data; - switch (overloaded_property->type) { + switch (Z_TYPE_P(overloaded_property)) { case OE_IS_ARRAY: if (do_COM_offget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) { FREE_VARIANT(var_result); @@ -1347,7 +1347,7 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro } property = php_COM_get_property_handler(property_reference); - if (property.type == IS_NULL) { + if (Z_TYPE(property) == IS_NULL) { if (property.refcount == 1) { pval_destructor(&property); } diff --git a/ext/com/VARIANT.c b/ext/com/VARIANT.c index 4f521cdd4c..80b48550e6 100644 --- a/ext/com/VARIANT.c +++ b/ext/com/VARIANT.c @@ -133,7 +133,7 @@ static void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend zend_get_parameters(ht, 3, &data, &type, &code_page); php_pval_to_variant_ex(data, pVar, type, codepage TSRMLS_CC); convert_to_long(code_page); - codepage = code_page->value.lval; + codepage = Z_LVAL_P(code_page); break; default: ZEND_WRONG_PARAM_COUNT(); @@ -174,13 +174,13 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r ZVAL_FALSE(&result); } else { overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data; - switch (overloaded_property->type) { + switch (Z_TYPE_P(overloaded_property)) { case OE_IS_ARRAY: ZVAL_FALSE(&result); break; case OE_IS_OBJECT: - if (!strcmp(overloaded_property->element.value.str.val, "value")) { + if (!strcmp(overloaded_property->Z_STRVAL(element), "value")) { php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC); } else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) { ZVAL_LONG(&result, V_VT(var_arg)) diff --git a/ext/com/conversion.c b/ext/com/conversion.c index ea5cde6188..8449e41461 100644 --- a/ext/com/conversion.c +++ b/ext/com/conversion.c @@ -199,7 +199,7 @@ PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, SYSTEMTIME wintime; struct tm *phptime; - phptime = gmtime(&(pval_arg->value.lval)); + phptime = gmtime(&(Z_LVAL_P(pval_arg))); memset(&wintime, 0, sizeof(wintime)); wintime.wYear = phptime->tm_year + 1900; @@ -288,14 +288,14 @@ PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, case VT_CY|VT_BYREF: convert_to_double_ex(&pval_arg); - VarCyFromR8(pval_arg->value.dval, var_arg->pcyVal); + VarCyFromR8(Z_DVAL_P(pval_arg), var_arg->pcyVal); break; case VT_DATE|VT_BYREF: { SYSTEMTIME wintime; struct tm *phptime; - phptime = gmtime(&(pval_arg->value.lval)); + phptime = gmtime(&(Z_LVAL_P(pval_arg))); memset(&wintime, 0, sizeof(wintime)); wintime.wYear = phptime->tm_year + 1900; diff --git a/ext/cpdf/cpdf.c b/ext/cpdf/cpdf.c index 105f4e9956..d5d866a805 100644 --- a/ext/cpdf/cpdf.c +++ b/ext/cpdf/cpdf.c @@ -1065,9 +1065,9 @@ PHP_FUNCTION(cpdf_set_text_matrix) zend_hash_internal_pointer_reset(matrix); for(i=0; i<zend_hash_num_elements(matrix); i++) { zend_hash_get_current_data(matrix, (void *) &data); - switch(data->type) { + switch(Z_TYPE_P(data)) { case IS_DOUBLE: - *pdfmatrixptr++ = (float) data->value.dval; + *pdfmatrixptr++ = (float) Z_DVAL_P(data); break; default: *pdfmatrixptr++ = 0.0; diff --git a/ext/crack/crack.c b/ext/crack/crack.c index 6270e5787a..268e4b048f 100644 --- a/ext/crack/crack.c +++ b/ext/crack/crack.c @@ -168,7 +168,7 @@ ZEND_FUNCTION(crack_closedict) if (zend_get_parameters_ex(1, &dictionary) == FAILURE) { WRONG_PARAM_COUNT; } - id = (*dictionary)->value.lval; + id = Z_LVAL_PP(dictionary); break; default: WRONG_PARAM_COUNT; diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c index 1954355cc2..5667a2da4d 100644 --- a/ext/ctype/ctype.c +++ b/ext/ctype/ctype.c @@ -95,16 +95,16 @@ PHP_MINFO_FUNCTION(ctype) */ static int ctype(int (*iswhat)(int), zval **c) { - switch ((*c)->type) { + switch (Z_TYPE_PP(c)) { case IS_LONG: - return iswhat((*c)->value.lval); + return iswhat(Z_LVAL_PP(c)); case IS_STRING: { char *p; int n, len; convert_to_string_ex(c); - p=(*c)->value.str.val; - len = (*c)->value.str.len; + p=Z_STRVAL_PP(c); + len = Z_STRLEN_PP(c); for(n=0;n<len;n++) { if(!iswhat(*p++)) return 0; } diff --git a/ext/curl/curl.c b/ext/curl/curl.c index 76c967b516..21ec7e5cc3 100644 --- a/ext/curl/curl.c +++ b/ext/curl/curl.c @@ -577,7 +577,7 @@ PHP_FUNCTION(curl_init) } ch->handlers->write->method = PHP_CURL_STDOUT; - ch->handlers->write->type = PHP_CURL_ASCII; + ch->handlers->Z_TYPE_P(write) = PHP_CURL_ASCII; ch->handlers->read->method = PHP_CURL_DIRECT; ch->handlers->write_header->method = PHP_CURL_IGNORE; @@ -726,7 +726,7 @@ PHP_FUNCTION(curl_setopt) break; case CURLOPT_BINARYTRANSFER: convert_to_long_ex(zvalue); - ch->handlers->write->type = PHP_CURL_BINARY; + ch->handlers->Z_TYPE_P(write) = PHP_CURL_BINARY; break; case CURLOPT_WRITEFUNCTION: zval_add_ref(zvalue); @@ -874,7 +874,7 @@ PHP_FUNCTION(curl_exec) } if (ch->handlers->write->method == PHP_CURL_RETURN) { - if (ch->handlers->write->type != PHP_CURL_BINARY) + if (ch->handlers->Z_TYPE_P(write) != PHP_CURL_BINARY) smart_str_0(&ch->handlers->write->buf); RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0); } 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: diff --git a/ext/dbplus/dbplus.c b/ext/dbplus/dbplus.c index 46dbcaafd7..8b7ee4e207 100644 --- a/ext/dbplus/dbplus.c +++ b/ext/dbplus/dbplus.c @@ -254,7 +254,7 @@ PHP_FUNCTION(dbplus_open) convert_to_long_ex(writing); convert_to_long_ex(searchpath); - conn = cdb_open((*name)->value.str.val, (*writing)->value.lval, (*searchpath)->value.lval); + conn = cdb_open(Z_STRVAL_PP(name), Z_LVAL_PP(writing), Z_LVAL_PP(searchpath)); if(conn == NULL) { /* TODO error handling */ RETURN_FALSE; @@ -278,7 +278,7 @@ PHP_FUNCTION(dbplus_close) /* TODO resource type check */ - zend_list_delete((*conn)->value.lval); + zend_list_delete(Z_LVAL_PP(conn)); } /* }}} */ #endif diff --git a/ext/dbplus/php_dbplus.c b/ext/dbplus/php_dbplus.c index 2588c47020..9515c5f5dd 100644 --- a/ext/dbplus/php_dbplus.c +++ b/ext/dbplus/php_dbplus.c @@ -35,9 +35,9 @@ relf * aql_exec(char *, char *); tuple *rnext(relf *); -#define _STRING(x) ((*x)->value.str.val) -#define _INT(x) ((*x)->value.lval) -#define _HASH(x) ((*x)->value.ht) +#define _STRING(x) (Z_STRVAL_PP(x)) +#define _INT(x) (Z_LVAL_PP(x)) +#define _HASH(x) (Z_ARRVAL_PP(x)) #define DBPLUS_FETCH_RESOURCE(r, z) ZEND_FETCH_RESOURCE(r, relf *, z, -1, "dbplus_relation", le_dbplus_relation); \ if(!r) RETURN_LONG(ERR_UNKNOWN); @@ -50,7 +50,7 @@ var2tuple(relf *r, zval **zv, tuple *t) unsigned deg ; zval **element; - if ((*zv)->type!=IS_ARRAY) + if (Z_TYPE_PP(zv)!=IS_ARRAY) return 1; rtupinit(r, t); @@ -58,7 +58,7 @@ var2tuple(relf *r, zval **zv, tuple *t) ap = r->r_atts; deg = r->r_rel.rel_deg; do { - if(SUCCESS!=zend_hash_find((*zv)->value.ht, ap->att_name, strlen(ap->att_name)+1, (void **)&element)) { + if(SUCCESS!=zend_hash_find(Z_ARRVAL_PP(zv), ap->att_name, strlen(ap->att_name)+1, (void **)&element)) { continue; } @@ -71,13 +71,13 @@ var2tuple(relf *r, zval **zv, tuple *t) case FT_SHORT: /* short integer */ convert_to_long_ex(element); - AFFIX(ap, t)->f_short = (short) (*element)->value.lval; + AFFIX(ap, t)->f_short = (short) Z_LVAL_PP(element); break; case FT_UNSIGNED: /* unsigned short integer */ convert_to_long_ex(element); - AFFIX(ap, t)->f_unsigned = (unsigned) (*element)->value.lval; + AFFIX(ap, t)->f_unsigned = (unsigned) Z_LVAL_PP(element); break; case FT_LONG: @@ -85,31 +85,31 @@ var2tuple(relf *r, zval **zv, tuple *t) case FT_SEQUENCE: /* unique sequence number -> just a long to outsiders */ convert_to_long_ex(element); - AFFIX(ap, t)->f_long = (long4) (*element)->value.lval; + AFFIX(ap, t)->f_long = (long4) Z_LVAL_PP(element); break; case FT_DATE: /* date -> long containing YYYYMMDD */ convert_to_long_ex(element); - AFFIX(ap, t)->f_date = (long4) (*element)->value.lval; + AFFIX(ap, t)->f_date = (long4) Z_LVAL_PP(element); break; case FT_TIME: /* time as unix timestamp */ convert_to_long_ex(element); - AFFIX(ap, t)->f_time = (long4) (*element)->value.lval; + AFFIX(ap, t)->f_time = (long4) Z_LVAL_PP(element); break; case FT_FLOAT: /* single prec. floating point */ convert_to_double_ex(element); - AFFIX(ap, t)->f_float = (float) (*element)->value.dval; + AFFIX(ap, t)->f_float = (float) Z_DVAL_PP(element); break; case FT_DOUBLE: /* double prec. floating point */ convert_to_double_ex(element); - AFFIX(ap, t)->f_double = (double) (*element)->value.dval; + AFFIX(ap, t)->f_double = (double) Z_DVAL_PP(element); break; case FT_STRING: @@ -120,7 +120,7 @@ var2tuple(relf *r, zval **zv, tuple *t) case FT_ISOL: /* different variants of Strings */ convert_to_string_ex(element); - afput(ap, t, (field *)0, (*element)->value.str.val); + afput(ap, t, (field *)0, Z_STRVAL_PP(element)); break; default: @@ -148,7 +148,7 @@ tuple2var(relf * r, tuple * t, zval **zv) ap = r->r_atts; deg = r->r_rel.rel_deg; do { - MAKE_STD_ZVAL(element); element->type=IS_NULL; + MAKE_STD_ZVAL(element); Z_TYPE_P(element)=IS_NULL; switch(ap->att_type) { case FT_SHORT: @@ -187,8 +187,8 @@ tuple2var(relf * r, tuple * t, zval **zv) break; } - if(element->type!=IS_NULL) - zend_hash_update((*zv)->value.ht, + if(Z_TYPE_P(element)!=IS_NULL) + zend_hash_update(Z_ARRVAL_PP(zv), ap->att_name, strlen(ap->att_name)+1, (void *)&element, @@ -214,7 +214,7 @@ ary2constr(relf * r, zval** constr) /* init first */ db_coninit(r, &c); - if ((*constr)->type != IS_ARRAY) { + if (Z_TYPE_PP(constr) != IS_ARRAY) { php_error(E_WARNING, "Constraint is not an array"); return NULL; } @@ -225,7 +225,7 @@ ary2constr(relf * r, zval** constr) return NULL; } - switch((*zdata)->type) { + switch(Z_TYPE_PP(zdata)) { case IS_STRING: /* constraints in plain string array */ if (_HASH(constr)->nNumOfElements%3) { php_error(E_WARNING, "Constraint array has to have triples of strings"); @@ -266,7 +266,7 @@ ary2constr(relf * r, zval** constr) for(zend_hash_internal_pointer_reset(_HASH(constr)); SUCCESS==zend_hash_get_current_data(_HASH(constr), (void **)&zdata); zend_hash_move_forward(_HASH(constr))) { - if(!((*zdata)->type==IS_ARRAY)) { + if(!(Z_TYPE_PP(zdata)==IS_ARRAY)) { php_error(E_WARNING, "Constraint array element not an array"); return NULL; } @@ -428,7 +428,7 @@ PHP_FUNCTION(dbplus_close) DBPLUS_FETCH_RESOURCE(r, relation); - zend_list_delete((*relation)->value.lval); + zend_list_delete(Z_LVAL_PP(relation)); RETURN_TRUE; } @@ -507,7 +507,7 @@ PHP_FUNCTION(dbplus_find) DBPLUS_FETCH_RESOURCE(r, relation); - if ((*constr)->type != IS_ARRAY) { + if (Z_TYPE_PP(constr) != IS_ARRAY) { php_error(E_WARNING, "Constraint is not an array"); RETURN_LONG(ERR_UNKNOWN); } @@ -694,13 +694,13 @@ PHP_FUNCTION(dbplus_info) if (array_init(*result) == FAILURE) RETURN_LONG(ERR_USER); - if(!strcmp("atts", (*key)->value.str.val)) { + if(!strcmp("atts", Z_STRVAL_PP(key))) { do { MAKE_STD_ZVAL(element); ZVAL_STRING(element, ap->att_name, 1); - zend_hash_update((*result)->value.ht, + zend_hash_update(Z_ARRVAL_PP(result), ap->att_name, strlen(ap->att_name)+1, (void *)&element, @@ -797,7 +797,7 @@ PHP_FUNCTION(dbplus_open) convert_to_string_ex(tname); - r = cdb_open((*tname)->value.str.val, 1, 1); + r = cdb_open(Z_STRVAL_PP(tname), 1, 1); if(r == NULL) { /* TODO error handling */ RETURN_FALSE; @@ -882,7 +882,7 @@ PHP_FUNCTION(dbplus_rcreate) convert_to_string_ex(name); - switch ( (*domlist)->type ) { + switch ( Z_TYPE_PP(domlist) ) { case IS_STRING: convert_to_string_ex(domlist); break; @@ -1018,17 +1018,17 @@ PHP_FUNCTION(dbplus_resolve) } - MAKE_STD_ZVAL(element); element->type=IS_NULL; + MAKE_STD_ZVAL(element); Z_TYPE_P(element)=IS_NULL; ZVAL_LONG(element,sid); zend_hash_update(Z_ARRVAL_P(return_value), "sid", 4, &element, sizeof(zval *), NULL); - MAKE_STD_ZVAL(element); element->type=IS_NULL; + MAKE_STD_ZVAL(element); Z_TYPE_P(element)=IS_NULL; ZVAL_STRING(element,host,1); zend_hash_update(Z_ARRVAL_P(return_value), "host", 5, &element, sizeof(zval *), NULL); - MAKE_STD_ZVAL(element); element->type=IS_NULL; + MAKE_STD_ZVAL(element); Z_TYPE_P(element)=IS_NULL; ZVAL_STRING(element,host_path,1); zend_hash_update(Z_ARRVAL_P(return_value), "host_path", 10, &element, sizeof(zval *), NULL); @@ -1074,13 +1074,13 @@ PHP_FUNCTION(dbplus_rkeys) DBPLUS_FETCH_RESOURCE(r, relation); - switch((*domlist)->type) { + switch(Z_TYPE_PP(domlist)) { case IS_ARRAY: convert_to_array_ex(domlist); for(zend_hash_internal_pointer_reset(_HASH(domlist)); SUCCESS==zend_hash_get_current_data(_HASH(domlist), (void **)&zdata); zend_hash_move_forward(_HASH(domlist))) { - if((*zdata)->type==IS_STRING) + if(Z_TYPE_PP(zdata)==IS_STRING) keys[nkeys++] = _STRING(zdata); else { php_error(E_WARNING, "dbplus_rkeys: domlist array contains non-string value(s)"); @@ -1108,7 +1108,7 @@ PHP_FUNCTION(dbplus_rkeys) if(rnew) { /* TODO realy delete old relation resource ? */ #if 0 - zend_list_delete((*relation)->value.lval); + zend_list_delete(Z_LVAL_PP(relation)); #endif ZEND_REGISTER_RESOURCE(return_value, rnew, le_dbplus_relation); } else { @@ -1130,7 +1130,7 @@ PHP_FUNCTION(dbplus_ropen) convert_to_string_ex(tname); - r = ropen((*tname)->value.str.val, 0, 0); + r = ropen(Z_STRVAL_PP(tname), 0, 0); if(r == NULL) { /* TODO error handling */ RETURN_FALSE; @@ -1201,13 +1201,13 @@ PHP_FUNCTION(dbplus_rsecindex) DBPLUS_FETCH_RESOURCE(r, relation); - switch ( (*domlist)->type ) { + switch ( Z_TYPE_PP(domlist) ) { case IS_ARRAY: convert_to_array_ex(domlist); for(zend_hash_internal_pointer_reset(_HASH(domlist)); SUCCESS==zend_hash_get_current_data(_HASH(domlist), (void **)&zdata); zend_hash_move_forward(_HASH(domlist))) { - if((*zdata)->type==IS_STRING) + if(Z_TYPE_PP(zdata)==IS_STRING) keys[nkeys++] = _STRING(zdata); else { php_error(E_WARNING, "dbplus_rsecindex: domlist array contains non-string value(s)"); @@ -1236,7 +1236,7 @@ PHP_FUNCTION(dbplus_rsecindex) if(rnew) { /* TODO realy delete old relation resource ? */ - zend_list_delete((*relation)->value.lval); + zend_list_delete(Z_LVAL_PP(relation)); ZEND_REGISTER_RESOURCE(return_value, rnew, le_dbplus_relation); } else { @@ -1328,7 +1328,7 @@ PHP_FUNCTION(dbplus_setindexbynumber) convert_to_long_ex(idx_number); - RETURN_LONG(cdb_setindexbynumber(r, (*idx_number)->value.lval)); + RETURN_LONG(cdb_setindexbynumber(r, Z_LVAL_PP(idx_number))); } /* }}} */ diff --git a/ext/dbx/dbx.c b/ext/dbx/dbx.c index 5e5916c88a..862e4aea0f 100644 --- a/ext/dbx/dbx.c +++ b/ext/dbx/dbx.c @@ -100,7 +100,7 @@ void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char *function_name, zv MAKE_STD_ZVAL(zval_function_name); ZVAL_STRING(zval_function_name, function_name, 1); if (call_user_function_ex(EG(function_table), NULL, zval_function_name, returnvalue, number_of_arguments, params, 0, NULL TSRMLS_CC) == FAILURE) { - zend_error(E_ERROR, "function '%s' not found", zval_function_name->value.str.val); + zend_error(E_ERROR, "function '%s' not found", Z_STRVAL_P(zval_function_name)); } zval_dtor(zval_function_name); /* to free stringvalue memory */ FREE_ZVAL(zval_function_name); @@ -324,7 +324,7 @@ ZEND_FUNCTION(dbx_close) result = switch_dbx_close(&rv_success, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module); - result = (result && rv_success->value.lval)?1:0; + result = (result && Z_LVAL_P(rv_success))?1:0; FREE_ZVAL(rv_success); RETURN_LONG(result?1:0); @@ -378,8 +378,8 @@ ZEND_FUNCTION(dbx_query) convert_to_string_ex(arguments[1]); result = switch_dbx_query(&rv_result_handle, dbx_handle, dbx_database, arguments[1], INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module); /* boolean return value means either failure for any query or success for queries that don't return anything */ - if (!result || (rv_result_handle && rv_result_handle->type==IS_BOOL)) { - result = (result && rv_result_handle->value.lval)?1:0; + if (!result || (rv_result_handle && Z_TYPE_P(rv_result_handle)==IS_BOOL)) { + result = (result && Z_LVAL_P(rv_result_handle))?1:0; FREE_ZVAL(rv_result_handle); RETURN_LONG(result?1:0); } @@ -440,7 +440,7 @@ ZEND_FUNCTION(dbx_query) FREE_ZVAL(info_row_type); RETURN_LONG(0); } - for (col_index=0; col_index<rv_column_count->value.lval; ++col_index) { + for (col_index=0; col_index<Z_LVAL_P(rv_column_count); ++col_index) { zval *rv_column_name; zval *rv_column_type; /* get name */ @@ -448,7 +448,7 @@ ZEND_FUNCTION(dbx_query) ZVAL_LONG(rv_column_name, 0); result = switch_dbx_getcolumnname(&rv_column_name, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module); if (result) { - zend_hash_index_update(info_row_name->value.ht, col_index, (void *)&(rv_column_name), sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(info_row_name), col_index, (void *)&(rv_column_name), sizeof(zval *), NULL); } else { FREE_ZVAL(rv_column_name); } @@ -457,13 +457,13 @@ ZEND_FUNCTION(dbx_query) ZVAL_LONG(rv_column_type, 0); result = switch_dbx_getcolumntype(&rv_column_type, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module); if (result) { - zend_hash_index_update(info_row_type->value.ht, col_index, (void *)&(rv_column_type), sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(info_row_type), col_index, (void *)&(rv_column_type), sizeof(zval *), NULL); } else { FREE_ZVAL(rv_column_type); } } - zend_hash_update(info->value.ht, "name", 5, (void *) &info_row_name, sizeof(zval *), (void **) &inforow_ptr); - zend_hash_update(info->value.ht, "type", 5, (void *) &info_row_type, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(info), "name", 5, (void *) &info_row_name, sizeof(zval *), (void **) &inforow_ptr); + zend_hash_update(Z_ARRVAL_P(info), "type", 5, (void *) &info_row_type, sizeof(zval *), NULL); } /* fill each row array with fieldvalues (indexed (and assoc)) */ row_count=0; @@ -474,16 +474,16 @@ ZEND_FUNCTION(dbx_query) ZVAL_LONG(rv_row, 0); result = switch_dbx_getrow(&rv_row, &rv_result_handle, row_count, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module); if (result) { - zend_hash_index_update(data->value.ht, row_count, (void *)&(rv_row), sizeof(zval *), (void **) &row_ptr); + zend_hash_index_update(Z_ARRVAL_P(data), row_count, (void *)&(rv_row), sizeof(zval *), (void **) &row_ptr); /* associate results with fieldnames */ if (info_flags & DBX_RESULT_ASSOC) { zval **columnname_ptr, **actual_ptr; - for (col_index=0; col_index<rv_column_count->value.lval; ++col_index) { - zend_hash_index_find((*inforow_ptr)->value.ht, col_index, (void **) &columnname_ptr); - zend_hash_index_find((*row_ptr)->value.ht, col_index, (void **) &actual_ptr); + for (col_index=0; col_index<Z_LVAL_P(rv_column_count); ++col_index) { + zend_hash_index_find(Z_ARRVAL_PP(inforow_ptr), col_index, (void **) &columnname_ptr); + zend_hash_index_find(Z_ARRVAL_PP(row_ptr), col_index, (void **) &actual_ptr); (*actual_ptr)->refcount+=1; (*actual_ptr)->is_ref=1; - zend_hash_update((*row_ptr)->value.ht, (*columnname_ptr)->value.str.val, (*columnname_ptr)->value.str.len + 1, actual_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_PP(row_ptr), Z_STRVAL_PP(columnname_ptr), Z_STRLEN_PP(columnname_ptr) + 1, actual_ptr, sizeof(zval *), NULL); } } ++row_count; @@ -599,22 +599,22 @@ ZEND_FUNCTION(dbx_compare) convert_to_double_ex(zv_b); break; } - switch ((*zv_a)->type) { + switch (Z_TYPE_PP(zv_a)) { case IS_NULL: result=0; break; case IS_BOOL: case IS_LONG: case IS_CONSTANT: - ltemp = (*zv_a)->value.lval - (*zv_b)->value.lval; + ltemp = Z_LVAL_PP(zv_a) - Z_LVAL_PP(zv_b); result = (ltemp==0?0: (ltemp>0?1:-1)); break; case IS_DOUBLE: - dtemp = ((*zv_a)->value.dval - (*zv_b)->value.dval); + dtemp = (Z_DVAL_PP(zv_a) - Z_DVAL_PP(zv_b)); result = (dtemp==0?0: (dtemp>0?1:-1)); break; case IS_STRING: - ltemp = strcmp((*zv_a)->value.str.val, (*zv_b)->value.str.val); + ltemp = strcmp(Z_STRVAL_PP(zv_a), Z_STRVAL_PP(zv_b)); result = (ltemp==0?0: (ltemp>0?1:-1)); break; default: result=0; @@ -646,7 +646,7 @@ ZEND_FUNCTION(dbx_sort) } if (zend_hash_find(Z_OBJPROP_PP(arguments[0]), "data", 5, (void **) &zval_data)==FAILURE - || (*zval_data)->type != IS_ARRAY) { + || Z_TYPE_PP(zval_data) != IS_ARRAY) { zend_error(E_WARNING, "Wrong argument type for sort"); RETURN_LONG(0); } @@ -667,7 +667,7 @@ ZEND_FUNCTION(dbx_sort) int switch_dbx_connect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns connection handle as resource on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -683,7 +683,7 @@ int switch_dbx_connect(zval **rv, zval **host, zval **db, zval **username, zval int switch_dbx_pconnect(zval **rv, zval **host, zval **db, zval **username, zval **password, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns persistent connection handle as resource on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -699,7 +699,7 @@ int switch_dbx_pconnect(zval **rv, zval **host, zval **db, zval **username, zval int switch_dbx_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns 1 as long on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -714,7 +714,7 @@ int switch_dbx_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS, int switch_dbx_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_statement, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns 1 as long or result identifier as resource on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -729,7 +729,7 @@ int switch_dbx_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_st int switch_dbx_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns column-count as long on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -744,7 +744,7 @@ int switch_dbx_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION int switch_dbx_getcolumnname(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns column-name as string on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -759,7 +759,7 @@ int switch_dbx_getcolumnname(zval **rv, zval **result_handle, long column_index, int switch_dbx_getcolumntype(zval **rv, zval **result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns column-type as string on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -774,7 +774,7 @@ int switch_dbx_getcolumntype(zval **rv, zval **result_handle, long column_index, int switch_dbx_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns array[0..columncount-1] as strings on success or 0 as long on failure */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -789,7 +789,7 @@ int switch_dbx_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL int switch_dbx_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module) { /* returns string */ - switch ((*dbx_module)->value.lval) { + switch (Z_LVAL_PP(dbx_module)) { case DBX_MYSQL: return dbx_mysql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_ODBC: return dbx_odbc_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); case DBX_PGSQL: return dbx_pgsql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU); diff --git a/ext/dbx/dbx_fbsql.c b/ext/dbx/dbx_fbsql.c index edc7b5586e..f1d16386c2 100644 --- a/ext/dbx/dbx_fbsql.c +++ b/ext/dbx/dbx_fbsql.c @@ -41,7 +41,7 @@ int dbx_fbsql_connect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_connect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -50,12 +50,12 @@ int dbx_fbsql_connect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[0]=db; arguments[1]=&returned_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_select_db", &select_db_zval, number_of_arguments, arguments); - if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) { + if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) { if (select_db_zval) zval_ptr_dtor(&select_db_zval); /* also close connection */ number_of_arguments=1; arguments[0]=&returned_zval; - zend_list_addref(returned_zval->value.lval); + zend_list_addref(Z_LVAL_P(returned_zval)); dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_close", &select_db_zval, number_of_arguments, arguments); if (select_db_zval) zval_ptr_dtor(&select_db_zval); zval_ptr_dtor(&returned_zval); @@ -79,7 +79,7 @@ int dbx_fbsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_pconnect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -88,12 +88,12 @@ int dbx_fbsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval arguments[0]=db; arguments[1]=&returned_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_select_db", &select_db_zval, number_of_arguments, arguments); - if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) { + if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) { if (select_db_zval) zval_ptr_dtor(&select_db_zval); /* also close connection */ number_of_arguments=1; arguments[0]=&returned_zval; - zend_list_addref(returned_zval->value.lval); + zend_list_addref(Z_LVAL_P(returned_zval)); dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_close", &select_db_zval, number_of_arguments, arguments); if (select_db_zval) zval_ptr_dtor(&select_db_zval); zval_ptr_dtor(&returned_zval); @@ -114,7 +114,7 @@ int dbx_fbsql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_close", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_BOOL) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -134,7 +134,7 @@ int dbx_fbsql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_sta arguments[2]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_db_query", &returned_zval, number_of_arguments, arguments); /* fbsql_query returns a bool for success or failure, or a result_identifier for select statements */ - if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) { + if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -151,7 +151,7 @@ int dbx_fbsql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_ arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_num_fields", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_LONG) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -173,7 +173,7 @@ int dbx_fbsql_getcolumnname(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_field_name", &returned_zval, number_of_arguments, arguments); /* fbsql_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -197,7 +197,7 @@ int dbx_fbsql_getcolumntype(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_field_type", &returned_zval, number_of_arguments, arguments); /* fbsql_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -221,7 +221,7 @@ int dbx_fbsql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_ arguments[0]=result_handle; arguments[1]=&zval_resulttype; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_fetch_array", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_ARRAY) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_resulttype); return 0; @@ -241,7 +241,7 @@ int dbx_fbsql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; if (!dbx_handle) number_of_arguments=0; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "fbsql_error", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } diff --git a/ext/dbx/dbx_mssql.c b/ext/dbx/dbx_mssql.c index af66d7bbf2..834e5b9548 100644 --- a/ext/dbx/dbx_mssql.c +++ b/ext/dbx/dbx_mssql.c @@ -40,7 +40,7 @@ int dbx_mssql_connect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_connect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -49,12 +49,12 @@ int dbx_mssql_connect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[0]=db; arguments[1]=&returned_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments); - if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) { + if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) { if (select_db_zval) zval_ptr_dtor(&select_db_zval); /* also close connection */ number_of_arguments=1; arguments[0]=&returned_zval; - zend_list_addref(returned_zval->value.lval); + zend_list_addref(Z_LVAL_P(returned_zval)); dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &select_db_zval, number_of_arguments, arguments); if (select_db_zval) zval_ptr_dtor(&select_db_zval); zval_ptr_dtor(&returned_zval); @@ -78,7 +78,7 @@ int dbx_mssql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_pconnect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -87,12 +87,12 @@ int dbx_mssql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval arguments[0]=db; arguments[1]=&returned_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments); - if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) { + if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) { if (select_db_zval) zval_ptr_dtor(&select_db_zval); /* also close connection */ number_of_arguments=1; arguments[0]=&returned_zval; - zend_list_addref(returned_zval->value.lval); + zend_list_addref(Z_LVAL_P(returned_zval)); dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &select_db_zval, number_of_arguments, arguments); if (select_db_zval) zval_ptr_dtor(&select_db_zval); zval_ptr_dtor(&returned_zval); @@ -113,7 +113,7 @@ int dbx_mssql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_BOOL) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -140,7 +140,7 @@ int dbx_mssql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_sta arguments[1]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_query", &returned_zval, number_of_arguments, arguments); /* mssql_query returns a bool for success or failure, or a result_identifier for select statements */ - if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) { + if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -157,7 +157,7 @@ int dbx_mssql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_ arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_num_fields", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_LONG) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -179,7 +179,7 @@ int dbx_mssql_getcolumnname(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_field_name", &returned_zval, number_of_arguments, arguments); /* mssql_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -203,7 +203,7 @@ int dbx_mssql_getcolumntype(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_field_type", &returned_zval, number_of_arguments, arguments); /* mssql_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -223,7 +223,7 @@ int dbx_mssql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_ arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_fetch_row", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_ARRAY) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -241,7 +241,7 @@ int dbx_mssql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; if (!dbx_handle) number_of_arguments=0; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_get_last_message", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } diff --git a/ext/dbx/dbx_mysql.c b/ext/dbx/dbx_mysql.c index 0e5f86d8dc..4d00b1479a 100644 --- a/ext/dbx/dbx_mysql.c +++ b/ext/dbx/dbx_mysql.c @@ -40,7 +40,7 @@ int dbx_mysql_connect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_connect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -49,12 +49,12 @@ int dbx_mysql_connect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[0]=db; arguments[1]=&returned_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_select_db", &select_db_zval, number_of_arguments, arguments); - if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) { + if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) { if (select_db_zval) zval_ptr_dtor(&select_db_zval); /* also close connection */ number_of_arguments=1; arguments[0]=&returned_zval; - zend_list_addref(returned_zval->value.lval); + zend_list_addref(Z_LVAL_P(returned_zval)); dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments); if (select_db_zval) zval_ptr_dtor(&select_db_zval); zval_ptr_dtor(&returned_zval); @@ -78,7 +78,7 @@ int dbx_mysql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_pconnect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -87,12 +87,12 @@ int dbx_mysql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval arguments[0]=db; arguments[1]=&returned_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_select_db", &select_db_zval, number_of_arguments, arguments); - if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) { + if (!select_db_zval || (Z_TYPE_P(select_db_zval)==IS_BOOL && Z_LVAL_P(select_db_zval)==0) ) { if (select_db_zval) zval_ptr_dtor(&select_db_zval); /* also close connection */ number_of_arguments=1; arguments[0]=&returned_zval; - zend_list_addref(returned_zval->value.lval); + zend_list_addref(Z_LVAL_P(returned_zval)); dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments); if (select_db_zval) zval_ptr_dtor(&select_db_zval); zval_ptr_dtor(&returned_zval); @@ -113,7 +113,7 @@ int dbx_mysql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_BOOL) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -133,7 +133,7 @@ int dbx_mysql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_sta arguments[2]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_db_query", &returned_zval, number_of_arguments, arguments); /* mysql_query returns a bool for success or failure, or a result_identifier for select statements */ - if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) { + if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -150,7 +150,7 @@ int dbx_mysql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_ arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_num_fields", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_LONG) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -172,7 +172,7 @@ int dbx_mysql_getcolumnname(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_field_name", &returned_zval, number_of_arguments, arguments); /* mysql_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -196,7 +196,7 @@ int dbx_mysql_getcolumntype(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_field_type", &returned_zval, number_of_arguments, arguments); /* mysql_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -220,7 +220,7 @@ int dbx_mysql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_ arguments[0]=result_handle; arguments[1]=&zval_resulttype; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_fetch_array", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_ARRAY) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_resulttype); return 0; @@ -240,7 +240,7 @@ int dbx_mysql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; if (!dbx_handle) number_of_arguments=0; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_error", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } diff --git a/ext/dbx/dbx_oci8.c b/ext/dbx/dbx_oci8.c index b0ccb8ac89..87ab8f6b9b 100644 --- a/ext/dbx/dbx_oci8.c +++ b/ext/dbx/dbx_oci8.c @@ -41,7 +41,7 @@ int dbx_oci8_connect(zval **rv, zval **host, zval **db, zval **username, zval ** arguments[1]=password; arguments[2]=db; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCILogon", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -60,7 +60,7 @@ int dbx_oci8_pconnect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[1]=password; arguments[2]=db; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIPLogon", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -77,7 +77,7 @@ int dbx_oci8_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCILogOff", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_BOOL) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -97,7 +97,7 @@ int dbx_oci8_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_stat arguments[1]=sql_statement; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIParse", &returned_zval, number_of_arguments, arguments); /* OCIParse returns a bool for failure, or a statement_identifier for valid sql_statements */ - if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) { + if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -105,7 +105,7 @@ int dbx_oci8_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_stat arguments[0]=&returned_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIExecute", &execute_zval, number_of_arguments, arguments); /* OCIExecute returns a bool for success or failure???? */ - if (!execute_zval || execute_zval->type!=IS_BOOL) { + if (!execute_zval || Z_TYPE_P(execute_zval)!=IS_BOOL) { if (execute_zval) zval_ptr_dtor(&execute_zval); zval_ptr_dtor(&returned_zval); return 0; @@ -123,7 +123,7 @@ int dbx_oci8_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_P arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCINumCols", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_LONG) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -146,7 +146,7 @@ int dbx_oci8_getcolumnname(zval **rv, zval **result_handle, long column_index, I arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIColumnName", &returned_zval, number_of_arguments, arguments); /* OCIColumnName returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -171,7 +171,7 @@ int dbx_oci8_getcolumntype(zval **rv, zval **result_handle, long column_index, I arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIColumnType", &returned_zval, number_of_arguments, arguments); /* OCIColumnType returns a string??? */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -199,7 +199,7 @@ int dbx_oci8_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_F dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIFetchInto", &returned_zval, number_of_arguments, arguments); /* OCIFetchInto returns an integer, but the actual array is passed back in arg[1] */ /* I'm not sure how this will work, Thies, so this is something that should be especially tested! */ - if (!returned_zval || returned_zval->type!=IS_BOOL || returned_zval->value.lval==0) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL || Z_LVAL_P(returned_zval)==0) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_resulttype); return 0; @@ -221,12 +221,12 @@ int dbx_oci8_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) if (!dbx_handle) number_of_arguments=0; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIError", &returned_zval, number_of_arguments, arguments); /* OCIError should returns an assoc array containing code & message, dbx needs the message */ - if (!returned_zval || returned_zval->type!=IS_ARRAY) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } /* get the messagestring here */ - if (zend_hash_find(returned_zval->value.ht, "message", strlen("message")+1, (void **) &returned_message_zval)==FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(returned_zval), "message", strlen("message")+1, (void **) &returned_message_zval)==FAILURE) { /* oops! no msg? */ zval_ptr_dtor(&returned_zval); return 0; diff --git a/ext/dbx/dbx_odbc.c b/ext/dbx/dbx_odbc.c index 1bb593bea1..bcf6faa24a 100644 --- a/ext/dbx/dbx_odbc.c +++ b/ext/dbx/dbx_odbc.c @@ -39,7 +39,7 @@ int dbx_odbc_connect(zval **rv, zval **host, zval **db, zval **username, zval ** arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_connect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -58,7 +58,7 @@ int dbx_odbc_pconnect(zval **rv, zval **host, zval **db, zval **username, zval * arguments[1]=username; arguments[2]=password; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_pconnect", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -76,7 +76,7 @@ int dbx_odbc_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) int actual_resource_type; void *resource; - resource = zend_list_find((*dbx_handle)->value.lval, &actual_resource_type); + resource = zend_list_find(Z_LVAL_PP(dbx_handle), &actual_resource_type); if (!resource) { return 0; } @@ -84,12 +84,12 @@ int dbx_odbc_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_close", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_NULL) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_NULL) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } convert_to_long_ex(&returned_zval); - returned_zval->value.lval=1; + Z_LVAL_P(returned_zval)=1; MOVE_RETURNED_TO_RV(rv, returned_zval); return 1; } @@ -107,7 +107,7 @@ int dbx_odbc_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_stat arguments[1]=sql_statement; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_exec", &queryresult_zval, number_of_arguments, arguments); /* odbc_query returns a bool for failure, or a result_identifier for success */ - if (!queryresult_zval || queryresult_zval->type!=IS_RESOURCE) { + if (!queryresult_zval || Z_TYPE_P(queryresult_zval)!=IS_RESOURCE) { if (queryresult_zval) zval_ptr_dtor(&queryresult_zval); return 0; } @@ -118,9 +118,9 @@ int dbx_odbc_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_stat if (queryresult_zval) zval_ptr_dtor(&queryresult_zval); return 0; } - if (num_fields_zval->value.lval==0) { - (*rv)->type=IS_BOOL; - (*rv)->value.lval=1; /* success, but no data */ + if (Z_LVAL_P(num_fields_zval)==0) { + Z_TYPE_PP(rv)=IS_BOOL; + Z_LVAL_PP(rv)=1; /* success, but no data */ FREE_ZVAL(num_fields_zval); if (queryresult_zval) zval_ptr_dtor(&queryresult_zval); return 1; @@ -139,7 +139,7 @@ int dbx_odbc_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_P arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_num_fields", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_LONG || returned_zval->value.lval<0) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG || Z_LVAL_P(returned_zval)<0) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -161,7 +161,7 @@ int dbx_odbc_getcolumnname(zval **rv, zval **result_handle, long column_index, I arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_field_name", &returned_zval, number_of_arguments, arguments); /* odbc_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -185,7 +185,7 @@ int dbx_odbc_getcolumntype(zval **rv, zval **result_handle, long column_index, I arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_field_type", &returned_zval, number_of_arguments, arguments); /* odbc_field_name returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -215,19 +215,19 @@ int dbx_odbc_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_F if (!dbx_odbc_getcolumncount(&num_fields_zval, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU)) { return 0; } - field_count=num_fields_zval->value.lval; + field_count=Z_LVAL_P(num_fields_zval); FREE_ZVAL(num_fields_zval); /* fetch row */ number_of_arguments=1; arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_fetch_row", &fetch_row_result_zval, number_of_arguments, arguments); - if (!fetch_row_result_zval || fetch_row_result_zval->type!=IS_BOOL) { + if (!fetch_row_result_zval || Z_TYPE_P(fetch_row_result_zval)!=IS_BOOL) { if (fetch_row_result_zval) zval_ptr_dtor(&fetch_row_result_zval); return 0; } - if (fetch_row_result_zval->value.lval==0) { - (*rv)->type=IS_LONG; - (*rv)->value.lval=0; /* ok, no more rows */ + if (Z_LVAL_P(fetch_row_result_zval)==0) { + Z_TYPE_PP(rv)=IS_LONG; + Z_LVAL_PP(rv)=0; /* ok, no more rows */ zval_ptr_dtor(&fetch_row_result_zval); return 0; } @@ -247,7 +247,7 @@ int dbx_odbc_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_F arguments[0]=result_handle; arguments[1]=&field_index_zval; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_result", &field_result_zval, number_of_arguments, arguments); - zend_hash_index_update(returned_zval->value.ht, field_index, (void *)&(field_result_zval), sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(returned_zval), field_index, (void *)&(field_result_zval), sizeof(zval *), NULL); } FREE_ZVAL(field_index_zval); @@ -265,7 +265,7 @@ int dbx_odbc_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; if (!dbx_handle) number_of_arguments=0; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_errormsg", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } diff --git a/ext/dbx/dbx_pgsql.c b/ext/dbx/dbx_pgsql.c index a646b8b0c5..d74ff9f908 100644 --- a/ext/dbx/dbx_pgsql.c +++ b/ext/dbx/dbx_pgsql.c @@ -63,7 +63,7 @@ int dbx_pgsql_connect(zval **rv, zval **host, zval **db, zval **username, zval * } dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_connect", &returned_zval, nargs, args); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -108,7 +108,7 @@ int dbx_pgsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval } dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_pconnect", &returned_zval, nargs, args); - if (!returned_zval || returned_zval->type!=IS_RESOURCE) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -125,7 +125,7 @@ int dbx_pgsql_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_close", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_BOOL) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -147,7 +147,7 @@ int dbx_pgsql_query(zval **rv, zval **dbx_handle, zval **db_name, zval **sql_sta dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_exec", &returned_zval, nargs, args); /* pg_query returns a bool for success or failure, or a result_identifier for select statements */ - if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) { + if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && Z_TYPE_P(returned_zval)!=IS_RESOURCE)) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -164,7 +164,7 @@ int dbx_pgsql_getcolumncount(zval **rv, zval **result_handle, INTERNAL_FUNCTION_ arguments[0]=result_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_numfields", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_LONG) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_LONG) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } @@ -186,7 +186,7 @@ int dbx_pgsql_getcolumnname(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fieldname", &returned_zval, number_of_arguments, arguments); /* pg_fieldname returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -210,7 +210,7 @@ int dbx_pgsql_getcolumntype(zval **rv, zval **result_handle, long column_index, arguments[1]=&zval_column_index; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fieldtype", &returned_zval, number_of_arguments, arguments); /* pg_fieldtype returns a string */ - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_column_index); return 0; @@ -243,7 +243,7 @@ int dbx_pgsql_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_ if (save_error_reporting) { EG(error_reporting) = save_error_reporting; } - if (!returned_zval || returned_zval->type!=IS_ARRAY) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) { if (returned_zval) zval_ptr_dtor(&returned_zval); FREE_ZVAL(zval_row); return 0; @@ -263,7 +263,7 @@ int dbx_pgsql_error(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS) arguments[0]=dbx_handle; if (!dbx_handle) number_of_arguments=0; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_errormessage", &returned_zval, number_of_arguments, arguments); - if (!returned_zval || returned_zval->type!=IS_STRING) { + if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_STRING) { if (returned_zval) zval_ptr_dtor(&returned_zval); return 0; } diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index 36520be25f..2a64310b2f 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -312,7 +312,7 @@ static inline void node_wrapper_dtor(xmlNodePtr node) { zval *wrapper; - if (!node || node->type == XML_DTD_NODE) + if (!node || Z_TYPE_P(node) == XML_DTD_NODE) return; wrapper = dom_object_get_data(node); @@ -661,14 +661,14 @@ static zval *php_domobject_new(xmlNodePtr obj, int *found TSRMLS_DC) MAKE_STD_ZVAL(wrapper); - switch (obj->type) { + switch (Z_TYPE_P(obj)) { case XML_ELEMENT_NODE: { xmlNodePtr nodep = obj; object_init_ex(wrapper, domxmlelement_class_entry); rsrc_type = le_domxmlelementp; - add_property_long(wrapper, "type", nodep->type); + add_property_long(wrapper, "type", Z_TYPE_P(nodep)); add_property_stringl(wrapper, "tagname", (char *) nodep->name, strlen(nodep->name), 1); break; } @@ -680,7 +680,7 @@ static zval *php_domobject_new(xmlNodePtr obj, int *found TSRMLS_DC) rsrc_type = le_domxmltextp; content = xmlNodeGetContent(nodep); if (content) { - add_property_long(wrapper, "type", nodep->type); + add_property_long(wrapper, "type", Z_TYPE_P(nodep)); add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1); } break; @@ -727,9 +727,9 @@ static zval *php_domobject_new(xmlNodePtr obj, int *found TSRMLS_DC) xmlNodePtr nodep = obj; object_init_ex(wrapper, domxmlnode_class_entry); rsrc_type = le_domxmlnodep; - add_property_long(wrapper, "type", nodep->type); + add_property_long(wrapper, "type", Z_TYPE_P(nodep)); add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1); - if (obj->type == XML_ENTITY_REF_NODE) { + if (Z_TYPE_P(obj) == XML_ENTITY_REF_NODE) { content = xmlNodeGetContent(nodep); if (content) add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1); @@ -766,7 +766,7 @@ static zval *php_domobject_new(xmlNodePtr obj, int *found TSRMLS_DC) if (docp->encoding) add_property_stringl(wrapper, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1); add_property_long(wrapper, "standalone", docp->standalone); - add_property_long(wrapper, "type", docp->type); + add_property_long(wrapper, "type", Z_TYPE_P(docp)); add_property_long(wrapper, "compression", docp->compression); add_property_long(wrapper, "charset", docp->charset); break; @@ -787,7 +787,7 @@ static zval *php_domobject_new(xmlNodePtr obj, int *found TSRMLS_DC) } default: - php_error(E_WARNING, "Unsupported Node type: %d\n", obj->type); + php_error(E_WARNING, "Unsupported Node type: %d\n", Z_TYPE_P(obj)); return NULL; } @@ -1095,7 +1095,7 @@ PHP_FUNCTION(domxml_node_name) id = getThis(); n = php_dom_get_object(id, le_domxmlnodep, 0 TSRMLS_CC); - switch (n->type) { + switch (Z_TYPE_P(n)) { case XML_ELEMENT_NODE: str = n->name; break; @@ -1151,7 +1151,7 @@ PHP_FUNCTION(domxml_node_value) if (!n) { RETURN_FALSE; } - switch (n->type) { + switch (Z_TYPE_P(n)) { case XML_TEXT_NODE: case XML_COMMENT_NODE: case XML_CDATA_SECTION_NODE: @@ -1179,7 +1179,7 @@ PHP_FUNCTION(domxml_node_type) if (!n) { RETURN_FALSE; } - RETURN_LONG(n->type); + RETURN_LONG(Z_TYPE_P(n)); } /* }}} */ @@ -1327,7 +1327,7 @@ PHP_FUNCTION(domxml_node_has_attributes) id = getThis(); if (NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0 TSRMLS_CC))) RETURN_FALSE; - if (nodep->type != XML_ELEMENT_NODE) + if (Z_TYPE_P(nodep) != XML_ELEMENT_NODE) RETURN_FALSE; if (nodep->properties) { @@ -1399,7 +1399,7 @@ PHP_FUNCTION(domxml_node_children) /* Even if the nodep is a XML_DOCUMENT_NODE the type is at the same position. */ - if (nodep->type == XML_DOCUMENT_NODE) + if (Z_TYPE_P(nodep) == XML_DOCUMENT_NODE) last = ((xmlDoc *) nodep)->children; else last = nodep->children; @@ -1957,7 +1957,7 @@ PHP_FUNCTION(domxml_doc_document_element) } while (node) { - if (node->type == XML_ELEMENT_NODE) { + if (Z_TYPE_P(node) == XML_ELEMENT_NODE) { zval *rv; rv = php_domobject_new(node, &ret TSRMLS_CC); SEPARATE_ZVAL(&rv); @@ -2285,7 +2285,7 @@ PHP_FUNCTION(xmldocfile) if (docp->encoding) add_property_stringl(return_value, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1); add_property_long(return_value, "standalone", docp->standalone); - add_property_long(return_value, "type", docp->type); + add_property_long(return_value, "type", Z_TYPE_P(docp)); add_property_long(return_value, "compression", docp->compression); add_property_long(return_value, "charset", docp->charset); zend_list_addref(ret); @@ -2405,7 +2405,7 @@ static int node_namespace(zval **attributes, xmlNode *nodep TSRMLS_DC) add_property_stringl(pattr, "href", (char *) ns->href, strlen(ns->href), 1); if (ns->prefix) add_property_stringl(pattr, "prefix", (char *) ns->prefix, strlen(ns->prefix), 1); - add_property_long(pattr, "type", ns->type); + add_property_long(pattr, "type", Z_TYPE_P(ns)); /* } */ zend_hash_next_index_insert(Z_ARRVAL_PP(attributes), &pattr, sizeof(zval *), NULL); @@ -2424,7 +2424,7 @@ static int node_attributes(zval **attributes, xmlNode *nodep TSRMLS_DC) int count = 0; /* Get the children of the current node */ - if (nodep->type != XML_ELEMENT_NODE) + if (Z_TYPE_P(nodep) != XML_ELEMENT_NODE) return -1; attr = nodep->properties; if (!attr) @@ -2679,9 +2679,9 @@ static void php_xpathptr_eval(INTERNAL_FUNCTION_PARAMETERS, int mode, int expr) rv = php_xpathobject_new(xpathobjp, &ret TSRMLS_CC); SEPARATE_ZVAL(&rv); - add_property_long(rv, "type", xpathobjp->type); + add_property_long(rv, "type", Z_TYPE_P(xpathobjp)); - switch (xpathobjp->type) { + switch (Z_TYPE_P(xpathobjp)) { case XPATH_UNDEFINED: break; diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 2291d75e63..5e1470c3ea 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -1248,7 +1248,7 @@ PHP_FUNCTION(read_exif_data) for(i=0; i<ImageInfo.numComments; i++) { add_index_string(tmpi, i, (ImageInfo.Comments)[i], 0); } - zend_hash_update(return_value->value.ht, "Comments", 9, &tmpi, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "Comments", 9, &tmpi, sizeof(zval *), NULL); } } if(ImageInfo.ThumbnailSize && ImageInfo.Thumbnail) { diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c index d5d8541acc..9578bead12 100644 --- a/ext/fbsql/php_fbsql.c +++ b/ext/fbsql/php_fbsql.c @@ -383,7 +383,7 @@ PHP_MINIT_FUNCTION(fbsql) le_result = zend_register_list_destructors_ex(phpfbReleaseResult, NULL, "fbsql result", module_number); le_link = zend_register_list_destructors_ex(phpfbReleaseLink, NULL, "fbsql link", module_number); le_plink = zend_register_list_destructors_ex(NULL, phpfbReleasePLink, "fbsql plink", module_number); - fbsql_module_entry.type = type; + Z_TYPE(fbsql_module_entry) = type; REGISTER_LONG_CONSTANT("FBSQL_ASSOC", FBSQL_ASSOC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FBSQL_NUM", FBSQL_NUM, CONST_CS | CONST_PERSISTENT); @@ -521,7 +521,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant) le.ptr = phpLink; - le.type = le_plink; + Z_TYPE(le) = le_plink; if (zend_hash_update(&EG(persistent_list), name, strlen(name) + 1, &le, sizeof(le), NULL)==FAILURE) { free(phpLink->hostName); @@ -555,9 +555,9 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant) ptr = zend_list_find(link, &type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - return_value->value.lval = link; + Z_LVAL_P(return_value) = link; php_fbsql_set_default_link(link TSRMLS_CC); - return_value->type = IS_RESOURCE; + Z_TYPE_P(return_value) = IS_RESOURCE; return; } else { zend_hash_del(&EG(regular_list), name, strlen(name) + 1); @@ -581,8 +581,8 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant) ZEND_REGISTER_RESOURCE(return_value, phpLink, le_link); - le.ptr = (void *)return_value->value.lval; - le.type = le_index_ptr; + le.ptr = (void *)Z_LVAL_P(return_value); + Z_TYPE(le) = le_index_ptr; if (zend_hash_update(&EG(regular_list), name, strlen(name) + 1, &le, sizeof(le), NULL)==FAILURE) { free(phpLink->hostName); @@ -594,7 +594,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant) } FB_SQL_G(linkCount)++; } - php_fbsql_set_default_link(return_value->value.lval TSRMLS_CC); + php_fbsql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); } int phpfbFetchRow(PHPFBResult* result, int row) @@ -1085,14 +1085,14 @@ PHP_FUNCTION(fbsql_select_db) RETURN_FALSE; } convert_to_string_ex(dbname); - name = (*dbname)->value.str.val; + name = Z_STRVAL_PP(dbname); break; case 2: if (zend_get_parameters_ex(2, &dbname, &fbsql_link_index)==FAILURE) { RETURN_FALSE; } convert_to_string_ex(dbname); - name = (*dbname)->value.str.val; + name = Z_STRVAL_PP(dbname); id = -1; break; default: @@ -1144,14 +1144,14 @@ PHP_FUNCTION(fbsql_change_user) RETURN_FALSE; } convert_to_string_ex(database); - name = (*database)->value.str.val; + name = Z_STRVAL_PP(database); break; case 4: if (zend_get_parameters_ex(4, &user, &password, &database, &fbsql_link_index)==FAILURE) { RETURN_FALSE; } convert_to_string_ex(database); - name = (*database)->value.str.val; + name = Z_STRVAL_PP(database); id = -1; break; default: @@ -1161,15 +1161,15 @@ PHP_FUNCTION(fbsql_change_user) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(user); - userName = (*user)->value.str.val; + userName = Z_STRVAL_PP(user); convert_to_string_ex(password); - userPassword = (*password)->value.str.val; + userPassword = Z_STRVAL_PP(password); sprintf(buffer, "SET AUTHORIZATION %s;", userName); phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, buffer, phpLink); - if (return_value->value.lval) + if (Z_LVAL_P(return_value)) { free(phpLink->userName); phpLink->userName = strdup(userName); @@ -1208,7 +1208,7 @@ PHP_FUNCTION(fbsql_create_db) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(database_name); - databaseName = (*database_name)->value.str.val; + databaseName = Z_STRVAL_PP(database_name); status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName); if (status != FBUnknownStatus) @@ -1278,7 +1278,7 @@ PHP_FUNCTION(fbsql_drop_db) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(database_name); - databaseName = (*database_name)->value.str.val; + databaseName = Z_STRVAL_PP(database_name); status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName); if (status != FBStopped) @@ -1349,7 +1349,7 @@ PHP_FUNCTION(fbsql_start_db) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(database_name); - databaseName = (*database_name)->value.str.val; + databaseName = Z_STRVAL_PP(database_name); status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName); if ((status != FBStopped) && (status != FBRunning) && (status != FBStarting)) @@ -1424,7 +1424,7 @@ PHP_FUNCTION(fbsql_stop_db) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(database_name); - databaseName = (*database_name)->value.str.val; + databaseName = Z_STRVAL_PP(database_name); if (!php_fbsql_select_db(databaseName, phpLink TSRMLS_CC)) { RETURN_FALSE; @@ -1481,7 +1481,7 @@ PHP_FUNCTION(fbsql_db_status) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(database_name); - databaseName = (*database_name)->value.str.val; + databaseName = Z_STRVAL_PP(database_name); if (phpLink->execHandler) { RETURN_LONG(fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName)); @@ -1645,7 +1645,7 @@ PHP_FUNCTION(fbsql_query) convert_to_string_ex(query); - phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, (*query)->value.str.val, phpLink); + phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_STRVAL_PP(query), phpLink); } /* }}} */ @@ -1680,8 +1680,8 @@ PHP_FUNCTION(fbsql_db_query) convert_to_string_ex(query); convert_to_string_ex(dbname); - if (php_fbsql_select_db((*dbname)->value.str.val, phpLink TSRMLS_CC)) { - phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, (*query)->value.str.val, phpLink); + if (php_fbsql_select_db(Z_STRVAL_PP(dbname), phpLink TSRMLS_CC)) { + phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, Z_STRVAL_PP(query), phpLink); } else { RETURN_FALSE; } @@ -1764,7 +1764,7 @@ PHP_FUNCTION(fbsql_list_tables) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(database_name); - databaseName = (*database_name)->value.str.val; + databaseName = Z_STRVAL_PP(database_name); if (databaseName == NULL) { php_fbsql_select_db(FB_SQL_G(databaseName), phpLink TSRMLS_CC); @@ -1807,9 +1807,9 @@ PHP_FUNCTION(fbsql_list_fields) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(database_name); - databaseName = (*database_name)->value.str.val; + databaseName = Z_STRVAL_PP(database_name); convert_to_string_ex(table_name); - tableName = (*table_name)->value.str.val; + tableName = Z_STRVAL_PP(table_name); if (!php_fbsql_select_db(databaseName, phpLink TSRMLS_CC)) { RETURN_FALSE; @@ -2216,8 +2216,8 @@ void phpfbSqlResult (INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowI } else if (row[columnIndex]) { - phpfbColumnAsString(result, columnIndex, row[columnIndex], &return_value->value.str.len, &return_value->value.str.val); - return_value->type = IS_STRING; + phpfbColumnAsString(result, columnIndex, row[columnIndex], &Z_STRLEN_P(return_value), &Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } else { @@ -2268,20 +2268,20 @@ PHP_FUNCTION(fbsql_result) columnIndex = result->columnIndex; if (field) { - if (((*field)->type == IS_STRING) && (result->metaData)) + if ((Z_TYPE_PP(field) == IS_STRING) && (result->metaData)) { for (columnIndex =0; columnIndex < result->columnCount; columnIndex ++) { const FBCColumnMetaData* cmd = fbcmdColumnMetaDataAtIndex(result->metaData, columnIndex); const char* lbl = fbccmdLabelName(cmd); - if (strcmp((char*)lbl, (*field)->value.str.val) == 0) break; + if (strcmp((char*)lbl, Z_STRVAL_PP(field)) == 0) break; } if (columnIndex == result->columnCount) RETURN_FALSE; } else { convert_to_long_ex(field); - columnIndex = (*field)->value.lval; + columnIndex = Z_LVAL_PP(field); if (columnIndex < 0) { php_error(E_WARNING, "Illegal column index - %d", columnIndex); @@ -2427,8 +2427,8 @@ PHP_FUNCTION(fbsql_fetch_assoc) PHP_FUNCTION(fbsql_fetch_object) { php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC); - if (return_value->type==IS_ARRAY) { - object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht); + if (Z_TYPE_P(return_value)==IS_ARRAY) { + object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value)); } } /* }}} */ @@ -2670,7 +2670,7 @@ PHP_FUNCTION(fbsql_fetch_field) /* add_property_long(return_value, "primary_key", IS_PRI_KEY(fbsql_field->flags)?1:0); */ /* add_property_long(return_value, "multiple_key", (fbsql_field->flags&MULTIPLE_KEY_FLAG?1:0)); */ /* add_property_long(return_value, "unique_key", (fbsql_field->flags&UNIQUE_KEY_FLAG?1:0)); */ -/* add_property_long(return_value, "numeric", IS_NUM(fbsql_field->type)?1:0); */ +/* add_property_long(return_value, "numeric", IS_NUM(Z_TYPE_P(fbsql_field))?1:0); */ /* add_property_long(return_value, "blob", IS_BLOB(fbsql_field->flags)?1:0); */ /* add_property_long(return_value, "unsigned", (fbsql_field->flags&UNSIGNED_FLAG?1:0)); */ /* add_property_long(return_value, "zerofill", (fbsql_field->flags&ZEROFILL_FLAG?1:0)); */ @@ -3012,7 +3012,7 @@ PHP_FUNCTION(fbsql_free_result) } ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result); - zend_list_delete((*fbsql_result_index)->value.lval); + zend_list_delete(Z_LVAL_PP(fbsql_result_index)); RETURN_TRUE; } /* }}} */ diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c index 4c2fab52b6..83f44e1ea7 100644 --- a/ext/filepro/filepro.c +++ b/ext/filepro/filepro.c @@ -212,7 +212,7 @@ PHP_FUNCTION(filepro) FP_GLOBAL(fp_fcount) = -1; FP_GLOBAL(fp_keysize) = -1; - sprintf(workbuf, "%s/map", dir->value.str.val); + sprintf(workbuf, "%s/map", Z_STRVAL_P(dir)); if (PG(safe_mode) && (!php_checkuid(workbuf, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; @@ -271,7 +271,7 @@ PHP_FUNCTION(filepro) } fclose(fp); - FP_GLOBAL(fp_database) = estrndup(dir->value.str.val, dir->value.str.len); + FP_GLOBAL(fp_database) = estrndup(Z_STRVAL_P(dir), Z_STRLEN_P(dir)); RETVAL_TRUE; } @@ -366,14 +366,14 @@ PHP_FUNCTION(filepro_fieldname) } for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) { - if (i == fno->value.lval) { + if (i == Z_LVAL_P(fno)) { RETURN_STRING(lp->name, 1); } } php_error(E_WARNING, "filePro: unable to locate field number %d.\n", - fno->value.lval); + Z_LVAL_P(fno)); RETVAL_FALSE; } @@ -407,13 +407,13 @@ PHP_FUNCTION(filepro_fieldtype) } for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) { - if (i == fno->value.lval) { + if (i == Z_LVAL_P(fno)) { RETURN_STRING(lp->format, 1); } } php_error(E_WARNING, "filePro: unable to locate field number %d.\n", - fno->value.lval); + Z_LVAL_P(fno)); RETVAL_FALSE; } /* }}} */ @@ -446,13 +446,13 @@ PHP_FUNCTION(filepro_fieldwidth) } for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) { - if (i == fno->value.lval) { + if (i == Z_LVAL_P(fno)) { RETURN_LONG(lp->width); } } php_error(E_WARNING, "filePro: unable to locate field number %d.\n", - fno->value.lval); + Z_LVAL_P(fno)); RETVAL_FALSE; } /* }}} */ @@ -516,8 +516,8 @@ PHP_FUNCTION(filepro_retrieve) convert_to_long(rno); convert_to_long(fno); - fnum = fno->value.lval; - rnum = rno->value.lval; + fnum = Z_LVAL_P(fno); + rnum = Z_LVAL_P(rno); if (rnum < 0 || fnum < 0 || fnum >= FP_GLOBAL(fp_fcount)) { php_error(E_WARNING, "filepro: parameters out of range"); diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index e2da804663..db047110e0 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -449,7 +449,7 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type) if (ftp == NULL) return 0; - if (type == ftp->type) + if (type == Z_TYPE_P(ftp)) return 1; if (type == FTPTYPE_ASCII) @@ -464,7 +464,7 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type) if (!ftp_getresp(ftp) || ftp->resp != 200) return 0; - ftp->type = type; + Z_TYPE_P(ftp) = type; return 1; } @@ -1060,7 +1060,7 @@ ftp_getdata(ftpbuf_t *ftp) } data->listener = -1; data->fd = -1; - data->type = ftp->type; + Z_TYPE_P(data) = Z_TYPE_P(ftp); /* bind/listen */ if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 6d8f79c465..bf9245c1be 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -3224,15 +3224,15 @@ PHP_FUNCTION(imagepsbbox) space += T1_GetCharWidth(*f_ind, ' '); cur_x = cur_y = 0; - for (i = 0; i < (*str)->value.str.len; i++) { - if ((*str)->value.str.val[i] == ' ') { + for (i = 0; i < Z_STRLEN_PP(str); i++) { + if (Z_STRVAL_PP(str)[i] == ' ') { char_bbox.llx = char_bbox.lly = char_bbox.ury = 0; char_bbox.urx = char_width = space; } else { - char_bbox = T1_GetCharBBox(*f_ind, (*str)->value.str.val[i]); - char_width = T1_GetCharWidth(*f_ind, (*str)->value.str.val[i]); + char_bbox = T1_GetCharBBox(*f_ind, Z_STRVAL_PP(str)[i]); + char_width = T1_GetCharWidth(*f_ind, Z_STRVAL_PP(str)[i]); } - amount_kern = i ? T1_GetKerning(*f_ind, (*str)->value.str.val[i-1], (*str)->value.str.val[i]) : 0; + amount_kern = i ? T1_GetKerning(*f_ind, Z_STRVAL_PP(str)[i-1], Z_STRVAL_PP(str)[i]) : 0; /* Transfer character bounding box to right place */ x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x; @@ -3261,7 +3261,7 @@ PHP_FUNCTION(imagepsbbox) } } else { - str_bbox = T1_GetStringBBox(*f_ind, (*str)->value.str.val, (*str)->value.str.len, space, T1_KERNING); + str_bbox = T1_GetStringBBox(*f_ind, Z_STRVAL_PP(str), Z_STRLEN_PP(str), space, T1_KERNING); } if (T1_errno) RETURN_FALSE; @@ -3271,10 +3271,10 @@ PHP_FUNCTION(imagepsbbox) /* printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury); */ - add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*(*sz)->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*(*sz)->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*(*sz)->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*(*sz)->value.lval/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*Z_LVAL_PP(sz)/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*Z_LVAL_PP(sz)/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*Z_LVAL_PP(sz)/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*Z_LVAL_PP(sz)/1000)); #else php_error(E_WARNING, "ImagePsBBox: No T1lib support in this PHP build"); RETURN_FALSE; diff --git a/ext/gd/gdt1.c b/ext/gd/gdt1.c index 172eafa2b8..28c8668fa7 100644 --- a/ext/gd/gdt1.c +++ b/ext/gd/gdt1.c @@ -49,7 +49,7 @@ PHP_FUNCTION(imagepsloadfont) convert_to_string_ex(file); - f_ind = T1_AddFont((*file)->value.str.val); + f_ind = T1_AddFont(Z_STRVAL_PP(file)); if (f_ind < 0) { switch (f_ind) { @@ -95,10 +95,10 @@ PHP_FUNCTION(imagepscopyfont) convert_to_long(fnt); - of_ind = zend_list_find(fnt->value.lval, &type); + of_ind = zend_list_find(Z_LVAL_P(fnt), &type); if (type != GD_GLOBAL(le_ps_font)) { - php_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); + php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_P(fnt)); RETURN_FALSE; } @@ -148,14 +148,14 @@ PHP_FUNCTION(imagepsfreefont) convert_to_long_ex(fnt); - zend_list_find((*fnt)->value.lval, &type); + zend_list_find(Z_LVAL_PP(fnt), &type); if (type != T1_GLOBAL(le_ps_font)) { - php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval); + php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt)); RETURN_FALSE; } - zend_list_delete((*fnt)->value.lval); + zend_list_delete(Z_LVAL_PP(fnt)); RETURN_TRUE; } /* }}} */ @@ -176,15 +176,15 @@ PHP_FUNCTION(imagepsencodefont) convert_to_long_ex(fnt); convert_to_string_ex(enc); - f_ind = zend_list_find((*fnt)->value.lval, &type); + f_ind = zend_list_find(Z_LVAL_PP(fnt), &type); if (type != T1_GLOBAL(le_ps_font)) { - php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval); + php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt)); RETURN_FALSE; } - if ((enc_vector = T1_LoadEncoding((*enc)->value.str.val)) == NULL) { - php_error(E_WARNING, "Couldn't load encoding vector from %s", (*enc)->value.str.val); + if ((enc_vector = T1_LoadEncoding(Z_STRVAL_PP(enc))) == NULL) { + php_error(E_WARNING, "Couldn't load encoding vector from %s", Z_STRVAL_PP(enc)); RETURN_FALSE; } @@ -214,16 +214,16 @@ PHP_FUNCTION(imagepsextendfont) convert_to_long_ex(fnt); convert_to_double_ex(ext); - f_ind = zend_list_find((*fnt)->value.lval, &type); + f_ind = zend_list_find(Z_LVAL_PP(fnt), &type); if (type != T1_GLOBAL(le_ps_font)) { - php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval); + php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt)); RETURN_FALSE; } - if (T1_ExtendFont(f_ind, (*ext)->value.dval) != 0) RETURN_FALSE; + if (T1_ExtendFont(f_ind, Z_DVAL_PP(ext)) != 0) RETURN_FALSE; /* - f_ind->extend = ext->value.dval; + f_ind->extend = Z_DVAL_P(ext); */ RETURN_TRUE; } @@ -244,14 +244,14 @@ PHP_FUNCTION(imagepsslantfont) convert_to_long_ex(fnt); convert_to_double_ex(slt); - f_ind = zend_list_find((*fnt)->value.lval, &type); + f_ind = zend_list_find(Z_LVAL_PP(fnt), &type); if (type != T1_GLOBAL(le_ps_font)) { - php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval); + php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt)); RETURN_FALSE; } - if (T1_SlantFont(f_ind, (*slt)->value.dval) != 0) RETURN_FALSE; + if (T1_SlantFont(f_ind, Z_DVAL_PP(slt)) != 0) RETURN_FALSE; RETURN_TRUE; } /* }}} */ @@ -287,8 +287,8 @@ PHP_FUNCTION(imagepstext) convert_to_long_ex(bg); convert_to_long_ex(px); convert_to_long_ex(py); - x = (*px)->value.lval; - y = (*py)->value.lval; + x = Z_LVAL_PP(px); + y = Z_LVAL_PP(py); space = 0; aa_steps = 4; width = 0; @@ -306,41 +306,41 @@ PHP_FUNCTION(imagepstext) convert_to_long_ex(bg); convert_to_long_ex(px); convert_to_long_ex(py); - x = (*px)->value.lval; - y = (*py)->value.lval; + x = Z_LVAL_PP(px); + y = Z_LVAL_PP(py); convert_to_long_ex(sp); - space = (*sp)->value.lval; + space = Z_LVAL_PP(sp); convert_to_long_ex(aas); - aa_steps = (*aas)->value.lval; + aa_steps = Z_LVAL_PP(aas); convert_to_long_ex(wd); - width = (*wd)->value.lval; + width = Z_LVAL_PP(wd); convert_to_double_ex(ang); - angle = (*ang)->value.dval; + angle = Z_DVAL_PP(ang); break; default: WRONG_PARAM_COUNT; } - bg_img = zend_list_find((*img)->value.lval, &type); + bg_img = zend_list_find(Z_LVAL_PP(img), &type); if (!bg_img || type != GD_GLOBAL(le_gd)) { php_error(E_WARNING, "Unable to find image pointer"); RETURN_FALSE; } - f_ind = zend_list_find(fnt->value.lval, &type); + f_ind = zend_list_find(Z_LVAL_P(fnt), &type); if (!f_ind || type != GD_GLOBAL(le_ps_font)) { - php_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); + php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_P(fnt)); RETURN_FALSE; } - fg_rd = gdImageRed(bg_img, fg->value.lval); - fg_gr = gdImageGreen(bg_img, fg->value.lval); - fg_bl = gdImageBlue(bg_img, fg->value.lval); - bg_rd = gdImageRed(bg_img, bg->value.lval); - bg_gr = gdImageGreen(bg_img, bg->value.lval); - bg_bl = gdImageBlue(bg_img, bg->value.lval); + fg_rd = gdImageRed(bg_img, Z_LVAL_P(fg)); + fg_gr = gdImageGreen(bg_img, Z_LVAL_P(fg)); + fg_bl = gdImageBlue(bg_img, Z_LVAL_P(fg)); + bg_rd = gdImageRed(bg_img, Z_LVAL_P(bg)); + bg_gr = gdImageGreen(bg_img, Z_LVAL_P(bg)); + bg_bl = gdImageBlue(bg_img, Z_LVAL_P(bg)); for (i = 0; i < aa_steps; i++) { rd = bg_rd+(double)(fg_rd-bg_rd)/aa_steps*(i+1); @@ -371,17 +371,17 @@ PHP_FUNCTION(imagepstext) if (width) { #ifdef HAVE_LIBT1_OUTLINE - str_path = T1_GetCharOutline(f_ind->font_id, str->value.str.val[0], sz->value.lval, transform); + str_path = T1_GetCharOutline(f_ind->font_id, Z_STRVAL_P(str)[0], Z_LVAL_P(sz), transform); - for (i = 1; i < str->value.str.len; i++) { - amount_kern = (int) T1_GetKerning(f_ind->font_id, str->value.str.val[i-1], str->value.str.val[i]); - amount_kern += str->value.str.val[i-1] == ' ' ? space : 0; + for (i = 1; i < Z_STRLEN_P(str); i++) { + amount_kern = (int) T1_GetKerning(f_ind->font_id, Z_STRVAL_P(str)[i-1], Z_STRVAL_P(str)[i]); + amount_kern += Z_STRVAL_P(str)[i-1] == ' ' ? space : 0; add_width = (int) (amount_kern+width)/f_ind->extend; - char_path = T1_GetMoveOutline(f_ind->font_id, add_width, 0, 0, sz->value.lval, transform); + char_path = T1_GetMoveOutline(f_ind->font_id, add_width, 0, 0, Z_LVAL_P(sz), transform); str_path = T1_ConcatOutlines(str_path, char_path); - char_path = T1_GetCharOutline(f_ind->font_id, str->value.str.val[i], sz->value.lval, transform); + char_path = T1_GetCharOutline(f_ind->font_id, Z_STRVAL_P(str)[i], Z_LVAL_P(sz), transform); str_path = T1_ConcatOutlines(str_path, char_path); } str_img = T1_AAFillOutline(str_path, 0); @@ -390,8 +390,8 @@ PHP_FUNCTION(imagepstext) RETURN_FALSE; #endif } else { - str_img = T1_AASetString(f_ind->font_id, str->value.str.val, str->value.str.len, - space, T1_KERNING, sz->value.lval, transform); + str_img = T1_AASetString(f_ind->font_id, Z_STRVAL_P(str), Z_STRLEN_P(str), + space, T1_KERNING, Z_LVAL_P(sz), transform); } if (T1_errno) RETURN_FALSE; @@ -454,11 +454,11 @@ PHP_FUNCTION(imagepsbbox) convert_to_long(fnt); convert_to_long(sz); convert_to_long(sp); - space = sp->value.lval; + space = Z_LVAL_P(sp); convert_to_long(wd); - add_width = wd->value.lval; + add_width = Z_LVAL_P(wd); convert_to_double(ang); - angle = ang->value.dval * M_PI / 180; + angle = Z_DVAL_P(ang) * M_PI / 180; sin_a = sin(angle); cos_a = cos(angle); per_char = add_width || angle ? 1 : 0; @@ -467,10 +467,10 @@ PHP_FUNCTION(imagepsbbox) WRONG_PARAM_COUNT; } - f_ind = zend_list_find(fnt->value.lval, &type); + f_ind = zend_list_find(Z_LVAL_P(fnt), &type); if (type != GD_GLOBAL(le_ps_font)) { - php_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); + php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_P(fnt)); RETURN_FALSE; } @@ -483,15 +483,15 @@ PHP_FUNCTION(imagepsbbox) space += T1_GetCharWidth(f_ind->font_id, ' '); cur_x = cur_y = 0; - for (i = 0; i < str->value.str.len; i++) { - if (str->value.str.val[i] == ' ') { + for (i = 0; i < Z_STRLEN_P(str); i++) { + if (Z_STRVAL_P(str)[i] == ' ') { char_bbox.llx = char_bbox.lly = char_bbox.ury = 0; char_bbox.urx = char_width = space; } else { - char_bbox = T1_GetCharBBox(f_ind->font_id, str->value.str.val[i]); - char_width = T1_GetCharWidth(f_ind->font_id, str->value.str.val[i]); + char_bbox = T1_GetCharBBox(f_ind->font_id, Z_STRVAL_P(str)[i]); + char_width = T1_GetCharWidth(f_ind->font_id, Z_STRVAL_P(str)[i]); } - amount_kern = i ? T1_GetKerning(f_ind->font_id, str->value.str.val[i-1], str->value.str.val[i]) : 0; + amount_kern = i ? T1_GetKerning(f_ind->font_id, Z_STRVAL_P(str)[i-1], Z_STRVAL_P(str)[i]) : 0; /* Transfer character bounding box to right place */ x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x; @@ -520,7 +520,7 @@ PHP_FUNCTION(imagepsbbox) } } else { - str_bbox = T1_GetStringBBox(f_ind->font_id, str->value.str.val, str->value.str.len, space, T1_KERNING); + str_bbox = T1_GetStringBBox(f_ind->font_id, Z_STRVAL_P(str), Z_STRLEN_P(str), space, T1_KERNING); } if (T1_errno) RETURN_FALSE; @@ -530,10 +530,10 @@ PHP_FUNCTION(imagepsbbox) /* printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury); */ - add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz->value.lval/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz->value.lval/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*Z_LVAL_P(sz)/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*Z_LVAL_P(sz)/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*Z_LVAL_P(sz)/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*Z_LVAL_P(sz)/1000)); } /* }}} */ diff --git a/ext/hyperwave/hg_comm.c b/ext/hyperwave/hg_comm.c index 8354eb5900..d09ddad7b3 100644 --- a/ext/hyperwave/hg_comm.c +++ b/ext/hyperwave/hg_comm.c @@ -656,7 +656,7 @@ char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char else { convert_to_string_ex(script_name); for(i=0; i<5; i++) - scriptname[i] = (*script_name)->value.str.val; + scriptname[i] = Z_STRVAL_PP(script_name); } #if 0 diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index ff7de5497e..ed1ebd1103 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -215,7 +215,7 @@ PHP_MINIT_FUNCTION(hw) le_socketp = zend_register_list_destructors_ex(_close_hw_link, NULL, "hyperwave link", module_number); le_psocketp = zend_register_list_destructors_ex(NULL, _close_hw_plink, "hyperwave link persistent", module_number); le_document = zend_register_list_destructors_ex(_free_hw_document, NULL, "hyperwave document", module_number); - hw_module_entry.type = type; + Z_TYPE(hw_module_entry) = type; REGISTER_LONG_CONSTANT("HW_ATTR_LANG", HW_ATTR_LANG, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("HW_ATTR_NR", HW_ATTR_NR, CONST_CS | CONST_PERSISTENT); @@ -286,7 +286,7 @@ int make_return_objrec(pval **return_value, char **objrecs, int count) add_assoc_long(stat_arr, "FullCollectionHeadNr", fullcollheadnr); /* Add the stat array */ - zend_hash_next_index_insert((*return_value)->value.ht, &stat_arr, sizeof(zval), NULL); + zend_hash_next_index_insert(Z_ARRVAL_PP(return_value), &stat_arr, sizeof(zval), NULL); return 0; } @@ -318,9 +318,9 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr } if (array_init(*return_value) == FAILURE) { - (*return_value)->type = IS_STRING; - (*return_value)->value.str.val = empty_string; - (*return_value)->value.str.len = 0; + Z_TYPE_PP(return_value) = IS_STRING; + Z_STRVAL_PP(return_value) = empty_string; + Z_STRLEN_PP(return_value) = 0; return -1; } @@ -344,17 +344,17 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr str++; *str = '\0'; str++; - if(zend_hash_find(spec_arr->value.ht, attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) { + if(zend_hash_find(Z_ARRVAL_P(spec_arr), attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) { add_assoc_string(*return_value, attrname, str, 1); } else { zval *newarr; data = *dataptr; - spec = data->value.lval; + spec = Z_LVAL_P(data); - if(zend_hash_find((*return_value)->value.ht, attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) { + if(zend_hash_find(Z_ARRVAL_PP(return_value), attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) { MAKE_STD_ZVAL(newarr); array_init(newarr); - zend_hash_add((*return_value)->value.ht, attrname, strlen(attrname)+1, &newarr, sizeof(zval *), NULL); + zend_hash_add(Z_ARRVAL_PP(return_value), attrname, strlen(attrname)+1, &newarr, sizeof(zval *), NULL); } else { newarr = *dataptr; } @@ -391,8 +391,8 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr if(NULL == sarr){ /* spec_arr->refcount--; - zend_hash_destroy(spec_arr->value.ht); - efree(spec_arr->value.ht); + zend_hash_destroy(Z_ARRVAL_P(spec_arr)); + efree(Z_ARRVAL_P(spec_arr)); */ zval_dtor(spec_arr); efree(spec_arr); @@ -424,9 +424,9 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { MAKE_STD_ZVAL(group_arr); if (array_init(*return_value) == FAILURE) { - (*return_value)->type = IS_STRING; - (*return_value)->value.str.val = empty_string; - (*return_value)->value.str.len = 0; + Z_TYPE_PP(return_value) = IS_STRING; + Z_STRVAL_PP(return_value) = empty_string; + Z_STRLEN_PP(return_value) = 0; return -1; } @@ -493,7 +493,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { /* Add the title array, if we have one */ if(hasTitle) { - zend_hash_update((*return_value)->value.ht, "Title", 6, &title_arr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_PP(return_value), "Title", 6, &title_arr, sizeof(zval *), NULL); } else { efree(title_arr); @@ -502,7 +502,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { if(hasDescription) { /* Add the description array, if we have one */ - zend_hash_update((*return_value)->value.ht, "Description", 12, &desc_arr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_PP(return_value), "Description", 12, &desc_arr, sizeof(zval *), NULL); } else { efree(desc_arr); @@ -510,7 +510,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { if(hasKeyword) { /* Add the keyword array, if we have one */ - zend_hash_update((*return_value)->value.ht, "Keyword", 8, &keyword_arr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_PP(return_value), "Keyword", 8, &keyword_arr, sizeof(zval *), NULL); } else { efree(keyword_arr); @@ -518,7 +518,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { if(hasGroup) { /* Add the Group array, if we have one */ - zend_hash_update((*return_value)->value.ht, "Group", 6, &group_arr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_PP(return_value), "Group", 6, &group_arr, sizeof(zval *), NULL); } else { efree(group_arr); @@ -571,25 +571,25 @@ static char * make_objrec_from_array(HashTable *lht) { /* if(HASH_KEY_IS_STRING == keytype) { */ zend_hash_get_current_data(lht, (void **) &keydataptr); keydata = *keydataptr; - switch(keydata->type) { + switch(Z_TYPE_P(keydata)) { case IS_STRING: if(HASH_KEY_IS_STRING == keytype) - snprintf(str, BUFFERLEN, "%s=%s\n", key, keydata->value.str.val); + snprintf(str, BUFFERLEN, "%s=%s\n", key, Z_STRVAL_P(keydata)); else - snprintf(str, BUFFERLEN, "%s\n", keydata->value.str.val); + snprintf(str, BUFFERLEN, "%s\n", Z_STRVAL_P(keydata)); break; case IS_LONG: if(HASH_KEY_IS_STRING == keytype) - snprintf(str, BUFFERLEN, "%s=0x%lX\n", key, keydata->value.lval); + snprintf(str, BUFFERLEN, "%s=0x%lX\n", key, Z_LVAL_P(keydata)); else - snprintf(str, BUFFERLEN, "0x%lX\n", keydata->value.lval); + snprintf(str, BUFFERLEN, "0x%lX\n", Z_LVAL_P(keydata)); break; case IS_ARRAY: { int i, len, keylen, count; char *strarr, *ptr, *ptr1; - count = zend_hash_num_elements(keydata->value.ht); + count = zend_hash_num_elements(Z_ARRVAL_P(keydata)); if(count > 0) { - strarr = make_objrec_from_array(keydata->value.ht); + strarr = make_objrec_from_array(Z_ARRVAL_P(keydata)); len = strlen(strarr) - 1; keylen = strlen(key); if(NULL == (ptr = malloc(len + 1 + count*(keylen+1)))) { @@ -645,9 +645,9 @@ static int * make_ints_from_array(HashTable *lht) { return NULL; for(i=0; i<count; i++) { zend_hash_get_current_data(lht, (void **) &keydata); - switch((*keydata)->type) { + switch(Z_TYPE_PP(keydata)) { case IS_LONG: - objids[i] = (*keydata)->value.lval; + objids[i] = Z_LVAL_PP(keydata); break; default: objids[i] = 0; @@ -673,9 +673,9 @@ static char **make_strs_from_array(HashTable *arrht) { /* Iterate through hash */ while(zend_hash_get_current_data(arrht, (void **) &dataptr) == SUCCESS) { data = *dataptr; - switch(data->type) { + switch(Z_TYPE_P(data)) { case IS_STRING: - *ptr = estrdup(data->value.str.val); + *ptr = estrdup(Z_STRVAL_P(data)); /*fprintf(stderr, "carr[] = %s\n", *ptr); */ break; default: @@ -818,7 +818,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr->username = strdup("anonymous"); new_le.ptr = (void *) ptr; - new_le.type = le_psocketp; + Z_TYPE(new_le) = le_psocketp; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { php_error(E_ERROR, "Could not hash table with connection details"); @@ -834,14 +834,14 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) HwSG(num_persistent)++; } else { /*php_printf("Found already open connection\n"); */ - if (le->type != le_psocketp) { + if (Z_TYPE_P(le) != le_psocketp) { RETURN_FALSE; } ptr = le->ptr; } - return_value->value.lval = zend_list_insert(ptr, le_psocketp); - return_value->type = IS_RESOURCE; + Z_LVAL_P(return_value) = zend_list_insert(ptr, le_psocketp); + Z_TYPE_P(return_value) = IS_RESOURCE; } else { list_entry *index_ptr, new_index_ptr; @@ -855,14 +855,14 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) int type, link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (int) index_ptr->ptr; ptr = (hw_connection *) zend_list_find(link, &type); /* check if the link is still there */ if(!ptr || (type!=le_socketp && type!=le_psocketp)) { - return_value->value.lval = HwSG(default_link) = link; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = HwSG(default_link) = link; + Z_TYPE_P(return_value) = IS_LONG; efree(hashed_details); if(username) efree(username); if(password) efree(password); @@ -912,11 +912,11 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr->hostname = strdup(host); ptr->username = strdup("anonymous"); - return_value->value.lval = zend_list_insert(ptr, le_socketp); - return_value->type = IS_RESOURCE; + Z_LVAL_P(return_value) = zend_list_insert(ptr, le_socketp); + Z_TYPE_P(return_value) = IS_RESOURCE; - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { php_error(E_ERROR, "Could not update connection details in hash table"); if(host) efree(host); @@ -928,7 +928,7 @@ static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) efree(hashed_details); if(host) efree(host); - HwSG(default_link)=return_value->value.lval; + HwSG(default_link)=Z_LVAL_P(return_value); /* At this point we have a working connection. If userdata was given we are also indentified. @@ -1016,9 +1016,9 @@ PHP_FUNCTION(hw_info) php_printf("%s\n", str); efree(str); */ - return_value->value.str.len = strlen(str); - return_value->value.str.val = str; - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(str); + Z_STRVAL_P(return_value) = str; + Z_TYPE_P(return_value) = IS_STRING; return; } RETURN_FALSE; @@ -1335,8 +1335,8 @@ PHP_FUNCTION(hw_root) WRONG_PARAM_COUNT; } - return_value->value.lval = 0; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = 0; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1379,9 +1379,9 @@ PHP_FUNCTION(hw_stat) if(object == NULL) RETURN_FALSE; - return_value->value.str.val = object; - return_value->value.str.len = strlen(object); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = object; + Z_STRLEN_P(return_value) = strlen(object); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -1492,7 +1492,7 @@ php_printf("%s\n", ptr); add_assoc_string(user_arr, "TotalTime", name, 1); /* Add the user array */ - zend_hash_index_update(return_value->value.ht, i++, &user_arr, sizeof(pval), NULL); + zend_hash_index_update(Z_ARRVAL_P(return_value), i++, &user_arr, sizeof(pval), NULL); attrname = php_strtok_r(NULL, "\n", &strtok_buf); } @@ -1532,9 +1532,9 @@ PHP_FUNCTION(hw_dummy) RETURN_FALSE; php_printf("%s", object); - return_value->value.str.val = object; - return_value->value.str.len = strlen(object); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = object; + Z_STRLEN_P(return_value) = strlen(object); + Z_TYPE_P(return_value) = IS_STRING; } } /* }}} */ @@ -1592,12 +1592,12 @@ PHP_FUNCTION(hw_getobject) zend_hash_internal_pointer_reset(lht); for(i=0; i<count; i++) { zend_hash_get_current_data(lht, (void **) &keydata); - switch((*keydata)->type) { + switch(Z_TYPE_PP(keydata)) { case IS_LONG: - ids[i] = (*keydata)->value.lval; + ids[i] = Z_LVAL_PP(keydata); break; default: - ids[i] = (*keydata)->value.lval; + ids[i] = Z_LVAL_PP(keydata); } zend_hash_move_forward(lht); } @@ -1793,12 +1793,12 @@ PHP_FUNCTION(hw_changeobject) zend_hash_get_current_key(newobjarr, &key, &ind, 0); zend_hash_get_current_data(newobjarr, (void *) &dataptr); data = *dataptr; - switch(data->type) { + switch(Z_TYPE_P(data)) { case IS_STRING: - if(strlen(data->value.str.val) == 0) + if(strlen(Z_STRVAL_P(data)) == 0) snprintf(newattribute, BUFFERLEN, "rem %s", key); else - snprintf(newattribute, BUFFERLEN, "add %s=%s", key, data->value.str.val); + snprintf(newattribute, BUFFERLEN, "add %s=%s", key, Z_STRVAL_P(data)); noinsert = 0; break; default: @@ -1893,10 +1893,10 @@ PHP_FUNCTION(hw_modifyobject) zend_hash_get_current_key(addobjarr, &key, &ind, 0); zend_hash_get_current_data(addobjarr, (void *) &dataptr); data = *dataptr; - switch(data->type) { + switch(Z_TYPE_P(data)) { case IS_STRING: - if(strlen(data->value.str.val) > 0) { - snprintf(addattribute, BUFFERLEN, "add %s=%s", key, data->value.str.val); + if(strlen(Z_STRVAL_P(data)) > 0) { + snprintf(addattribute, BUFFERLEN, "add %s=%s", key, Z_STRVAL_P(data)); /* fprintf(stderr, "add: %s\n", addattribute); */ noinsert = 0; } @@ -1904,9 +1904,9 @@ PHP_FUNCTION(hw_modifyobject) case IS_ARRAY: { int i, len, keylen, count; char *strarr, *ptr, *ptr1; - count = zend_hash_num_elements(data->value.ht); + count = zend_hash_num_elements(Z_ARRVAL_P(data)); if(count > 0) { - strarr = make_objrec_from_array(data->value.ht); + strarr = make_objrec_from_array(Z_ARRVAL_P(data)); len = strlen(strarr) - 1; keylen = strlen(key); if(NULL == (ptr = malloc(len + 1 + count*(keylen+1+4)))) { @@ -1961,10 +1961,10 @@ PHP_FUNCTION(hw_modifyobject) zend_hash_get_current_key(remobjarr, &key, &ind, 0); zend_hash_get_current_data(remobjarr, (void *) &dataptr); data = *dataptr; - switch(data->type) { + switch(Z_TYPE_P(data)) { case IS_STRING: - if(strlen(data->value.str.val) > 0) { - snprintf(remattribute, BUFFERLEN, "rem %s=%s", key, data->value.str.val); + if(strlen(Z_STRVAL_P(data)) > 0) { + snprintf(remattribute, BUFFERLEN, "rem %s=%s", key, Z_STRVAL_P(data)); noinsert = 0; } else { snprintf(remattribute, BUFFERLEN, "rem %s", key); @@ -1974,9 +1974,9 @@ PHP_FUNCTION(hw_modifyobject) case IS_ARRAY: { int i, len, keylen, count; char *strarr, *ptr, *ptr1; - count = zend_hash_num_elements(data->value.ht); + count = zend_hash_num_elements(Z_ARRVAL_P(data)); if(count > 0) { - strarr = make_objrec_from_array(data->value.ht); + strarr = make_objrec_from_array(Z_ARRVAL_P(data)); len = strlen(strarr) - 1; keylen = strlen(key); if(NULL == (ptr = malloc(len + 1 + count*(keylen+1+4)))) { @@ -2131,16 +2131,16 @@ void php_hw_mvcp(INTERNAL_FUNCTION_PARAMETERS, int mvcp) { zval *keydata, **keydataptr; zend_hash_get_current_data(src_arr, (void **) &keydataptr); keydata = *keydataptr; - if(keydata->type == IS_LONG) { - if(0 != (ptr->lasterror = send_getobject(ptr->socket, keydata->value.lval, &objrec))) { + if(Z_TYPE_P(keydata) == IS_LONG) { + if(0 != (ptr->lasterror = send_getobject(ptr->socket, Z_LVAL_P(keydata), &objrec))) { efree(collIDs); efree(docIDs); RETURN_FALSE; } if(0 == fnAttributeCompare(objrec, "DocumentType", "collection")) - collIDs[collIDcount++] = keydata->value.lval; + collIDs[collIDcount++] = Z_LVAL_P(keydata); else - docIDs[docIDcount++] = keydata->value.lval; + docIDs[docIDcount++] = Z_LVAL_P(keydata); efree(objrec); } zend_hash_move_forward(src_arr); @@ -2238,8 +2238,8 @@ PHP_FUNCTION(hw_gettext) doc->attributes = attributes; doc->bodytag = bodytag; doc->size = count; - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } } /* }}} */ @@ -2342,8 +2342,8 @@ PHP_FUNCTION(hw_getcgi) doc->attributes = attributes; doc->bodytag = NULL; doc->size = count; - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } } #undef BUFFERLEN @@ -2384,8 +2384,8 @@ PHP_FUNCTION(hw_getremote) doc->attributes = attributes; doc->bodytag = NULL; doc->size = count; - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } } /* }}} */ @@ -2473,8 +2473,8 @@ php_printf("count = %d, remainder = <HR>%s---<HR>", count, remainder); doc->attributes = strdup(objrec); doc->bodytag = NULL; doc->size = strlen(doc->data); - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } else { if (array_init(return_value) == FAILURE) { efree(offsets); @@ -2581,19 +2581,19 @@ PHP_FUNCTION(hw_pipedocument) zend_hash_get_current_key(prefixarray, &key, &ind, 0); zend_hash_get_current_data(prefixarray, (void *) &dataptr); data = *dataptr; - if (data->type != IS_STRING) { + if (Z_TYPE_P(data) != IS_STRING) { php_error(E_WARNING, "%s must be a String", key); RETURN_FALSE; } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) { - urlprefix[HW_DEFAULT_LINK] = data->value.str.val; + urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_IMAGE_LINK") == 0 ) { - urlprefix[HW_IMAGE_LINK] = data->value.str.val; + urlprefix[HW_IMAGE_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_BACKGROUND_LINK") == 0 ) { - urlprefix[HW_BACKGROUND_LINK] = data->value.str.val; + urlprefix[HW_BACKGROUND_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_INTAG_LINK") == 0 ) { - urlprefix[HW_INTAG_LINK] = data->value.str.val; + urlprefix[HW_INTAG_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) { - urlprefix[HW_APPLET_LINK] = data->value.str.val; + urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data); } else { php_error(E_WARNING, "%s is not a valid urlprefix", key); RETURN_FALSE; @@ -2633,8 +2633,8 @@ PHP_FUNCTION(hw_pipedocument) doc->bodytag = bodytag; doc->size = count; /* fprintf(stderr, "size = %d\n", count); */ - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } } /* }}} */ @@ -2702,8 +2702,8 @@ PHP_FUNCTION(hw_oldpipedocument) doc->bodytag = bodytag; doc->size = count; /* fprintf(stderr, "size = %d\n", count); */ - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } } /* }}} */ @@ -2768,8 +2768,8 @@ PHP_FUNCTION(hw_pipecgi) doc->attributes = attributes; doc->bodytag = NULL; doc->size = count; - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } } #undef BUFFERLEN @@ -2855,8 +2855,8 @@ PHP_FUNCTION(hw_new_document) doc->attributes = strdup(arg1->value.str.val); doc->bodytag = NULL; doc->size = arg3->value.lval; - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -2958,8 +2958,8 @@ PHP_FUNCTION(hw_new_document_from_file) doc->attributes = strdup((*arg1)->value.str.val); doc->bodytag = NULL; doc->size = bcount; - return_value->value.lval = zend_list_insert(doc, le_document); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(doc, le_document); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ #undef BUFSIZE @@ -4013,9 +4013,9 @@ PHP_FUNCTION(hw_getusername) RETURN_FALSE; } - return_value->value.str.val = estrdup(ptr->username); - return_value->value.str.len = strlen(ptr->username); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrdup(ptr->username); + Z_STRLEN_P(return_value) = strlen(ptr->username); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -4054,9 +4054,9 @@ PHP_FUNCTION(hw_identify) RETURN_FALSE; } - return_value->value.str.val = userdata; - return_value->value.str.len = strlen(userdata); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = userdata; + Z_STRLEN_P(return_value) = strlen(userdata); + Z_TYPE_P(return_value) = IS_STRING; if(ptr->username) free(ptr->username); str = userdata; while((*str != 0) && (*str != ' ')) @@ -4424,19 +4424,19 @@ PHP_FUNCTION(hw_insertanchors) zend_hash_get_current_key(prefixarray, &key, &ind, 0); zend_hash_get_current_data(prefixarray, (void *) &dataptr); data = *dataptr; - if (data->type != IS_STRING) { + if (Z_TYPE_P(data) != IS_STRING) { php_error(E_WARNING, "%s must be a String", key); RETURN_FALSE; } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) { - urlprefix[HW_DEFAULT_LINK] = data->value.str.val; + urlprefix[HW_DEFAULT_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_IMAGE_LINK") == 0 ) { - urlprefix[HW_IMAGE_LINK] = data->value.str.val; + urlprefix[HW_IMAGE_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_BACKGROUND_LINK") == 0 ) { - urlprefix[HW_BACKGROUND_LINK] = data->value.str.val; + urlprefix[HW_BACKGROUND_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_INTAG_LINK") == 0 ) { - urlprefix[HW_INTAG_LINK] = data->value.str.val; + urlprefix[HW_INTAG_LINK] = Z_STRVAL_P(data); } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) { - urlprefix[HW_APPLET_LINK] = data->value.str.val; + urlprefix[HW_APPLET_LINK] = Z_STRVAL_P(data); } else { php_error(E_WARNING, "%s is not a valid urlprefix", key); RETURN_FALSE; diff --git a/ext/icap/php_icap.c b/ext/icap/php_icap.c index d64c25a2da..a9732e67f1 100644 --- a/ext/icap/php_icap.c +++ b/ext/icap/php_icap.c @@ -140,10 +140,10 @@ static int add_assoc_object(pval *arg, char *key, pval *tmp) { HashTable *symtable; - if (arg->type == IS_OBJECT) { + if (Z_TYPE_P(arg) == IS_OBJECT) { symtable = Z_OBJPROP_P(arg); } else { - symtable = arg->value.ht; + symtable = Z_ARRVAL_P(arg); } return zend_hash_update(symtable, key, strlen(key)+1, (void *) &tmp, sizeof(pval *), NULL); } @@ -170,15 +170,15 @@ void php_icap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) convert_to_string(calendar); convert_to_string(user); convert_to_string(passwd); - strcpy(icap_user, user->value.str.val); - strcpy(icap_password, passwd->value.str.val); + strcpy(icap_user, Z_STRVAL_P(user)); + strcpy(icap_password, Z_STRVAL_P(passwd)); if(myargc ==4) { convert_to_long(options); - flags=options->value.lval; + flags=Z_LVAL_P(options); } - icap_stream = cal_open(NULL, calendar->value.str.val, 0); + icap_stream = cal_open(NULL, Z_STRVAL_P(calendar), 0); if (!icap_stream) { - php_error(E_WARNING, "Couldn't open stream %s\n", calendar->value.str.val); + php_error(E_WARNING, "Couldn't open stream %s\n", Z_STRVAL_P(calendar)); RETURN_FALSE; } @@ -204,7 +204,7 @@ PHP_FUNCTION(icap_close) WRONG_PARAM_COUNT; } convert_to_long(streamind); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -212,7 +212,7 @@ PHP_FUNCTION(icap_close) } if(myargcount==2) { convert_to_long(options); - flags = options->value.lval; + flags = Z_LVAL_P(options); icap_le_struct->flags = flags; } zend_list_delete(ind); @@ -249,7 +249,7 @@ PHP_FUNCTION(icap_reopen) } convert_to_long(streamind); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -259,12 +259,12 @@ PHP_FUNCTION(icap_reopen) convert_to_string(calendar); if(myargc == 3) { convert_to_long(options); - flags = options->value.lval; + flags = Z_LVAL_P(options); icap_le_struct->flags = cl_flags; } /* - icap_stream = cal_connect(calendar->value.str.val); - cal_login(icap_stream, calendar->value.str.val); + icap_stream = cal_connect(Z_STRVAL_P(calendar)); + cal_login(icap_stream, Z_STRVAL_P(calendar)); */ if (icap_stream == NULL) { php_error(E_WARNING, "Couldn't re-open stream\n"); @@ -290,7 +290,7 @@ PHP_FUNCTION(icap_expunge) convert_to_long(streamind); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); @@ -320,7 +320,7 @@ PHP_FUNCTION(icap_fetch_event) } convert_to_long(streamind); convert_to_long(eventid); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -329,7 +329,7 @@ PHP_FUNCTION(icap_fetch_event) if(myargcount==3) { convert_to_long(options); } - cal_fetch(icap_le_struct->icap_stream, eventid->value.lval, &myevent); + cal_fetch(icap_le_struct->icap_stream, Z_LVAL_P(eventid), &myevent); object_init(return_value); add_property_long(return_value, "id", myevent->id); @@ -396,7 +396,7 @@ PHP_FUNCTION(icap_list_events) convert_to_long(streamind); convert_to_array(begindate); if(myargc == 3) convert_to_array(enddate); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); @@ -411,37 +411,37 @@ PHP_FUNCTION(icap_list_events) } begincal.has_time=0; endcal.has_time=0; - if(zend_hash_find(begindate->value.ht, "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(begindate), "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - begincal.year=(*pvalue)->value.lval; + begincal.year=Z_LVAL_PP(pvalue); } - if(zend_hash_find(begindate->value.ht, "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(begindate), "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - begincal.mon=(*pvalue)->value.lval; + begincal.mon=Z_LVAL_PP(pvalue); } - if(zend_hash_find(begindate->value.ht, "day", sizeof("day"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(begindate), "day", sizeof("day"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - begincal.mday=(*pvalue)->value.lval; + begincal.mday=Z_LVAL_PP(pvalue); } if(myargc == 3) { - if(zend_hash_find(enddate->value.ht, "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(enddate), "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - endcal.year=(*pvalue)->value.lval; + endcal.year=Z_LVAL_PP(pvalue); } - if(zend_hash_find(enddate->value.ht, "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(enddate), "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - endcal.mon=(*pvalue)->value.lval; + endcal.mon=Z_LVAL_PP(pvalue); } - if(zend_hash_find(enddate->value.ht, "day", sizeof("day"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(enddate), "day", sizeof("day"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - endcal.mday=(*pvalue)->value.lval; + endcal.mday=Z_LVAL_PP(pvalue); } } @@ -475,7 +475,7 @@ PHP_FUNCTION(icap_create_calendar) convert_to_long(streamind); convert_to_string(calendar); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { @@ -483,7 +483,7 @@ PHP_FUNCTION(icap_create_calendar) RETURN_FALSE; } /* - if (icap_create(icap_le_struct->icap_stream, calendar->value.str.val)) + if (icap_create(icap_le_struct->icap_stream, Z_STRVAL_P(calendar))) { RETURN_TRUE; } @@ -511,7 +511,7 @@ PHP_FUNCTION(icap_rename_calendar) convert_to_long(streamind); convert_to_string(src_calendar); convert_to_string(dest_calendar); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { @@ -519,7 +519,7 @@ PHP_FUNCTION(icap_rename_calendar) RETURN_FALSE; } /* - if(icap_rename(icap_le_struct->icap_stream, src_calendar->value.str.val, dest_calendar->value.str.val)) {RETURN_TRUE;} + if(icap_rename(icap_le_struct->icap_stream, Z_STRVAL_P(src_calendar), Z_STRVAL_P(dest_calendar))) {RETURN_TRUE;} else {RETURN_FALSE; } */ } @@ -549,7 +549,7 @@ PHP_FUNCTION(icap_list_alarms) convert_to_long(streamind); convert_to_array(date); convert_to_array(time); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { @@ -562,31 +562,31 @@ PHP_FUNCTION(icap_list_alarms) } mydate.has_date=1; mydate.has_time=1; - if(zend_hash_find(date->value.ht, "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(date), "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - mydate.year=(*pvalue)->value.lval; + mydate.year=Z_LVAL_PP(pvalue); } - if(zend_hash_find(date->value.ht, "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(date), "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - mydate.mon=(*pvalue)->value.lval; + mydate.mon=Z_LVAL_PP(pvalue); } - if(zend_hash_find(date->value.ht, "day", sizeof("day"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(date), "day", sizeof("day"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - mydate.mday=(*pvalue)->value.lval; + mydate.mday=Z_LVAL_PP(pvalue); } - if(zend_hash_find(time->value.ht, "hour", sizeof("hour"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(time), "hour", sizeof("hour"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - mydate.hour=(*pvalue)->value.lval; + mydate.hour=Z_LVAL_PP(pvalue); } - if(zend_hash_find(time->value.ht, "minute", sizeof("minute"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(time), "minute", sizeof("minute"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - mydate.min=(*pvalue)->value.lval; + mydate.min=Z_LVAL_PP(pvalue); } mydate.sec=0; g_cal_list=NULL; @@ -619,7 +619,7 @@ PHP_FUNCTION(icap_delete_calendar) convert_to_long(streamind); convert_to_string(calendar); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { @@ -627,7 +627,7 @@ PHP_FUNCTION(icap_delete_calendar) RETURN_FALSE; } - if (icap_delete_calendar(icap_le_struct->icap_stream, calendar->value.str.val)) + if (icap_delete_calendar(icap_le_struct->icap_stream, Z_STRVAL_P(calendar))) { RETURN_TRUE; } @@ -654,14 +654,14 @@ PHP_FUNCTION(icap_delete_event) convert_to_long(streamind); convert_to_long(uid); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!icap_le_struct ) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - if (cal_remove(icap_le_struct->icap_stream, uid->value.lval)) + if (cal_remove(icap_le_struct->icap_stream, Z_LVAL_P(uid))) { RETURN_TRUE; } @@ -707,7 +707,7 @@ PHP_FUNCTION(icap_store_event) convert_to_long(streamind); convert_to_array(storeobject); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); @@ -721,109 +721,109 @@ PHP_FUNCTION(icap_store_event) RETURN_FALSE; } myevent=calevent_new(); - if(zend_hash_find(storeobject->value.ht, "uid", sizeof("uid"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "uid", sizeof("uid"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->id=(*pvalue)->value.lval; + myevent->id=Z_LVAL_PP(pvalue); } - if(zend_hash_find(storeobject->value.ht, "public", sizeof("public"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "public", sizeof("public"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->public=(*pvalue)->value.lval; + myevent->public=Z_LVAL_PP(pvalue); } - if(zend_hash_find(storeobject->value.ht, "category", sizeof("category"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "category", sizeof("category"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_string(*pvalue); - myevent->category=strdup((*pvalue)->value.str.val); + myevent->category=strdup(Z_STRVAL_PP(pvalue)); } - if(zend_hash_find(storeobject->value.ht, "title", sizeof("title"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "title", sizeof("title"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_string(*pvalue); - myevent->title=strdup((*pvalue)->value.str.val); + myevent->title=strdup(Z_STRVAL_PP(pvalue)); } - if(zend_hash_find(storeobject->value.ht, "description", sizeof("description"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "description", sizeof("description"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_string(*pvalue); - myevent->description=strdup((*pvalue)->value.str.val); + myevent->description=strdup(Z_STRVAL_PP(pvalue)); } - if(zend_hash_find(storeobject->value.ht, "alarm", sizeof("alarm"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "alarm", sizeof("alarm"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->alarm=(*pvalue)->value.lval; + myevent->alarm=Z_LVAL_PP(pvalue); } - if(zend_hash_find(storeobject->value.ht, "start", sizeof("start"), (void **) &temppvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "start", sizeof("start"), (void **) &temppvalue)== SUCCESS){ SEPARATE_ZVAL(temppvalue); convert_to_array(*temppvalue); - if(zend_hash_find((*temppvalue)->value.ht, "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->start.year=(*pvalue)->value.lval; + myevent->start.year=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->start.mon=(*pvalue)->value.lval; + myevent->start.mon=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "mday", sizeof("mday"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "mday", sizeof("mday"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->start.mday=(*pvalue)->value.lval; + myevent->start.mday=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "hour", sizeof("hour"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "hour", sizeof("hour"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->start.hour=(*pvalue)->value.lval; + myevent->start.hour=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "min", sizeof("min"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "min", sizeof("min"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->start.min=(*pvalue)->value.lval; + myevent->start.min=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "sec", sizeof("sec"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "sec", sizeof("sec"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->start.sec=(*pvalue)->value.lval; + myevent->start.sec=Z_LVAL_PP(pvalue); } myevent->start.has_date=true; } - if(zend_hash_find(storeobject->value.ht, "end", sizeof("end"), (void **) &temppvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_P(storeobject), "end", sizeof("end"), (void **) &temppvalue)== SUCCESS){ SEPARATE_ZVAL(temppvalue); convert_to_array(*temppvalue); - if(zend_hash_find((*temppvalue)->value.ht, "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "year", sizeof("year"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->end.year=(*pvalue)->value.lval; + myevent->end.year=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "month", sizeof("month"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->end.mon=(*pvalue)->value.lval; + myevent->end.mon=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "mday", sizeof("mday"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "mday", sizeof("mday"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->end.mday=(*pvalue)->value.lval; + myevent->end.mday=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "hour", sizeof("hour"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "hour", sizeof("hour"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->end.hour=(*pvalue)->value.lval; + myevent->end.hour=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "min", sizeof("min"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "min", sizeof("min"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->end.min=(*pvalue)->value.lval; + myevent->end.min=Z_LVAL_PP(pvalue); } - if(zend_hash_find((*temppvalue)->value.ht, "sec", sizeof("sec"), (void **) &pvalue)== SUCCESS){ + if(zend_hash_find(Z_ARRVAL_PP(temppvalue), "sec", sizeof("sec"), (void **) &pvalue)== SUCCESS){ SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - myevent->end.sec=(*pvalue)->value.lval; + myevent->end.sec=Z_LVAL_PP(pvalue); } myevent->end.has_date=true; } @@ -852,7 +852,7 @@ PHP_FUNCTION(icap_snooze) convert_to_long(streamind); convert_to_long(uid); - ind = streamind->value.lval; + ind = Z_LVAL_P(streamind); icap_le_struct = (pils *)zend_list_find(ind, &ind_type); @@ -861,7 +861,7 @@ PHP_FUNCTION(icap_snooze) RETURN_FALSE; } - if(cal_snooze(icap_le_struct->icap_stream, uid->value.lval)) + if(cal_snooze(icap_le_struct->icap_stream, Z_LVAL_P(uid))) { RETURN_TRUE; } diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index c02aed8944..9285141f78 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -243,10 +243,10 @@ static int add_assoc_object(zval *arg, char *key, zval *tmp) { HashTable *symtable; - if (arg->type == IS_OBJECT) { + if (Z_TYPE_P(arg) == IS_OBJECT) { symtable = Z_OBJPROP_P(arg); } else { - symtable = arg->value.ht; + symtable = Z_ARRVAL_P(arg); } return zend_hash_update(symtable, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); } @@ -258,10 +258,10 @@ static inline int add_next_index_object(zval *arg, zval *tmp) { HashTable *symtable; - if (arg->type == IS_OBJECT) { + if (Z_TYPE_P(arg) == IS_OBJECT) { symtable = Z_OBJPROP_P(arg); } else { - symtable = arg->value.ht; + symtable = Z_ARRVAL_P(arg); } return zend_hash_next_index_insert(symtable, (void *) &tmp, sizeof(zval *), NULL); @@ -729,7 +729,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* Check for an existing connection. */ if ((zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length, (void*) &le) == FAILURE) - || (le->type != le_pimapchain) + || (Z_TYPE_P(le) != le_pimapchain) ) { le = NULL; } @@ -813,7 +813,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) node->flags = cl_flags; /* Update the hash. */ - new_le.type = le_pimapchain; + Z_TYPE(new_le) = le_pimapchain; new_le.ptr = headp; if (need_update && zend_hash_update(&EG(persistent_list), hashed_details, @@ -2694,8 +2694,8 @@ PHP_FUNCTION(imap_bodystruct) } body=mail_body(imap_le_struct->imap_stream, Z_LVAL_PP(msg), Z_STRVAL_PP(section)); - if (body->type <= TYPEMAX) { - add_property_long(return_value, "type", body->type); + if (Z_TYPE_P(body) <= TYPEMAX) { + add_property_long(return_value, "type", Z_TYPE_P(body)); } if (body->encoding <= ENCMAX) { add_property_long(return_value, "encoding", body->encoding); @@ -2729,9 +2729,9 @@ PHP_FUNCTION(imap_bodystruct) add_property_long(return_value, "bytes", body->size.bytes); } #ifdef IMAP41 - if (body->disposition.type) { + if (body->Z_TYPE(disposition)) { add_property_long(return_value, "ifdisposition", 1); - add_property_string(return_value, "disposition", body->disposition.type, 1); + add_property_string(return_value, "disposition", body->Z_TYPE(disposition), 1); } else { add_property_long(return_value, "ifdisposition", 0); } @@ -2960,7 +2960,7 @@ PHP_FUNCTION(imap_mail_compose) if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); - bod->type = (short) Z_LVAL_PP(pvalue); + Z_TYPE_P(bod) = (short) Z_LVAL_PP(pvalue); } if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); @@ -2986,10 +2986,10 @@ PHP_FUNCTION(imap_mail_compose) convert_to_string_ex(pvalue); bod->description = cpystr(Z_STRVAL_PP(pvalue)); } - if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(data), "Z_TYPE(disposition)", sizeof("Z_TYPE(disposition)"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); + bod->Z_TYPE(disposition) = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); + memcpy(bod->Z_TYPE(disposition), Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); } if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) { if (Z_TYPE_PP(pvalue) == IS_ARRAY) { @@ -3046,7 +3046,7 @@ PHP_FUNCTION(imap_mail_compose) if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); - bod->type = (short) Z_LVAL_PP(pvalue); + Z_TYPE_P(bod) = (short) Z_LVAL_PP(pvalue); } if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); @@ -3072,10 +3072,10 @@ PHP_FUNCTION(imap_mail_compose) convert_to_string_ex(pvalue); bod->description = cpystr(Z_STRVAL_PP(pvalue)); } - if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(data), "Z_TYPE(disposition)", sizeof("Z_TYPE(disposition)"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); + bod->Z_TYPE(disposition) = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); + memcpy(bod->Z_TYPE(disposition), Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); } if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) { if (Z_TYPE_PP(pvalue) == IS_ARRAY) { @@ -3141,7 +3141,7 @@ PHP_FUNCTION(imap_mail_compose) bod = topbod; - if (bod && bod->type == TYPEMULTIPART) { + if (bod && Z_TYPE_P(bod) == TYPEMULTIPART) { /* first body part */ part = bod->nested.part; @@ -3496,7 +3496,7 @@ PHP_FUNCTION(imap_mime_header_decode) object_init(myobject); add_property_string(myobject, "charset", "default", 1); add_property_string(myobject, "text", text, 1); - zend_hash_next_index_insert(return_value->value.ht, (void *)&myobject, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL); } if ((encoding_token = (long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */ encoding_token -= (long)string; @@ -3523,7 +3523,7 @@ PHP_FUNCTION(imap_mime_header_decode) object_init(myobject); add_property_string(myobject, "charset", charset, 1); add_property_string(myobject, "text", decode, 1); - zend_hash_next_index_insert(return_value->value.ht, (void *)&myobject, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL); fs_give((void**)&decode); offset = end_token+2; @@ -3548,7 +3548,7 @@ PHP_FUNCTION(imap_mime_header_decode) object_init(myobject); add_property_string(myobject, "charset", "default", 1); add_property_string(myobject, "text", text, 1); - zend_hash_next_index_insert(return_value->value.ht, (void *)&myobject, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL); offset = end; /* We have reached the end of the string. */ } @@ -3691,8 +3691,8 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) PARAMETER *par, *dpar; PART *part; - if (body->type <= TYPEMAX) { - add_property_long(arg, "type", body->type); + if (Z_TYPE_P(body) <= TYPEMAX) { + add_property_long(arg, "type", Z_TYPE_P(body)); } if (body->encoding <= ENCMAX) { @@ -3729,9 +3729,9 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } #ifdef IMAP41 - if (body->disposition.type) { + if (body->Z_TYPE(disposition)) { add_property_long(arg, "ifdisposition", 1); - add_property_string(arg, "disposition", body->disposition.type, 1); + add_property_string(arg, "disposition", body->Z_TYPE(disposition), 1); } else { add_property_long(arg, "ifdisposition", 0); } @@ -3779,7 +3779,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) add_assoc_object(arg, "parameters", parametres); /* multipart message ? */ - if (body->type == TYPEMULTIPART) { + if (Z_TYPE_P(body) == TYPEMULTIPART) { MAKE_STD_ZVAL(parametres); array_init(parametres); for (part = body->CONTENT_PART; part; part = part->next) { @@ -3792,7 +3792,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } /* encapsulated message ? */ - if ((body->type == TYPEMESSAGE) && (!strcasecmp(body->subtype, "rfc822"))) { + if ((Z_TYPE_P(body) == TYPEMESSAGE) && (!strcasecmp(body->subtype, "rfc822"))) { body = body->CONTENT_MSG_BODY; MAKE_STD_ZVAL(parametres); array_init(parametres); diff --git a/ext/ingres_ii/ii.c b/ext/ingres_ii/ii.c index c77e51e4e1..0127699b37 100644 --- a/ext/ingres_ii/ii.c +++ b/ext/ingres_ii/ii.c @@ -420,17 +420,17 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) case 3: convert_to_string_ex(password); - pass = (*password)->value.str.val; + pass = Z_STRVAL_PP(password); /* Fall-through. */ case 2: convert_to_string_ex(username); - user = (*username)->value.str.val; + user = Z_STRVAL_PP(username); /* Fall-through. */ case 1: convert_to_string_ex(database); - db = (*database)->value.str.val; + db = Z_STRVAL_PP(database); /* Fall-through. */ case 0: @@ -498,7 +498,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) link->autocommit = 0; /* hash it up */ - new_le.type = le_ii_plink; + Z_TYPE(new_le) = le_ii_plink; new_le.ptr = link; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void *) &new_le, sizeof(list_entry), NULL) == FAILURE) { php_error(E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details); @@ -511,7 +511,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } else { /* already open persistent connection */ - if (le->type != le_ii_plink) { + if (Z_TYPE_P(le) != le_ii_plink) { RETURN_FALSE; } /* here we should ensure that the link did not die */ @@ -533,18 +533,18 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) int type; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (II_LINK *) index_ptr->ptr; ptr = zend_list_find((int) link, &type); /* check if the link is still there */ if (ptr && (type == le_ii_link || type == le_ii_plink)) { zend_list_addref((int) link); - return_value->value.lval = (int) link; + Z_LVAL_P(return_value) = (int) link; php_ii_set_default_link((int) link TSRMLS_CC); - return_value->type = IS_RESOURCE; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; } else { @@ -587,8 +587,8 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, link, le_ii_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1, (void *) &new_index_ptr, sizeof(list_entry), NULL) == FAILURE) { php_error(E_WARNING, "Ingres II: Unable to hash (%s)", hashed_details); free(link); @@ -599,7 +599,7 @@ static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } efree(hashed_details); - php_ii_set_default_link(return_value->value.lval TSRMLS_CC); + php_ii_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); } /* {{{ proto resource ingres_connect([string database [, string username [, string password]]]) diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index 4275f8a054..cf6bba89b4 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -199,15 +199,15 @@ typedef struct { */ #define GET_BLOB_ID_ARG(blob_arg, ib_blob)\ {\ - if (blob_arg->type == IS_STRING && blob_arg->value.str.len == 0) {\ + if (Z_TYPE_P(blob_arg) == IS_STRING && Z_STRLEN_P(blob_arg) == 0) {\ ib_blob = NULL;\ - } else if (blob_arg->type != IS_STRING\ - || blob_arg->value.str.len != sizeof(ibase_blob_handle)\ - || ((ibase_blob_handle *)(blob_arg->value.str.val))->bl_handle != 0){\ + } else if (Z_TYPE_P(blob_arg) != IS_STRING\ + || Z_STRLEN_P(blob_arg) != sizeof(ibase_blob_handle)\ + || ((ibase_blob_handle *)(Z_STRVAL_P(blob_arg)))->bl_handle != 0){\ _php_ibase_module_error("invalid blob id");\ RETURN_FALSE;\ } else {\ - ib_blob = (ibase_blob_handle *)blob_arg->value.str.val;\ + ib_blob = (ibase_blob_handle *)Z_STRVAL_P(blob_arg);\ }\ } @@ -219,9 +219,9 @@ typedef struct { { \ int type; \ convert_to_long(blob_arg); \ - blob_ptr = (ibase_blob_handle *) zend_list_find(blob_arg->value.lval, &type); \ + blob_ptr = (ibase_blob_handle *) zend_list_find(Z_LVAL_P(blob_arg), &type); \ if (type!=le_blob) { \ - _php_ibase_module_error("%d is not blob handle", blob_arg->value.lval); \ + _php_ibase_module_error("%d is not blob handle", Z_LVAL_P(blob_arg)); \ RETURN_FALSE; \ } \ } @@ -756,7 +756,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) char tmp_1[] = {isc_info_base_level, isc_info_end}; char tmp_2[8]; /* Enough? Hope so... */ - if (le->type != le_plink) { + if (Z_TYPE_P(le) != le_plink) { RETURN_FALSE; } /* Check if connection has timed out */ @@ -797,7 +797,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ib_link->trans[i] = NULL; /* hash it up */ - new_le.type = le_plink; + Z_TYPE(new_le) = le_plink; new_le.ptr = ib_link; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); @@ -821,16 +821,16 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1, (void **) &index_ptr)==SUCCESS) { int type, xlink; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } xlink = (int) index_ptr->ptr; ptr = zend_list_find(xlink, &type); /* check if the xlink is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(xlink); - return_value->value.lval = xlink; - return_value->type = IS_RESOURCE; - IBG(default_link) = return_value->value.lval; + Z_LVAL_P(return_value) = xlink; + Z_TYPE_P(return_value) = IS_RESOURCE; + IBG(default_link) = Z_LVAL_P(return_value); efree(hashed_details); return; } else { @@ -860,8 +860,8 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); RETURN_FALSE; @@ -869,8 +869,8 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) IBG(num_links)++; } efree(hashed_details); - zend_list_addref(return_value->value.lval); - IBG(default_link) = return_value->value.lval; + zend_list_addref(Z_LVAL_P(return_value)); + IBG(default_link) = Z_LVAL_P(return_value); } /* }}} */ @@ -909,7 +909,7 @@ PHP_FUNCTION(ibase_close) RETURN_FALSE; } convert_to_long_ex(link_arg); - link_id = (*link_arg)->value.lval; + link_id = Z_LVAL_PP(link_arg); break; default: WRONG_PARAM_COUNT; @@ -1137,7 +1137,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu var->sqlind = &buf[i].sqlind; b_var = b_vars[i]; - if (b_var->type == IS_NULL) { + if (Z_TYPE_P(b_var) == IS_NULL) { static char nothing[64]; static short null_flag = -1; var->sqldata = nothing; @@ -1150,17 +1150,17 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu case SQL_TEXT: /* direct to variable */ case SQL_VARYING: convert_to_string(b_var); - var->sqldata = (void ISC_FAR *)b_var->value.str.val; - var->sqllen = b_var->value.str.len; + var->sqldata = (void ISC_FAR *)Z_STRVAL_P(b_var); + var->sqllen = Z_STRLEN_P(b_var); var->sqltype = SQL_TEXT + (var->sqltype & 1); break; case SQL_SHORT: convert_to_long(b_var); - if (b_var->value.lval > SHRT_MAX || b_var->value.lval < SHRT_MIN) { + if (Z_LVAL_P(b_var) > SHRT_MAX || Z_LVAL_P(b_var) < SHRT_MIN) { _php_ibase_module_error("field %*s overflow", var->aliasname_length, var->aliasname); return FAILURE; } - buf[i].val.sval = (short)b_var->value.lval; + buf[i].val.sval = (short)Z_LVAL_P(b_var); var->sqldata = (void ISC_FAR *)(&buf[i].val.sval); break; case SQL_LONG: @@ -1171,22 +1171,22 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu handle it. */ convert_to_string(b_var); - var->sqldata = (void ISC_FAR *)b_var->value.str.val; - var->sqllen = b_var->value.str.len; + var->sqldata = (void ISC_FAR *)Z_STRVAL_P(b_var); + var->sqllen = Z_STRLEN_P(b_var); var->sqltype = SQL_TEXT; } else { convert_to_long(b_var); - var->sqldata = (void ISC_FAR *)(&b_var->value.lval); + var->sqldata = (void ISC_FAR *)(&Z_LVAL_P(b_var)); } break; case SQL_FLOAT: convert_to_double(b_var); - buf[i].val.fval = (float)b_var->value.dval; + buf[i].val.fval = (float)Z_DVAL_P(b_var); var->sqldata = (void ISC_FAR *)(&buf[i].val.fval); break; case SQL_DOUBLE: /* direct to variable */ convert_to_double(b_var); - var->sqldata = (void ISC_FAR *)(&b_var->value.dval); + var->sqldata = (void ISC_FAR *)(&Z_DVAL_P(b_var)); break; #ifdef SQL_INT64 case SQL_INT64: @@ -1196,8 +1196,8 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu to avoid rounding errors... */ convert_to_string(b_var); - var->sqldata = (void ISC_FAR *)b_var->value.str.val; - var->sqllen = b_var->value.str.len; + var->sqldata = (void ISC_FAR *)Z_STRVAL_P(b_var); + var->sqllen = Z_STRLEN_P(b_var); var->sqltype = SQL_TEXT; break; #endif @@ -1220,10 +1220,10 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu convert_to_string(b_var); - n = sscanf(b_var->value.str.val, "%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d", + n = sscanf(Z_STRVAL_P(b_var), "%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d", &t.tm_mon, &t.tm_mday, &t.tm_year, &t.tm_hour, &t.tm_min, &t.tm_sec); if(n != 3 && n != 6){ - _php_ibase_module_error("invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, b_var->value.str.val); + _php_ibase_module_error("invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, Z_STRVAL_P(b_var)); return FAILURE; } t.tm_year -= 1900; @@ -1240,8 +1240,8 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu ask Sascha? */ convert_to_string(b_var); - var->sqldata = (void ISC_FAR *)b_var->value.str.val; - var->sqllen = b_var->value.str.len; + var->sqldata = (void ISC_FAR *)Z_STRVAL_P(b_var); + var->sqllen = Z_STRLEN_P(b_var); var->sqltype = SQL_TEXT; #endif #else @@ -1250,23 +1250,23 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu convert_to_string(b_var); #ifndef SQL_TIMESTAMP - strptime(b_var->value.str.val, IBG(timestampformat), &t); + strptime(Z_STRVAL_P(b_var), IBG(timestampformat), &t); isc_encode_date(&t, &buf[i].val.qval); var->sqldata = (void ISC_FAR *)(&buf[i].val.qval); #else switch (var->sqltype & ~1) { case SQL_TIMESTAMP: - strptime(b_var->value.str.val, IBG(timestampformat), &t); + strptime(Z_STRVAL_P(b_var), IBG(timestampformat), &t); isc_encode_timestamp(&t, &buf[i].val.tsval); var->sqldata = (void ISC_FAR *)(&buf[i].val.tsval); break; case SQL_TYPE_DATE: - strptime(b_var->value.str.val, IBG(dateformat), &t); + strptime(Z_STRVAL_P(b_var), IBG(dateformat), &t); isc_encode_sql_date(&t, &buf[i].val.dtval); var->sqldata = (void ISC_FAR *)(&buf[i].val.dtval); break; case SQL_TYPE_TIME: - strptime(b_var->value.str.val, IBG(timeformat), &t); + strptime(Z_STRVAL_P(b_var), IBG(timeformat), &t); isc_encode_sql_time(&t, &buf[i].val.tmval); var->sqldata = (void ISC_FAR *)(&buf[i].val.tmval); break; @@ -1278,9 +1278,9 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu case SQL_BLOB: { ibase_blob_handle *ib_blob_id; - if (b_var->type != IS_STRING - || b_var->value.str.len != sizeof(ibase_blob_handle) - || ((ibase_blob_handle *)(b_var->value.str.val))->bl_handle != 0) { + if (Z_TYPE_P(b_var) != IS_STRING + || Z_STRLEN_P(b_var) != sizeof(ibase_blob_handle) + || ((ibase_blob_handle *)(Z_STRVAL_P(b_var)))->bl_handle != 0) { ibase_blob_handle *ib_blob; TSRMLS_FETCH(); @@ -1294,7 +1294,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu return FAILURE; } convert_to_string(b_var); - if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) b_var->value.str.len, b_var->value.str.val)) { + if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_P(b_var), Z_STRVAL_P(b_var))) { _php_ibase_error(); return FAILURE; } @@ -1309,7 +1309,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_qu return FAILURE; */ } else { - ib_blob_id = (ibase_blob_handle *)b_var->value.str.val; + ib_blob_id = (ibase_blob_handle *)Z_STRVAL_P(b_var); var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd; } @@ -1660,7 +1660,7 @@ PHP_FUNCTION(ibase_query) } i = 0; - if ((*args[i])->type == IS_RESOURCE) { /* link or transaction argument */ + if (Z_TYPE_PP(args[i]) == IS_RESOURCE) { /* link or transaction argument */ get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, args[i], &ib_link, &trans_n, &trans_id); i++; /* next arg */ } else { @@ -1668,9 +1668,9 @@ PHP_FUNCTION(ibase_query) ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, dummy, link_id, "InterBase link", le_link, le_plink); } - if ((*args[i])->type == IS_STRING) { /* query argument */ + if (Z_TYPE_PP(args[i]) == IS_STRING) { /* query argument */ convert_to_string_ex(args[i]); - query = (*args[i])->value.str.val; + query = Z_STRVAL_PP(args[i]); i++; /* next arg */ } else { _php_ibase_module_error("query argument missed"); @@ -1728,14 +1728,14 @@ static int _php_ibase_var_pval(pval *val, void *data, int type, int len, int sca data = ((IBASE_VCHAR *) data)->var_str; /* fallout */ case SQL_TEXT: - val->value.str.val = (char *)emalloc(sizeof(char)*(len+1)); - memcpy(val->value.str.val, data, len); - val->value.str.val[len] = '\0'; + Z_STRVAL_P(val) = (char *)emalloc(sizeof(char)*(len+1)); + memcpy(Z_STRVAL_P(val), data, len); + Z_STRVAL_P(val)[len] = '\0'; if (PG(magic_quotes_runtime)) { - val->value.str.val = php_addslashes(val->value.str.val, len, &len, 1 TSRMLS_CC); + Z_STRVAL_P(val) = php_addslashes(Z_STRVAL_P(val), len, &len, 1 TSRMLS_CC); } - val->type = IS_STRING; - val->value.str.len = len; + Z_TYPE_P(val) = IS_STRING; + Z_STRLEN_P(val) = len; break; case SQL_LONG: if (scale) { @@ -1745,42 +1745,42 @@ static int _php_ibase_var_pval(pval *val, void *data, int type, int len, int sca for (j = 0; j < -scale; j++) { f *= 10; } - val->type = IS_STRING; - val->value.str.len = sprintf(string_data, "%.*f", -scale, n / f); - val->value.str.val = estrdup(string_data); + Z_TYPE_P(val) = IS_STRING; + Z_STRLEN_P(val) = sprintf(string_data, "%.*f", -scale, n / f); + Z_STRVAL_P(val) = estrdup(string_data); } else { - val->type = IS_LONG; - val->value.lval = *(long *)(data); + Z_TYPE_P(val) = IS_LONG; + Z_LVAL_P(val) = *(long *)(data); } break; case SQL_SHORT: - val->type = IS_LONG; - val->value.lval = *(short *)(data); + Z_TYPE_P(val) = IS_LONG; + Z_LVAL_P(val) = *(short *)(data); break; case SQL_FLOAT: - val->type = IS_DOUBLE; - val->value.dval = *(float *)(data); + Z_TYPE_P(val) = IS_DOUBLE; + Z_DVAL_P(val) = *(float *)(data); break; case SQL_DOUBLE: if (scale) { - val->type = IS_STRING; - val->value.str.len = sprintf(string_data, "%.*f", -scale, *(double *)data); - val->value.str.val = estrdup(string_data); + Z_TYPE_P(val) = IS_STRING; + Z_STRLEN_P(val) = sprintf(string_data, "%.*f", -scale, *(double *)data); + Z_STRVAL_P(val) = estrdup(string_data); /* - val->value.str.val = string_data; + Z_STRVAL_P(val) = string_data; */ } else { - val->type = IS_DOUBLE; - val->value.dval = *(double *)data; + Z_TYPE_P(val) = IS_DOUBLE; + Z_DVAL_P(val) = *(double *)data; } break; #ifdef SQL_INT64 case SQL_INT64: - val->type = IS_STRING; - val->value.str.len = sprintf(string_data, "%Ld.%0*Ld", + Z_TYPE_P(val) = IS_STRING; + Z_STRLEN_P(val) = sprintf(string_data, "%Ld.%0*Ld", (ISC_INT64) (*((ISC_INT64 *)data) / (int) pow(10.0, (double) -scale)), -scale, (ISC_INT64) abs((int) (*((ISC_INT64 *)data) % (int) pow(10.0, (double) -scale)))); - val->value.str.val = estrdup(string_data); + Z_STRVAL_P(val) = estrdup(string_data); break; #endif #ifndef SQL_TIMESTAMP @@ -1824,23 +1824,23 @@ static int _php_ibase_var_pval(pval *val, void *data, int type, int len, int sca t.tm_zone = tzname[0]; #endif if (flag & PHP_IBASE_UNIXTIME) { - val->type = IS_LONG; - val->value.lval = timestamp; + Z_TYPE_P(val) = IS_LONG; + Z_LVAL_P(val) = timestamp; } else { - val->type = IS_STRING; + Z_TYPE_P(val) = IS_STRING; #if HAVE_STRFTIME - val->value.str.len = strftime(string_data, sizeof(string_data), format, &t); + Z_STRLEN_P(val) = strftime(string_data, sizeof(string_data), format, &t); #else /* FIXME */ if (!t.tm_hour && !t.tm_min && !t.tm_sec) - val->value.str.len = sprintf(string_data, "%02d/%02d/%4d", t.tm_mon+1, t.tm_mday, t.tm_year+1900); + Z_STRLEN_P(val) = sprintf(string_data, "%02d/%02d/%4d", t.tm_mon+1, t.tm_mday, t.tm_year+1900); else - val->value.str.len = sprintf(string_data, "%02d/%02d/%4d %02d:%02d:%02d", + Z_STRLEN_P(val) = sprintf(string_data, "%02d/%02d/%4d %02d:%02d:%02d", t.tm_mon+1, t.tm_mday, t.tm_year+1900, t.tm_hour, t.tm_min, t.tm_sec); #endif - val->value.str.val = estrdup(string_data); + Z_STRVAL_P(val) = estrdup(string_data); /* - val->value.str.val = string_data; + Z_STRVAL_P(val) = string_data; */ break; } @@ -1889,7 +1889,7 @@ static int _php_ibase_arr_pval(pval *ar_pval, char **datap, ibase_array *ib_arra return FAILURE; } /* FIXME ??? */ - zend_hash_index_update(ar_pval->value.ht, + zend_hash_index_update(Z_ARRVAL_P(ar_pval), l_bound + i, (void *) &tmp, sizeof(pval), NULL); *datap += ib_array->el_size; @@ -1925,7 +1925,7 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type) RETURN_FALSE; } convert_to_long_ex(flag_arg); - flag = (*flag_arg)->value.lval; + flag = Z_LVAL_PP(flag_arg); break; default: WRONG_PARAM_COUNT; @@ -2037,9 +2037,9 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type) _php_ibase_error(); RETURN_FALSE; } - tmp->type = IS_STRING; - tmp->value.str.len = cur_len; - tmp->value.str.val = estrndup(bl_data, cur_len); + Z_TYPE_P(tmp) = IS_STRING; + Z_STRLEN_P(tmp) = cur_len; + Z_STRVAL_P(tmp) = estrndup(bl_data, cur_len); efree(bl_data); } else { /* blob id only */ ISC_QUAD *bl_qd = (ISC_QUAD ISC_FAR *) var->sqldata; @@ -2053,9 +2053,9 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type) ib_blob_id->bl_qd.gds_quad_low = bl_qd->gds_quad_low; ib_blob_id->bl_handle = NULL; - tmp->type = IS_STRING; - tmp->value.str.len = sizeof(ibase_blob_handle); - tmp->value.str.val = estrndup((char *)ib_blob_id, sizeof(ibase_blob_handle)); + Z_TYPE_P(tmp) = IS_STRING; + Z_STRLEN_P(tmp) = sizeof(ibase_blob_handle); + Z_STRVAL_P(tmp) = estrndup((char *)ib_blob_id, sizeof(ibase_blob_handle)); efree(ib_blob_id); } break; @@ -2084,27 +2084,27 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type) break; } /*switch*/ if (fetch_type & FETCH_ARRAY) { - switch (tmp->type) { + switch (Z_TYPE_P(tmp)) { case IS_STRING: - add_index_stringl(return_value, i, tmp->value.str.val, tmp->value.str.len, 0); + add_index_stringl(return_value, i, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0); break; case IS_LONG: - add_index_long(return_value, i, tmp->value.lval); + add_index_long(return_value, i, Z_LVAL_P(tmp)); break; case IS_DOUBLE: - add_index_double(return_value, i, tmp->value.dval); + add_index_double(return_value, i, Z_DVAL_P(tmp)); break; } } else { - switch (tmp->type) { + switch (Z_TYPE_P(tmp)) { case IS_STRING: - add_property_stringl(return_value, var->aliasname, tmp->value.str.val, tmp->value.str.len, 0); + add_property_stringl(return_value, var->aliasname, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0); break; case IS_LONG: - add_property_long(return_value, var->aliasname, tmp->value.lval); + add_property_long(return_value, var->aliasname, Z_LVAL_P(tmp)); break; case IS_DOUBLE: - add_property_double(return_value, var->aliasname, tmp->value.dval); + add_property_double(return_value, var->aliasname, Z_DVAL_P(tmp)); break; } } @@ -2147,7 +2147,7 @@ PHP_FUNCTION(ibase_free_result) } ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result); - zend_list_delete((*result_arg)->value.lval); + zend_list_delete(Z_LVAL_PP(result_arg)); RETURN_TRUE; } /* }}} */ @@ -2184,7 +2184,7 @@ PHP_FUNCTION(ibase_prepare) } convert_to_string_ex(query_arg); - query = (*query_arg)->value.str.val; + query = Z_STRVAL_PP(query_arg); /* open default transaction */ if (_php_ibase_def_trans(ib_link, trans_n) == FAILURE) { @@ -2269,7 +2269,7 @@ PHP_FUNCTION(ibase_free_query) } ZEND_FETCH_RESOURCE(ib_query, ibase_query *, query_arg, -1, "InterBase query", le_query); - zend_list_delete((*query_arg)->value.lval); + zend_list_delete(Z_LVAL_PP(query_arg)); RETURN_TRUE; } /* }}} */ @@ -2382,13 +2382,13 @@ PHP_FUNCTION(ibase_field_info) convert_to_long_ex(field_arg); - if ((*field_arg)->value.lval<0 || (*field_arg)->value.lval>=ib_result->out_sqlda->sqld) + if (Z_LVAL_PP(field_arg)<0 || Z_LVAL_PP(field_arg)>=ib_result->out_sqlda->sqld) RETURN_FALSE; if (array_init(return_value)==FAILURE) RETURN_FALSE; - var = ib_result->out_sqlda->sqlvar + (*field_arg)->value.lval; + var = ib_result->out_sqlda->sqlvar + Z_LVAL_PP(field_arg); add_get_index_stringl(return_value, 0, var->sqlname, var->sqlname_length, (void **) &ret_val, 1); add_assoc_stringl(return_value, "name", var->sqlname, var->sqlname_length, 1); @@ -2592,7 +2592,7 @@ PHP_FUNCTION(ibase_blob_add) convert_to_string(string_arg); - if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) string_arg->value.str.len, string_arg->value.str.val)) { + if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) Z_STRLEN_P(string_arg), Z_STRVAL_P(string_arg))) { _php_ibase_error(); RETURN_FALSE; } @@ -2617,7 +2617,7 @@ PHP_FUNCTION(ibase_blob_get) } convert_to_long(len_arg); - max_len = (unsigned short) len_arg->value.lval; + max_len = (unsigned short) Z_LVAL_P(len_arg); GET_BLOB_HANDLE_ARG(blob_arg, ib_blob); @@ -2675,14 +2675,14 @@ static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end) } ib_blob->bl_handle = NULL; RETVAL_STRINGL((char *)ib_blob, sizeof(ibase_blob_handle), 1); - zend_list_delete(blob_arg->value.lval); + zend_list_delete(Z_LVAL_P(blob_arg)); } else { /* discard created blob */ if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) { _php_ibase_error(); RETURN_FALSE; } ib_blob->bl_handle = NULL; - zend_list_delete(blob_arg->value.lval); + zend_list_delete(Z_LVAL_P(blob_arg)); RETURN_TRUE; } } @@ -2749,22 +2749,22 @@ PHP_FUNCTION(ibase_blob_info) /* FIXME */ add_get_index_long(return_value, 0, bl_info.total_length, (void **)&result_var); /* - zend_hash_pointer_update(return_value->value.ht, "length", sizeof("length"), result_var); + zend_hash_pointer_update(Z_ARRVAL_P(return_value), "length", sizeof("length"), result_var); */ add_get_index_long(return_value, 1, bl_info.num_segments, (void **)&result_var); /* - zend_hash_pointer_update(return_value->value.ht, "numseg", sizeof("numseg"), result_var); + zend_hash_pointer_update(Z_ARRVAL_P(return_value), "numseg", sizeof("numseg"), result_var); */ add_get_index_long(return_value, 2, bl_info.max_segment, (void **)&result_var); /* - zend_hash_pointer_update(return_value->value.ht, "maxseg", sizeof("maxseg"), result_var); + zend_hash_pointer_update(Z_ARRVAL_P(return_value), "maxseg", sizeof("maxseg"), result_var); */ add_get_index_long(return_value, 3, bl_info.bl_stream, (void **)&result_var); /* - zend_hash_pointer_update(return_value->value.ht, "stream", sizeof("stream"), result_var); + zend_hash_pointer_update(Z_ARRVAL_P(return_value), "stream", sizeof("stream"), result_var); */ add_get_index_long(return_value, 4, @@ -2772,7 +2772,7 @@ PHP_FUNCTION(ibase_blob_info) && !ib_blob_id->bl_qd.gds_quad_low), (void **)&result_var); /* - zend_hash_pointer_update(return_value->value.ht, "isnull", sizeof("isnull"), result_var); + zend_hash_pointer_update(Z_ARRVAL_P(return_value), "isnull", sizeof("isnull"), result_var); */ } /* }}} */ diff --git a/ext/java/java.c b/ext/java/java.c index 9d8a9ad2e9..0780c4b7b7 100644 --- a/ext/java/java.c +++ b/ext/java/java.c @@ -280,37 +280,37 @@ static jobject _java_makeObject(pval* arg TSRMLS_DC) jmethodID makeArg; jclass hashClass; - switch (arg->type) { + switch (Z_TYPE_P(arg)) { case IS_STRING: - result=(*jenv)->NewByteArray(jenv, arg->value.str.len); + result=(*jenv)->NewByteArray(jenv, Z_STRLEN_P(arg)); (*jenv)->SetByteArrayRegion(jenv, (jbyteArray)result, 0, - arg->value.str.len, arg->value.str.val); + Z_STRLEN_P(arg), Z_STRVAL_P(arg)); break; case IS_OBJECT: zend_hash_index_find(Z_OBJPROP_P(arg), 0, (void*)&handle); - result = zend_list_find((*handle)->value.lval, &type); + result = zend_list_find(Z_LVAL_PP(handle), &type); break; case IS_BOOL: makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg", "(Z)Ljava/lang/Object;"); result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg, - (jboolean)(arg->value.lval)); + (jboolean)(Z_LVAL_P(arg))); break; case IS_LONG: makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg", "(J)Ljava/lang/Object;"); result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg, - (jlong)(arg->value.lval)); + (jlong)(Z_LVAL_P(arg))); break; case IS_DOUBLE: makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg", "(D)Ljava/lang/Object;"); result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg, - (jdouble)(arg->value.dval)); + (jdouble)(Z_DVAL_P(arg))); break; case IS_ARRAY: @@ -331,28 +331,28 @@ static jobject _java_makeObject(pval* arg TSRMLS_DC) "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); /* Iterate through hash */ - zend_hash_internal_pointer_reset(arg->value.ht); - while(zend_hash_get_current_data(arg->value.ht, (void**)&value) == SUCCESS) { + zend_hash_internal_pointer_reset(Z_ARRVAL_P(arg)); + while(zend_hash_get_current_data(Z_ARRVAL_P(arg), (void**)&value) == SUCCESS) { jval = _java_makeObject(*value TSRMLS_CC); - switch (zend_hash_get_current_key(arg->value.ht, &string_key, &num_key, 0)) { + switch (zend_hash_get_current_key(Z_ARRVAL_P(arg), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - key.type = IS_STRING; - key.value.str.val = string_key; - key.value.str.len = strlen(string_key); + Z_TYPE(key) = IS_STRING; + Z_STRVAL(key) = string_key; + Z_STRLEN(key) = strlen(string_key); jkey = _java_makeObject(&key TSRMLS_CC); break; case HASH_KEY_IS_LONG: - key.type = IS_LONG; - key.value.lval = num_key; + Z_TYPE(key) = IS_LONG; + Z_LVAL(key) = num_key; jkey = _java_makeObject(&key TSRMLS_CC); break; default: /* HASH_KEY_NON_EXISTANT */ jkey = 0; } jold = (*jenv)->CallObjectMethod(jenv, result, put, jkey, jval); - if ((*value)->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, jval); - zend_hash_move_forward(arg->value.ht); + if (Z_TYPE_PP(value) != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, jval); + zend_hash_move_forward(Z_ARRVAL_P(arg)); } break; @@ -379,7 +379,7 @@ static jobjectArray _java_makeArray(int argc, pval** argv TSRMLS_DC) for (i=0; i<argc; i++) { arg = _java_makeObject(argv[i] TSRMLS_CC); (*jenv)->SetObjectArrayElement(jenv, result, i, arg); - if (argv[i]->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, arg); + if (Z_TYPE_P(argv[i]) != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, arg); } return result; } @@ -387,9 +387,9 @@ static jobjectArray _java_makeArray(int argc, pval** argv TSRMLS_DC) static int checkError(pval *value) { - if (value->type == IS_EXCEPTION) { - php_error(E_WARNING, "%s", value->value.str.val); - efree(value->value.str.val); + if (Z_TYPE_P(value) == IS_EXCEPTION) { + php_error(E_WARNING, "%s", Z_STRVAL_P(value)); + efree(Z_STRVAL_P(value)); ZVAL_FALSE(value); return 1; }; @@ -422,7 +422,7 @@ void java_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_refe if (!JG(jenv)) return; jenv = JG(jenv); - if (!strcmp("java", function_name->element.value.str.val)) { + if (!strcmp("java", function_name->Z_STRVAL(element))) { /* construct a Java object: First argument is the class name. Any additional arguments will @@ -456,8 +456,8 @@ void java_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_refe jmethodID invoke = (*jenv)->GetMethodID(jenv, JG(reflect_class), "Invoke", "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V"); zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**) &handle); - obj = zend_list_find((*handle)->value.lval, &type); - method = (*jenv)->NewStringUTF(jenv, function_name->element.value.str.val); + obj = zend_list_find(Z_LVAL_PP(handle), &type); + method = (*jenv)->NewStringUTF(jenv, function_name->Z_STRVAL(element)); result = (jlong)(long)return_value; (*jenv)->CallVoidMethod(jenv, JG(php_reflect), invoke, @@ -526,14 +526,14 @@ static pval _java_getset_property JNIEnv *jenv; jenv = JG(jenv); - propName = (*jenv)->NewStringUTF(jenv, property->element.value.str.val); + propName = (*jenv)->NewStringUTF(jenv, property->Z_STRVAL(element)); /* get the object */ zend_hash_index_find(Z_OBJPROP_P(property_reference->object), 0, (void **) &pobject); - obj = zend_list_find((*pobject)->value.lval, &type); + obj = zend_list_find(Z_LVAL_PP(pobject), &type); result = (jlong)(long) &presult; - presult.type = IS_NULL; + Z_TYPE(presult) = IS_NULL; if (!obj || (type!=le_jobject)) { php_error(E_ERROR, @@ -651,11 +651,11 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromString jboolean isCopy; jbyte *value = (*jenv)->GetByteArrayElements(jenv, jvalue, &isCopy); pval *presult = (pval*)(long)result; - presult->type=IS_STRING; - presult->value.str.len=(*jenv)->GetArrayLength(jenv, jvalue); - presult->value.str.val=emalloc(presult->value.str.len+1); - memcpy(presult->value.str.val, value, presult->value.str.len); - presult->value.str.val[presult->value.str.len]=0; + Z_TYPE_P(presult)=IS_STRING; + Z_STRLEN_P(presult)=(*jenv)->GetArrayLength(jenv, jvalue); + Z_STRVAL_P(presult)=emalloc(Z_STRLEN_P(presult)+1); + memcpy(Z_STRVAL_P(presult), value, Z_STRLEN_P(presult)); + Z_STRVAL_P(presult)[Z_STRLEN_P(presult)]=0; if (isCopy) (*jenv)->ReleaseByteArrayElements(jenv, jvalue, value, 0); } @@ -663,24 +663,24 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromLong (JNIEnv *jenv, jclass self, jlong result, jlong value) { pval *presult = (pval*)(long)result; - presult->type=IS_LONG; - presult->value.lval=(long)value; + Z_TYPE_P(presult)=IS_LONG; + Z_LVAL_P(presult)=(long)value; } JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromDouble (JNIEnv *jenv, jclass self, jlong result, jdouble value) { pval *presult = (pval*)(long)result; - presult->type=IS_DOUBLE; - presult->value.dval=value; + Z_TYPE_P(presult)=IS_DOUBLE; + Z_DVAL_P(presult)=value; } JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromBoolean (JNIEnv *jenv, jclass self, jlong result, jboolean value) { pval *presult = (pval*)(long)result; - presult->type=IS_BOOL; - presult->value.lval=value; + Z_TYPE_P(presult)=IS_BOOL; + Z_LVAL_P(presult)=value; } JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject @@ -691,15 +691,15 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject pval *handle; TSRMLS_FETCH(); - if (presult->type != IS_OBJECT) { + if (Z_TYPE_P(presult) != IS_OBJECT) { object_init_ex(presult, &java_class_entry); presult->is_ref=1; presult->refcount=1; } ALLOC_ZVAL(handle); - handle->type = IS_LONG; - handle->value.lval = + Z_TYPE_P(handle) = IS_LONG; + Z_LVAL_P(handle) = zend_list_insert((*jenv)->NewGlobalRef(jenv, value), le_jobject); pval_copy_constructor(handle); INIT_PZVAL(handle); @@ -718,7 +718,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement pval *result; pval *handle = (pval*)(long)array; ALLOC_ZVAL(result); - zend_hash_next_index_insert(handle->value.ht, &result, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(handle), &result, sizeof(zval *), NULL); return (jlong)(long)result; } @@ -728,7 +728,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_hashIndexUpdate pval *result; pval *handle = (pval*)(long)array; ALLOC_ZVAL(result); - zend_hash_index_update(handle->value.ht, (unsigned long)key, + zend_hash_index_update(Z_ARRVAL_P(handle), (unsigned long)key, &result, sizeof(zval *), NULL); return (jlong)(long)result; } @@ -741,7 +741,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_hashUpdate pval *handle = (pval*)(long)array; ALLOC_ZVAL(result); Java_net_php_reflect_setResultFromString(jenv, self, (jlong)(long)&pkey, key); - zend_hash_update(handle->value.ht, pkey.value.str.val, pkey.value.str.len+1, + zend_hash_update(Z_ARRVAL_P(handle), Z_STRVAL(pkey), Z_STRLEN(pkey)+1, &result, sizeof(zval *), NULL); return (jlong)(long)result; } @@ -751,7 +751,7 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setException { pval *presult = (pval*)(long)result; Java_net_php_reflect_setResultFromString(jenv, self, result, value); - presult->type=IS_EXCEPTION; + Z_TYPE_P(presult)=IS_EXCEPTION; } JNIEXPORT void JNICALL Java_net_php_reflect_setEnv diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 8562b52753..95ff13da7c 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -209,7 +209,7 @@ PHP_MINIT_FUNCTION(ldap) le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number); le_result_entry = zend_register_list_destructors_ex(NULL, NULL, "ldap result entry", module_number); - ldap_module_entry.type = type; + Z_TYPE(ldap_module_entry) = type; return SUCCESS; } @@ -317,12 +317,12 @@ PHP_FUNCTION(ldap_connect) } convert_to_string_ex(yyhost); - host = (*yyhost)->value.str.val; + host = Z_STRVAL_PP(yyhost); port = 389; /* Default port */ - /* hashed_details_length = yyhost->value.str.len+4+1; + /* hashed_details_length = Z_STRLEN_P(yyhost)+4+1; hashed_details = emalloc(hashed_details_length+1); - sprintf(hashed_details, "ldap_%s", yyhost->value.str.val);*/ + sprintf(hashed_details, "ldap_%s", Z_STRVAL_P(yyhost));*/ } break; @@ -334,14 +334,14 @@ PHP_FUNCTION(ldap_connect) } convert_to_string_ex(yyhost); - host = (*yyhost)->value.str.val; + host = Z_STRVAL_PP(yyhost); convert_to_long_ex(yyport); - port = (*yyport)->value.lval; + port = Z_LVAL_PP(yyport); /* Do we need to take care of hosts running multiple LDAP servers ? */ - /* hashed_details_length = yyhost->value.str.len+4+1; + /* hashed_details_length = Z_STRLEN_P(yyhost)+4+1; hashed_details = emalloc(hashed_details_length+1); - sprintf(hashed_details, "ldap_%s", yyhost->value.str.val);*/ + sprintf(hashed_details, "ldap_%s", Z_STRVAL_P(yyhost));*/ } break; #ifdef HAVE_ORALDAP @@ -358,11 +358,11 @@ PHP_FUNCTION(ldap_connect) convert_to_string_ex(yywallet); convert_to_string_ex(yywalletpasswd); convert_to_long_ex(yyauthmode); - host = (*yyhost)->value.str.val; - port = (*yyport)->value.lval; - wallet = (*yywallet)->value.str.val; - walletpasswd = (*yywalletpasswd)->value.str.val; - authmode = (*yyauthmode)->value.lval; + host = Z_STRVAL_PP(yyhost); + port = Z_LVAL_PP(yyport); + wallet = Z_STRVAL_PP(yywallet); + walletpasswd = Z_STRVAL_PP(yywalletpasswd); + authmode = Z_LVAL_PP(yyauthmode); ssl = 1; } break; @@ -458,8 +458,8 @@ PHP_FUNCTION(ldap_bind) convert_to_string_ex(bind_rdn); convert_to_string_ex(bind_pw); - ldap_bind_rdn = (*bind_rdn)->value.str.val; - ldap_bind_pw = (*bind_pw)->value.str.val; + ldap_bind_rdn = Z_STRVAL_PP(bind_rdn); + ldap_bind_pw = Z_STRVAL_PP(bind_pw); break; @@ -492,7 +492,7 @@ PHP_FUNCTION(ldap_unbind) ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); - zend_list_delete((*link)->value.lval); + zend_list_delete(Z_LVAL_PP(link)); RETURN_TRUE; } /* }}} */ @@ -555,34 +555,34 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) switch(myargcount) { case 8 : convert_to_long_ex(deref); - ldap_deref = (*deref)->value.lval; + ldap_deref = Z_LVAL_PP(deref); case 7 : convert_to_long_ex(timelimit); - ldap_timelimit = (*timelimit)->value.lval; + ldap_timelimit = Z_LVAL_PP(timelimit); case 6 : convert_to_long_ex(sizelimit); - ldap_sizelimit = (*sizelimit)->value.lval; + ldap_sizelimit = Z_LVAL_PP(sizelimit); case 5 : convert_to_long_ex(attrsonly); - ldap_attrsonly = (*attrsonly)->value.lval; + ldap_attrsonly = Z_LVAL_PP(attrsonly); case 4 : - if ((*attrs)->type != IS_ARRAY) { + if (Z_TYPE_PP(attrs) != IS_ARRAY) { php_error(E_WARNING, "LDAP: Expected Array as last element"); RETURN_FALSE; } - num_attribs = zend_hash_num_elements((*attrs)->value.ht); + num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs)); if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) { php_error(E_WARNING, "LDAP: Could not allocate memory"); RETURN_FALSE; } for(i=0; i<num_attribs; i++) { - if(zend_hash_index_find((*attrs)->value.ht, i, (void **) &attr) == FAILURE) { + if(zend_hash_index_find(Z_ARRVAL_PP(attrs), i, (void **) &attr) == FAILURE) { php_error(E_WARNING, "LDAP: Array initialization wrong"); efree(ldap_attrs); RETURN_FALSE; @@ -590,7 +590,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) SEPARATE_ZVAL(attr); convert_to_string_ex(attr); - ldap_attrs[i] = (*attr)->value.str.val; + ldap_attrs[i] = Z_STRVAL_PP(attr); } ldap_attrs[num_attribs] = NULL; @@ -808,7 +808,7 @@ PHP_FUNCTION(ldap_free_result) if (ldap_result == NULL) { RETVAL_FALSE; } else { - zend_list_delete((*result)->value.lval); /* Delete list entry and call registered destructor function */ + zend_list_delete(Z_LVAL_PP(result)); /* Delete list entry and call registered destructor function */ RETVAL_TRUE; } return; @@ -957,7 +957,7 @@ PHP_FUNCTION(ldap_get_entries) free(dn); #endif - zend_hash_index_update(return_value->value.ht, num_entries, (void *) &tmp1, sizeof(pval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(return_value), num_entries, (void *) &tmp1, sizeof(pval *), NULL); num_entries++; ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry); @@ -1065,7 +1065,7 @@ PHP_FUNCTION(ldap_get_attributes) } ldap_value_free(ldap_value); - zend_hash_update(return_value->value.ht, attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval *), NULL); add_index_string(return_value, num_attrib, attribute, 1); num_attrib++; @@ -1102,7 +1102,7 @@ PHP_FUNCTION(ldap_get_values) ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry); convert_to_string_ex(attr); - attribute = (*attr)->value.str.val; + attribute = Z_STRVAL_PP(attr); if ((ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute)) == NULL) { php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ldap))); @@ -1144,7 +1144,7 @@ PHP_FUNCTION(ldap_get_values_len) ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry); convert_to_string_ex(attr); - attribute = (*attr)->value.str.val; + attribute = Z_STRVAL_PP(attr); if ((ldap_value_len = ldap_get_values_len(ldap, ldap_result_entry, attribute)) == NULL) { php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ldap))); @@ -1212,7 +1212,7 @@ PHP_FUNCTION(ldap_explode_dn) convert_to_string_ex(dn); convert_to_long_ex(with_attrib); - ldap_value = ldap_explode_dn((*dn)->value.str.val, (*with_attrib)->value.lval); + ldap_value = ldap_explode_dn(Z_STRVAL_PP(dn), Z_LVAL_PP(with_attrib)); i=0; while(ldap_value[i] != NULL) i++; @@ -1244,7 +1244,7 @@ PHP_FUNCTION(ldap_dn2ufn) convert_to_string_ex(dn); - ufn = ldap_dn2ufn((*dn)->value.str.val); + ufn = ldap_dn2ufn(Z_STRVAL_PP(dn)); if (ufn !=NULL) { RETVAL_STRING(ufn, 1); @@ -1278,7 +1278,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) WRONG_PARAM_COUNT; } - if ((*entry)->type != IS_ARRAY) { + if (Z_TYPE_PP(entry) != IS_ARRAY) { php_error(E_WARNING, "LDAP: Expected Array as the last element"); RETURN_FALSE; } @@ -1286,12 +1286,12 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); convert_to_string_ex(dn); - ldap_dn = (*dn)->value.str.val; + ldap_dn = Z_STRVAL_PP(dn); - num_attribs = zend_hash_num_elements((*entry)->value.ht); + num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(entry)); ldap_mods = emalloc((num_attribs+1) * sizeof(LDAPMod *)); num_berval = emalloc(num_attribs * sizeof(int)); - zend_hash_internal_pointer_reset((*entry)->value.ht); + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(entry)); /* added by gerrit thomson to fix ldap_add using ldap_mod_add */ if ( oper == PHP_LD_FULL_ADD ) { @@ -1304,7 +1304,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) ldap_mods[i] = emalloc(sizeof(LDAPMod)); ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; - if (zend_hash_get_current_key((*entry)->value.ht, &attribute, &index, 0) == HASH_KEY_IS_STRING) { + if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) { ldap_mods[i]->mod_type = estrdup(attribute); } else { php_error(E_ERROR, "LDAP: Unknown Attribute in the data"); @@ -1317,12 +1317,12 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) RETURN_FALSE; } - zend_hash_get_current_data((*entry)->value.ht, (void **)&value); + zend_hash_get_current_data(Z_ARRVAL_PP(entry), (void **)&value); - if ((*value)->type != IS_ARRAY) { + if (Z_TYPE_PP(value) != IS_ARRAY) { num_values = 1; } else { - num_values = zend_hash_num_elements((*value)->value.ht); + num_values = zend_hash_num_elements(Z_ARRVAL_PP(value)); } num_berval[i] = num_values; @@ -1330,22 +1330,22 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) /* allow for arrays with one element, no allowance for arrays with none but probably not required, gerrit thomson. */ /* if (num_values == 1) {*/ - if ((num_values == 1) && ((*value)->type != IS_ARRAY)) { + if ((num_values == 1) && (Z_TYPE_PP(value) != IS_ARRAY)) { convert_to_string_ex(value); ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[0]->bv_len = (*value)->value.str.len; - ldap_mods[i]->mod_bvalues[0]->bv_val = (*value)->value.str.val; + ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_PP(value); + ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_PP(value); } else { for(j=0; j < num_values; j++) { - zend_hash_index_find((*value)->value.ht, j, (void **) &ivalue); + zend_hash_index_find(Z_ARRVAL_PP(value), j, (void **) &ivalue); convert_to_string_ex(ivalue); ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[j]->bv_len = (*ivalue)->value.str.len; - ldap_mods[i]->mod_bvalues[j]->bv_val = (*ivalue)->value.str.val; + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_PP(ivalue); + ldap_mods[i]->mod_bvalues[j]->bv_val = Z_STRVAL_PP(ivalue); } } ldap_mods[i]->mod_bvalues[num_values] = NULL; - zend_hash_move_forward((*entry)->value.ht); + zend_hash_move_forward(Z_ARRVAL_PP(entry)); } ldap_mods[num_attribs] = NULL; @@ -1442,7 +1442,7 @@ PHP_FUNCTION(ldap_delete) ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); convert_to_string_ex(dn); - ldap_dn = (*dn)->value.str.val; + ldap_dn = Z_STRVAL_PP(dn); if (ldap_delete_s(ldap, ldap_dn) != LDAP_SUCCESS) { ldap_perror(ldap, "LDAP"); @@ -1485,7 +1485,7 @@ PHP_FUNCTION(ldap_err2str) } convert_to_long_ex(perrno); - RETURN_STRING(ldap_err2string((*perrno)->value.lval), 1); + RETURN_STRING(ldap_err2string(Z_LVAL_PP(perrno)), 1); } /* }}} */ @@ -1530,9 +1530,9 @@ PHP_FUNCTION(ldap_compare) convert_to_string_ex(attr); convert_to_string_ex(value); - ldap_dn = (*dn)->value.str.val; - ldap_attr = (*attr)->value.str.val; - ldap_value = (*value)->value.str.val; + ldap_dn = Z_STRVAL_PP(dn); + ldap_attr = Z_STRVAL_PP(attr); + ldap_value = Z_STRVAL_PP(value); errno = ldap_compare_s(ldap, ldap_dn, ldap_attr, ldap_value); @@ -1570,7 +1570,7 @@ PHP_FUNCTION(ldap_get_option) ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); convert_to_long_ex(option); - opt = (*option)->value.lval; + opt = Z_LVAL_PP(option); switch(opt) { /* options with int value */ @@ -1633,7 +1633,7 @@ PHP_FUNCTION(ldap_set_option) ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); convert_to_long_ex(option); - opt = (*option)->value.lval; + opt = Z_LVAL_PP(option); switch(opt) { /* options with int value */ @@ -1645,7 +1645,7 @@ PHP_FUNCTION(ldap_set_option) { int val; convert_to_long_ex(newval); - val = (*newval)->value.lval; + val = Z_LVAL_PP(newval); if (ldap_set_option(ldap, opt, &val)) { RETURN_FALSE; } @@ -1659,7 +1659,7 @@ PHP_FUNCTION(ldap_set_option) { char *val; convert_to_string_ex(newval); - val = (*newval)->value.str.val; + val = Z_STRVAL_PP(newval); if (ldap_set_option(ldap, opt, val)) { RETURN_FALSE; } @@ -1670,7 +1670,7 @@ PHP_FUNCTION(ldap_set_option) { void *val; convert_to_boolean_ex(newval); - val = (*newval)->value.lval + val = Z_LVAL_PP(newval) ? LDAP_OPT_ON : LDAP_OPT_OFF; if (ldap_set_option(ldap, opt, val)) { RETURN_FALSE; @@ -1957,8 +1957,8 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way) } convert_to_string_ex(value); - ldap_buf = (*value)->value.str.val; - ldap_len = (*value)->value.str.len; + ldap_buf = Z_STRVAL_PP(value); + ldap_len = Z_STRLEN_PP(value); if(ldap_len == 0) { RETURN_FALSE; diff --git a/ext/mailparse/mailparse.c b/ext/mailparse/mailparse.c index afe0dcaca9..e6f4d0b08d 100755 --- a/ext/mailparse/mailparse.c +++ b/ext/mailparse/mailparse.c @@ -420,12 +420,12 @@ PHP_FUNCTION(mailparse_stream_encode) WRONG_PARAM_COUNT; } - if ((*srcfile)->type == IS_RESOURCE && (*srcfile)->value.lval == 0) { + if (Z_TYPE_PP(srcfile) == IS_RESOURCE && Z_LVAL_PP(srcfile) == 0) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(srcfp, FILE *, srcfile, -1, "File-Handle", php_file_le_fopen()); - if ((*destfile)->type == IS_RESOURCE && (*destfile)->value.lval == 0) { + if (Z_TYPE_PP(destfile) == IS_RESOURCE && Z_LVAL_PP(destfile) == 0) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(destfp, FILE *, destfile, -1, "File-Handle", php_file_le_fopen()); @@ -477,7 +477,7 @@ PHP_FUNCTION(mailparse_msg_parse) WRONG_PARAM_COUNT; } - if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) { + if (Z_TYPE_PP(arg) == IS_RESOURCE && Z_LVAL_PP(arg) == 0) { RETURN_FALSE; } @@ -485,7 +485,7 @@ PHP_FUNCTION(mailparse_msg_parse) convert_to_string_ex(data); - rfc2045_parse(rfcbuf, (*data)->value.str.val, (*data)->value.str.len); + rfc2045_parse(rfcbuf, Z_STRVAL_PP(data), Z_STRLEN_PP(data)); } /* }}} */ @@ -542,13 +542,13 @@ PHP_FUNCTION(mailparse_msg_free) WRONG_PARAM_COUNT; } - if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) { + if (Z_TYPE_PP(arg) == IS_RESOURCE && Z_LVAL_PP(arg) == 0) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(rfcbuf, struct rfc2045 *, arg, -1, mailparse_msg_name, le_rfc2045); - zend_list_delete((*arg)->value.lval); + zend_list_delete(Z_LVAL_PP(arg)); RETURN_TRUE; } /* }}} */ @@ -602,7 +602,7 @@ PHP_FUNCTION(mailparse_msg_get_structure) WRONG_PARAM_COUNT; } - if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) { + if (Z_TYPE_PP(arg) == IS_RESOURCE && Z_LVAL_PP(arg) == 0) { RETURN_FALSE; } @@ -624,8 +624,8 @@ static int extract_callback_user_func(const char *p, size_t n, zval *userfunc) TSRMLS_FETCH(); MAKE_STD_ZVAL(retval); - retval->type = IS_BOOL; - retval->value.lval = 0; + Z_TYPE_P(retval) = IS_BOOL; + Z_LVAL_P(retval) = 0; MAKE_STD_ZVAL(arg); ZVAL_STRINGL(arg, (char*)p, (int)n, 1); @@ -678,7 +678,7 @@ PHP_FUNCTION(mailparse_msg_extract_part) } convert_to_string_ex(bodystr); - if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) { + if (Z_TYPE_PP(arg) == IS_RESOURCE && Z_LVAL_PP(arg) == 0) { RETURN_FALSE; } mailparse_fetch_rfc2045_resource(rfcbuf, arg); @@ -734,7 +734,7 @@ PHP_FUNCTION(mailparse_msg_extract_part_file) } convert_to_string_ex(filename); - if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) { + if (Z_TYPE_PP(arg) == IS_RESOURCE && Z_LVAL_PP(arg) == 0) { RETURN_FALSE; } mailparse_fetch_rfc2045_resource(rfcbuf, arg); @@ -809,7 +809,7 @@ PHP_FUNCTION(mailparse_msg_get_part_data) WRONG_PARAM_COUNT; } - if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) { + if (Z_TYPE_PP(arg) == IS_RESOURCE && Z_LVAL_PP(arg) == 0) { RETURN_FALSE; } @@ -895,7 +895,7 @@ PHP_FUNCTION(mailparse_msg_get_part) WRONG_PARAM_COUNT; } - if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) { + if (Z_TYPE_PP(arg) == IS_RESOURCE && Z_LVAL_PP(arg) == 0) { RETURN_FALSE; } @@ -903,10 +903,10 @@ PHP_FUNCTION(mailparse_msg_get_part) convert_to_string_ex(mimesection); - newsection = rfc2045_find(rfcbuf, (*mimesection)->value.str.val); + newsection = rfc2045_find(rfcbuf, Z_STRVAL_PP(mimesection)); if (!newsection) { - php_error(E_WARNING, "%s(): cannot find section %s in message", get_active_function_name(TSRMLS_C), (*mimesection)->value.str.val); + php_error(E_WARNING, "%s(): cannot find section %s in message", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(mimesection)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, newsection, le_rfc2045_nofree); diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 1803497270..cde6b56700 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -237,7 +237,7 @@ php_mbstring_parse_encoding_array(zval *array, int **return_list, int *return_si list = NULL; if (Z_TYPE_P(array) == IS_ARRAY) { - target_hash = array->value.ht; + target_hash = Z_ARRVAL_P(array); zend_hash_internal_pointer_reset(target_hash); i = zend_hash_num_elements(target_hash); size = i + php_mbstr_default_identify_list_size; diff --git a/ext/mcal/php_mcal.c b/ext/mcal/php_mcal.c index d7a3f083a3..c57e7b31dd 100644 --- a/ext/mcal/php_mcal.c +++ b/ext/mcal/php_mcal.c @@ -202,10 +202,10 @@ static int add_assoc_object(zval *arg, char *key, zval *tmp) { HashTable *symtable; - if (arg->type == IS_OBJECT) { + if (Z_TYPE_P(arg) == IS_OBJECT) { symtable = Z_OBJPROP_P(arg); } else { - symtable = arg->value.ht; + symtable = Z_ARRVAL_P(arg); } return zend_hash_update(symtable, key, strlen(key)+1, (void *)&tmp, sizeof(zval *), NULL); } @@ -230,14 +230,14 @@ static void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) mcal_password = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd)); if (myargc == 4) { convert_to_long_ex(options); - flags = (*options)->value.lval; + flags = Z_LVAL_PP(options); } - mcal_stream = cal_open(NULL, (*calendar)->value.str.val, 0); + mcal_stream = cal_open(NULL, Z_STRVAL_PP(calendar), 0); efree(mcal_user); efree(mcal_password); if (!mcal_stream) { - php_error(E_WARNING, "Couldn't open stream %s\n", (*calendar)->value.str.val); + php_error(E_WARNING, "Couldn't open stream %s\n", Z_STRVAL_PP(calendar)); RETURN_FALSE; } @@ -344,7 +344,7 @@ PHP_FUNCTION(mcal_close) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -352,7 +352,7 @@ PHP_FUNCTION(mcal_close) } if (myargcount==2) { convert_to_long_ex(options); - flags = (*options)->value.lval; + flags = Z_LVAL_PP(options); mcal_le_struct->flags = flags; } zend_list_delete(ind); @@ -392,7 +392,7 @@ PHP_FUNCTION(mcal_reopen) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -402,7 +402,7 @@ PHP_FUNCTION(mcal_reopen) convert_to_string_ex(calendar); if (myargc == 3) { convert_to_long_ex(options); - flags = (*options)->value.lval; + flags = Z_LVAL_PP(options); mcal_le_struct->flags = cl_flags; } if (mcal_stream == NULL) { @@ -426,7 +426,7 @@ PHP_FUNCTION(mcal_expunge) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { @@ -455,7 +455,7 @@ PHP_FUNCTION(mcal_fetch_event) } convert_to_long_ex(streamind); convert_to_long_ex(eventid); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -464,7 +464,7 @@ PHP_FUNCTION(mcal_fetch_event) if (myargcount == 3) { convert_to_long_ex(options); } - cal_fetch(mcal_le_struct->mcal_stream, (*eventid)->value.lval, &myevent); + cal_fetch(mcal_le_struct->mcal_stream, Z_LVAL_PP(eventid), &myevent); if (myevent == NULL) { RETURN_FALSE; } @@ -487,7 +487,7 @@ PHP_FUNCTION(mcal_fetch_current_stream_event) WRONG_PARAM_COUNT; } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -516,7 +516,7 @@ PHP_FUNCTION(mcal_list_events) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -535,8 +535,8 @@ PHP_FUNCTION(mcal_list_events) convert_to_long_ex(endyear); convert_to_long_ex(endmonth); convert_to_long_ex(endday); - dt_setdate(&startdate, (*startyear)->value.lval, (*startmonth)->value.lval, (*startday)->value.lval); - dt_setdate(&enddate, (*endyear)->value.lval, (*endmonth)->value.lval, (*endday)->value.lval); + dt_setdate(&startdate, Z_LVAL_PP(startyear), Z_LVAL_PP(startmonth), Z_LVAL_PP(startday)); + dt_setdate(&enddate, Z_LVAL_PP(endyear), Z_LVAL_PP(endmonth), Z_LVAL_PP(endday)); } else { startdate = mcal_le_struct->event->start; @@ -569,14 +569,14 @@ PHP_FUNCTION(mcal_create_calendar) convert_to_long_ex(streamind); convert_to_string_ex(calendar); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } /* - if (mcal_create(mcal_le_struct->mcal_stream,calendar->value.str.val)) + if (mcal_create(mcal_le_struct->mcal_stream,Z_STRVAL_P(calendar))) { RETURN_TRUE; } @@ -605,7 +605,7 @@ PHP_FUNCTION(mcal_rename_calendar) convert_to_string_ex(src_calendar); convert_to_string_ex(dest_calendar); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -613,7 +613,7 @@ PHP_FUNCTION(mcal_rename_calendar) } /* - if(mcal_rename(mcal_le_struct->mcal_stream,src_calendar->value.str.val,dest_calendar->value.str.val)) {RETURN_TRUE;} + if(mcal_rename(mcal_le_struct->mcal_stream,Z_STRVAL_P(src_calendar),Z_STRVAL_P(dest_calendar))) {RETURN_TRUE;} else {RETURN_FALSE; } */ RETURN_TRUE; @@ -635,7 +635,7 @@ PHP_FUNCTION(mcal_list_alarms) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -653,8 +653,8 @@ PHP_FUNCTION(mcal_list_alarms) convert_to_long_ex(hour); convert_to_long_ex(min); convert_to_long_ex(sec); - dt_setdate(&mydate, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); - dt_settime(&mydate, (*hour)->value.lval, (*min)->value.lval, (*sec)->value.lval); + dt_setdate(&mydate, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); + dt_settime(&mydate, Z_LVAL_PP(hour), Z_LVAL_PP(min), Z_LVAL_PP(sec)); } else { mydate = mcal_le_struct->event->start; @@ -686,14 +686,14 @@ PHP_FUNCTION(mcal_delete_calendar) convert_to_long_ex(streamind); convert_to_string_ex(calendar); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - /* if (mcal_delete_calendar(mcal_le_struct->mcal_stream,calendar->value.str.val)) + /* if (mcal_delete_calendar(mcal_le_struct->mcal_stream,Z_STRVAL_P(calendar))) { RETURN_TRUE; } @@ -721,14 +721,14 @@ PHP_FUNCTION(mcal_delete_event) convert_to_long_ex(streamind); convert_to_long_ex(event_id); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - if (cal_remove(mcal_le_struct->mcal_stream, (*event_id)->value.lval)) { + if (cal_remove(mcal_le_struct->mcal_stream, Z_LVAL_PP(event_id))) { RETURN_TRUE; } else { @@ -754,7 +754,7 @@ PHP_FUNCTION(mcal_append_event) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -784,7 +784,7 @@ PHP_FUNCTION(mcal_store_event) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -813,14 +813,14 @@ PHP_FUNCTION(mcal_snooze) convert_to_long_ex(streamind); convert_to_long_ex(uid); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - if (cal_snooze(mcal_le_struct->mcal_stream, (*uid)->value.lval)) { + if (cal_snooze(mcal_le_struct->mcal_stream, Z_LVAL_PP(uid))) { RETURN_TRUE; } else { @@ -846,13 +846,13 @@ PHP_FUNCTION(mcal_event_set_category) convert_to_long_ex(streamind); convert_to_string_ex(category); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - mcal_le_struct->event->category = strdup((*category)->value.str.val); + mcal_le_struct->event->category = strdup(Z_STRVAL_PP(category)); } /* }}} */ @@ -873,13 +873,13 @@ PHP_FUNCTION(mcal_event_set_title) convert_to_long_ex(streamind); convert_to_string_ex(title); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - mcal_le_struct->event->title = strdup((*title)->value.str.val); + mcal_le_struct->event->title = strdup(Z_STRVAL_PP(title)); } /* }}} */ @@ -900,13 +900,13 @@ PHP_FUNCTION(mcal_event_set_description) convert_to_long_ex(streamind); convert_to_string_ex(description); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - mcal_le_struct->event->description = strdup((*description)->value.str.val); + mcal_le_struct->event->description = strdup(Z_STRVAL_PP(description)); } /* }}} */ @@ -933,18 +933,18 @@ PHP_FUNCTION(mcal_event_set_start) if (myargc > 5) convert_to_long_ex(min); if (myargc > 6) convert_to_long_ex(sec); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - dt_setdate(&(mcal_le_struct->event->start), (*year)->value.lval, (*month)->value.lval, (*date)->value.lval); + dt_setdate(&(mcal_le_struct->event->start), Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(date)); - if (myargc > 4) myhour = (*hour)->value.lval; - if (myargc > 5) mymin = (*min)->value.lval; - if (myargc > 6) mysec = (*sec)->value.lval; + if (myargc > 4) myhour = Z_LVAL_PP(hour); + if (myargc > 5) mymin = Z_LVAL_PP(min); + if (myargc > 6) mysec = Z_LVAL_PP(sec); if (myargc > 4) dt_settime(&(mcal_le_struct->event->start), myhour, mymin, mysec); } /* }}} */ @@ -974,18 +974,18 @@ PHP_FUNCTION(mcal_event_set_end) if (myargc > 5) convert_to_long_ex(min); if (myargc > 6) convert_to_long_ex(sec); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - dt_setdate(&(mcal_le_struct->event->end), (*year)->value.lval, (*month)->value.lval, (*date)->value.lval); + dt_setdate(&(mcal_le_struct->event->end), Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(date)); - if (myargc > 4) myhour = (*hour)->value.lval; - if (myargc > 5) mymin = (*min)->value.lval; - if (myargc > 6) mysec = (*sec)->value.lval; + if (myargc > 4) myhour = Z_LVAL_PP(hour); + if (myargc > 5) mymin = Z_LVAL_PP(min); + if (myargc > 6) mysec = Z_LVAL_PP(sec); if (myargc > 4) dt_settime(&(mcal_le_struct->event->end), myhour, mymin, mysec); } /* }}} */ @@ -1006,14 +1006,14 @@ PHP_FUNCTION(mcal_event_set_alarm) convert_to_long_ex(streamind); convert_to_long_ex(alarm); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - mcal_le_struct->event->alarm = (*alarm)->value.lval; + mcal_le_struct->event->alarm = Z_LVAL_PP(alarm); } /* }}} */ @@ -1032,7 +1032,7 @@ PHP_FUNCTION(mcal_event_init) } convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -1060,14 +1060,14 @@ PHP_FUNCTION(mcal_event_set_class) convert_to_long_ex(streamind); convert_to_long_ex(class); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - mcal_le_struct->event->public = (*class)->value.lval; + mcal_le_struct->event->public = Z_LVAL_PP(class); } /* }}} */ @@ -1089,14 +1089,14 @@ PHP_FUNCTION(mcal_event_add_attribute) convert_to_string_ex(attribute); convert_to_string_ex(val); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } #if MCALVER >= 20000121 - if (calevent_setattr(mcal_le_struct->event, (*attribute)->value.str.val, (*val)->value.str.val)) { + if (calevent_setattr(mcal_le_struct->event, Z_STRVAL_PP(attribute), Z_STRVAL_PP(val))) { RETURN_TRUE; } else @@ -1121,7 +1121,7 @@ PHP_FUNCTION(mcal_is_leap_year) convert_to_long_ex(year); - if (isleapyear((*year)->value.lval)) { + if (isleapyear(Z_LVAL_PP(year))) { RETURN_TRUE; } else { @@ -1146,7 +1146,7 @@ PHP_FUNCTION(mcal_days_in_month) convert_to_long_ex(leap); convert_to_boolean_ex(leap); - RETURN_LONG(daysinmonth((*month)->value.lval, (*leap)->value.lval)); + RETURN_LONG(daysinmonth(Z_LVAL_PP(month), Z_LVAL_PP(leap))); } /* }}} */ @@ -1166,7 +1166,7 @@ PHP_FUNCTION(mcal_date_valid) convert_to_long_ex(month); convert_to_long_ex(day); - if (datevalid((*year)->value.lval, (*month)->value.lval, (*day)->value.lval)) { + if (datevalid(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day))) { RETURN_TRUE; } else { @@ -1191,7 +1191,7 @@ PHP_FUNCTION(mcal_time_valid) convert_to_long_ex(min); convert_to_long_ex(sec); - if (timevalid((*hour)->value.lval, (*min)->value.lval, (*sec)->value.lval)) { + if (timevalid(Z_LVAL_PP(hour), Z_LVAL_PP(min), Z_LVAL_PP(sec))) { RETURN_TRUE; } else { @@ -1218,7 +1218,7 @@ PHP_FUNCTION(mcal_day_of_week) convert_to_long_ex(day); dt_init(&mydate); - dt_setdate(&mydate, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); + dt_setdate(&mydate, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); RETURN_LONG(dt_dayofweek(&mydate)); } @@ -1242,7 +1242,7 @@ PHP_FUNCTION(mcal_day_of_year) convert_to_long_ex(day); dt_init(&mydate); - dt_setdate(&mydate, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); + dt_setdate(&mydate, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); RETURN_LONG(dt_dayofyear(&mydate)); } @@ -1264,8 +1264,8 @@ PHP_FUNCTION(mcal_week_of_year) convert_to_long_ex(month); convert_to_long_ex(day); - if (datevalid((*year)->value.lval, (*month)->value.lval, (*day)->value.lval)) { - RETURN_LONG(dt_weekofyear((*day)->value.lval, (*month)->value.lval, (*year)->value.lval)); + if (datevalid(Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day))) { + RETURN_LONG(dt_weekofyear(Z_LVAL_PP(day), Z_LVAL_PP(month), Z_LVAL_PP(year))); } else { RETURN_FALSE; @@ -1296,8 +1296,8 @@ PHP_FUNCTION(mcal_date_compare) dt_init(&myadate); dt_init(&mybdate); - dt_setdate(&myadate, (*ayear)->value.lval, (*amonth)->value.lval, (*aday)->value.lval); - dt_setdate(&mybdate, (*byear)->value.lval, (*bmonth)->value.lval, (*bday)->value.lval); + dt_setdate(&myadate, Z_LVAL_PP(ayear), Z_LVAL_PP(amonth), Z_LVAL_PP(aday)); + dt_setdate(&mybdate, Z_LVAL_PP(byear), Z_LVAL_PP(bmonth), Z_LVAL_PP(bday)); RETURN_LONG(dt_compare(&myadate, &mybdate)); } @@ -1322,45 +1322,45 @@ PHP_FUNCTION(mcal_next_recurrence) convert_to_long_ex(weekstart); convert_to_array_ex(next); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - if (zend_hash_find((*next)->value.ht, "year", sizeof("year"), (void **) &zvalue) == SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(next), "year", sizeof("year"), (void **) &zvalue) == SUCCESS) { SEPARATE_ZVAL(zvalue); convert_to_long_ex(zvalue); - mydate.year = (*zvalue)->value.lval; + mydate.year = Z_LVAL_PP(zvalue); } - if (zend_hash_find((*next)->value.ht, "month", sizeof("month"), (void **) &zvalue) == SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(next), "month", sizeof("month"), (void **) &zvalue) == SUCCESS) { SEPARATE_ZVAL(zvalue); convert_to_long_ex(zvalue); - mydate.mon = (*zvalue)->value.lval; + mydate.mon = Z_LVAL_PP(zvalue); } - if (zend_hash_find((*next)->value.ht, "mday", sizeof("mday"), (void **) &zvalue) == SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(next), "mday", sizeof("mday"), (void **) &zvalue) == SUCCESS) { SEPARATE_ZVAL(zvalue); convert_to_long_ex(zvalue); - mydate.mday = (*zvalue)->value.lval; + mydate.mday = Z_LVAL_PP(zvalue); } - if (zend_hash_find((*next)->value.ht, "hour", sizeof("hour"), (void **) &zvalue) == SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(next), "hour", sizeof("hour"), (void **) &zvalue) == SUCCESS) { SEPARATE_ZVAL(zvalue); convert_to_long_ex(zvalue); - mydate.hour = (*zvalue)->value.lval; + mydate.hour = Z_LVAL_PP(zvalue); } - if (zend_hash_find((*next)->value.ht, "min", sizeof("min"), (void **) &zvalue) == SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(next), "min", sizeof("min"), (void **) &zvalue) == SUCCESS) { SEPARATE_ZVAL(zvalue); convert_to_long_ex(zvalue); - mydate.min = (*zvalue)->value.lval; + mydate.min = Z_LVAL_PP(zvalue); } - if (zend_hash_find((*next)->value.ht, "sec", sizeof("sec"), (void **) &zvalue) == SUCCESS) { + if (zend_hash_find(Z_ARRVAL_PP(next), "sec", sizeof("sec"), (void **) &zvalue) == SUCCESS) { SEPARATE_ZVAL(zvalue); convert_to_long_ex(zvalue); - mydate.sec = (*zvalue)->value.lval; + mydate.sec = Z_LVAL_PP(zvalue); } - calevent_next_recurrence(mcal_le_struct->event, &mydate, (*weekstart)->value.lval); + calevent_next_recurrence(mcal_le_struct->event, &mydate, Z_LVAL_PP(weekstart)); if (object_init(return_value) == FAILURE) { RETURN_FALSE; @@ -1395,7 +1395,7 @@ PHP_FUNCTION(mcal_event_set_recur_none) convert_to_long_ex(streamind); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); @@ -1427,15 +1427,15 @@ PHP_FUNCTION(mcal_event_set_recur_daily) convert_to_long_ex(day); convert_to_long_ex(interval); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); - calevent_recur_daily(mcal_le_struct->event, &endtime, (*interval)->value.lval); + dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); + calevent_recur_daily(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval)); } /* }}} */ @@ -1461,15 +1461,15 @@ PHP_FUNCTION(mcal_event_set_recur_weekly) convert_to_long_ex(interval); convert_to_long_ex(weekdays); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); - calevent_recur_weekly(mcal_le_struct->event, &endtime, (*interval)->value.lval, (*weekdays)->value.lval); + dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); + calevent_recur_weekly(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval), Z_LVAL_PP(weekdays)); } /* }}} */ @@ -1494,15 +1494,15 @@ PHP_FUNCTION(mcal_event_set_recur_monthly_mday) convert_to_long_ex(day); convert_to_long_ex(interval); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); - calevent_recur_monthly_mday(mcal_le_struct->event, &endtime, (*interval)->value.lval); + dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); + calevent_recur_monthly_mday(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval)); } /* }}} */ @@ -1527,15 +1527,15 @@ PHP_FUNCTION(mcal_event_set_recur_monthly_wday) convert_to_long_ex(day); convert_to_long_ex(interval); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); - calevent_recur_monthly_wday(mcal_le_struct->event, &endtime, (*interval)->value.lval); + dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); + calevent_recur_monthly_wday(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval)); } /* }}} */ @@ -1560,15 +1560,15 @@ PHP_FUNCTION(mcal_event_set_recur_yearly) convert_to_long_ex(day); convert_to_long_ex(interval); - ind = (*streamind)->value.lval; + ind = Z_LVAL_PP(streamind); mcal_le_struct = (pils *)zend_list_find(ind, &ind_type); if (!mcal_le_struct) { php_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } - dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval); - calevent_recur_yearly(mcal_le_struct->event, &endtime, (*interval)->value.lval); + dt_setdate(&endtime, Z_LVAL_PP(year), Z_LVAL_PP(month), Z_LVAL_PP(day)); + calevent_recur_yearly(mcal_le_struct->event, &endtime, Z_LVAL_PP(interval)); } /* }}} */ diff --git a/ext/ming/ming.c b/ext/ming/ming.c index 4aca1f2c89..ddb9166345 100644 --- a/ext/ming/ming.c +++ b/ext/ming/ming.c @@ -139,7 +139,7 @@ static void *SWFgetProperty(zval *id, char *name, int namelen, int proptype TSRM php_error(E_WARNING, "unable to find property %s", name); return NULL; } - id_to_find = (*tmp)->value.lval; + id_to_find = Z_LVAL_PP(tmp); } else return NULL; @@ -163,21 +163,21 @@ static void *SWFgetProperty(zval *id, char *name, int namelen, int proptype TSRM SWFCharacter getCharacter(zval *id TSRMLS_DC) { - if(id->value.obj.ce == &shape_class_entry) + if(Z_OBJCE_P(id) == &shape_class_entry) return (SWFCharacter)getShape(id TSRMLS_CC); - else if(id->value.obj.ce == &font_class_entry) + else if(Z_OBJCE_P(id) == &font_class_entry) return (SWFCharacter)getFont(id TSRMLS_CC); - else if(id->value.obj.ce == &text_class_entry) + else if(Z_OBJCE_P(id) == &text_class_entry) return (SWFCharacter)getText(id TSRMLS_CC); - else if(id->value.obj.ce == &textfield_class_entry) + else if(Z_OBJCE_P(id) == &textfield_class_entry) return (SWFCharacter)getTextField(id TSRMLS_CC); - else if(id->value.obj.ce == &button_class_entry) + else if(Z_OBJCE_P(id) == &button_class_entry) return (SWFCharacter)getButton(id TSRMLS_CC); - else if(id->value.obj.ce == &morph_class_entry) + else if(Z_OBJCE_P(id) == &morph_class_entry) return (SWFCharacter)getMorph(id TSRMLS_CC); - else if(id->value.obj.ce == &sprite_class_entry) + else if(Z_OBJCE_P(id) == &sprite_class_entry) return (SWFCharacter)getSprite(id TSRMLS_CC); - else if(id->value.obj.ce == &bitmap_class_entry) + else if(Z_OBJCE_P(id) == &bitmap_class_entry) return (SWFCharacter)getBitmap(id TSRMLS_CC); else php_error(E_ERROR, "called object is not an SWFCharacter"); @@ -235,7 +235,7 @@ static SWFInput getInput(zval **zfile) else { input = newSWFInput_file(file); - zend_list_addref((*zfile)->value.lval); + zend_list_addref(Z_LVAL_PP(zfile)); } zend_list_addref(zend_list_insert(input, le_swfinputp)); @@ -328,7 +328,7 @@ PHP_FUNCTION(swfbitmap_init) else WRONG_PARAM_COUNT; - if((*zfile)->type != IS_RESOURCE) + if(Z_TYPE_PP(zfile) != IS_RESOURCE) { convert_to_string_ex(zfile); input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile)); @@ -339,7 +339,7 @@ PHP_FUNCTION(swfbitmap_init) if(zmask != NULL) { - if((*zmask)->type != IS_RESOURCE) + if(Z_TYPE_PP(zmask) != IS_RESOURCE) { convert_to_string_ex(zmask); maskinput = newSWFInput_buffer(Z_STRVAL_PP(zmask), Z_STRLEN_PP(zmask)); @@ -1526,7 +1526,7 @@ PHP_FUNCTION(swfmovie_add) convert_to_object_ex(zchar); /* XXX - SWFMovie_add deals w/ all block types. Probably will need to add that.. */ - if((*zchar)->value.obj.ce == &action_class_entry) + if(Z_OBJCE_PP(zchar) == &action_class_entry) block = (SWFBlock)getAction(*zchar TSRMLS_CC); else block = (SWFBlock)getCharacter(*zchar TSRMLS_CC); @@ -1613,7 +1613,7 @@ PHP_FUNCTION(swfmovie_save) if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &x) == FAILURE) WRONG_PARAM_COUNT; - if((*x)->type == IS_RESOURCE) + if(Z_TYPE_PP(x) == IS_RESOURCE) { ZEND_FETCH_RESOURCE(file, FILE *, x, -1,"File-Handle",php_file_le_fopen()); @@ -1717,7 +1717,7 @@ PHP_FUNCTION(swfmovie_streamMp3) if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE) WRONG_PARAM_COUNT; - if((*zfile)->type != IS_RESOURCE) + if(Z_TYPE_PP(zfile) != IS_RESOURCE) { convert_to_string_ex(zfile); input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile)); @@ -2396,7 +2396,7 @@ PHP_FUNCTION(swfsprite_add) convert_to_object_ex(zchar); - if((*zchar)->value.obj.ce == &action_class_entry) + if(Z_OBJCE_PP(zchar) == &action_class_entry) block = (SWFBlock)getAction(*zchar TSRMLS_CC); else block = (SWFBlock)getCharacter(*zchar TSRMLS_CC); diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c index a1f7083af4..70c0480bcc 100644 --- a/ext/mnogosearch/php_mnogo.c +++ b/ext/mnogosearch/php_mnogo.c @@ -341,7 +341,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent) RETURN_FALSE; } convert_to_string_ex(yydbaddr); - dbaddr = (*yydbaddr)->value.str.val; + dbaddr = Z_STRVAL_PP(yydbaddr); Env=UdmAllocEnv(); UdmEnvSetDBAddr(Env,dbaddr); @@ -364,8 +364,8 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent) } convert_to_string_ex(yydbaddr); convert_to_string_ex(yydbmode); - dbaddr = (*yydbaddr)->value.str.val; - dbmode = (*yydbmode)->value.str.val; + dbaddr = Z_STRVAL_PP(yydbaddr); + dbmode = Z_STRVAL_PP(yydbmode); Env=UdmAllocEnv(); UdmEnvSetDBAddr(Env,dbaddr); @@ -401,8 +401,8 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) convert_to_long_ex(yyvar); convert_to_string_ex(yyval); ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link); - var = (*yyvar)->value.lval; - val = (*yyval)->value.str.val; + var = Z_LVAL_PP(yyvar); + val = Z_STRVAL_PP(yyval); break; @@ -644,8 +644,8 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data) convert_to_string_ex(yyval1); convert_to_string_ex(yyval2); ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link); - var = (*yyvar)->value.lval; - flag = (*yyflag)->value.lval; + var = Z_LVAL_PP(yyvar); + flag = Z_LVAL_PP(yyflag); val1 = (*yyval1)->value.str.val; val2 = (*yyval2)->value.str.val; @@ -769,8 +769,8 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit) convert_to_long_ex(yyvar); convert_to_string_ex(yyval); ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link); - var = (*yyvar)->value.lval; - val = (*yyval)->value.str.val; + var = Z_LVAL_PP(yyvar); + val = Z_STRVAL_PP(yyval); break; @@ -804,9 +804,9 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit) struct udm_stl_info_t stl_info = { 0, 0, 0 }; if (val[0] == '>') { - stl_info.type=1; + Z_TYPE(stl_info)=1; } else if (val[0] == '<') { - stl_info.type=-1; + Z_TYPE(stl_info)=-1; } else { php_error(E_WARNING,"Udm_Add_Search_Limit: Incorrect date limit format"); RETURN_FALSE; @@ -874,7 +874,7 @@ DLEXPORT PHP_FUNCTION(udm_find) ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); convert_to_string_ex(yyquery); - if ((Res=UdmFind(Agent,UdmTolower((*yyquery)->value.str.val,Agent->charset)))) { + if ((Res=UdmFind(Agent,UdmTolower(Z_STRVAL_PP(yyquery),Agent->charset)))) { ZEND_REGISTER_RESOURCE(return_value,Res,le_res); } else { RETURN_FALSE; @@ -898,8 +898,8 @@ DLEXPORT PHP_FUNCTION(udm_get_res_field) } convert_to_string_ex(yyrow_num); convert_to_string_ex(yyfield_name); - field=atoi((*yyfield_name)->value.str.val); - row=atoi((*yyrow_num)->value.str.val); + field=atoi(Z_STRVAL_PP(yyfield_name)); + row=atoi(Z_STRVAL_PP(yyrow_num)); } break; default: @@ -986,7 +986,7 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param) RETURN_FALSE; } convert_to_long_ex(yyparam); - param=((*yyparam)->value.lval); + param=(Z_LVAL_PP(yyparam)); } break; default: @@ -1045,7 +1045,7 @@ DLEXPORT PHP_FUNCTION(udm_free_res) break; } ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res); - zend_list_delete((*yyres)->value.lval); + zend_list_delete(Z_LVAL_PP(yyres)); RETURN_TRUE; } @@ -1069,7 +1069,7 @@ DLEXPORT PHP_FUNCTION(udm_free_agent) break; } ZEND_FETCH_RESOURCE(Agent, UDM_RESULT *, yyagent, -1, "mnoGoSearch-agent", le_link); - zend_list_delete((*yyagent)->value.lval); + zend_list_delete(Z_LVAL_PP(yyagent)); RETURN_TRUE; } @@ -1152,7 +1152,7 @@ DLEXPORT PHP_FUNCTION(udm_cat_list) } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); convert_to_string_ex(yycat); - cat = (*yycat)->value.str.val; + cat = Z_STRVAL_PP(yycat); if((c=UdmCatList(Agent,cat))){ if (array_init(return_value)==FAILURE) { @@ -1201,7 +1201,7 @@ DLEXPORT PHP_FUNCTION(udm_cat_path) } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); convert_to_string_ex(yycat); - cat = (*yycat)->value.str.val; + cat = Z_STRVAL_PP(yycat); if((c=UdmCatPath(Agent,cat))){ if (array_init(return_value)==FAILURE) { diff --git a/ext/msql/php_msql.c b/ext/msql/php_msql.c index bc477079d3..bf266d6afd 100644 --- a/ext/msql/php_msql.c +++ b/ext/msql/php_msql.c @@ -175,7 +175,7 @@ PHP_MINIT_FUNCTION(msql) msql_globals.le_link = zend_register_list_destructors_ex(_close_msql_link, NULL, "msql link", module_number); msql_globals.le_plink = zend_register_list_destructors_ex(NULL, _close_msql_plink, "msql link persistent", module_number); - msql_module_entry.type = type; + Z_TYPE(msql_module_entry) = type; REGISTER_LONG_CONSTANT("MSQL_ASSOC", MSQL_ASSOC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MSQL_NUM", MSQL_NUM, CONST_CS | CONST_PERSISTENT); @@ -248,10 +248,10 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) RETURN_FALSE; } convert_to_string(yyhost); - host = yyhost->value.str.val; - hashed_details_length = yyhost->value.str.len+4+1; + host = Z_STRVAL_P(yyhost); + hashed_details_length = Z_STRLEN_P(yyhost)+4+1; hashed_details = emalloc(hashed_details_length+1); - sprintf(hashed_details,"msql_%s",yyhost->value.str.val); /* SAFE */ + sprintf(hashed_details,"msql_%s",Z_STRVAL_P(yyhost)); /* SAFE */ } break; default: @@ -287,7 +287,7 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) } /* hash it up */ - new_le.type = msql_globals.le_plink; + Z_TYPE(new_le) = msql_globals.le_plink; new_le.ptr = (void *) msql; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); @@ -296,7 +296,7 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) msql_globals.num_persistent++; msql_globals.num_links++; } else { /* we do */ - if (le->type != msql_globals.le_plink) { + if (Z_TYPE_P(le) != msql_globals.le_plink) { efree(hashed_details); RETURN_FALSE; } @@ -327,14 +327,14 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) int type,link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (int) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==msql_globals.le_link || type==msql_globals.le_plink)) { - return_value->value.lval = msql_globals.default_link = link; - return_value->type = IS_RESOURCE; + Z_LVAL_P(return_value) = msql_globals.default_link = link; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; } else { @@ -355,8 +355,8 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) ZEND_REGISTER_RESOURCE(return_value, (void *) msql, msql_globals.le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); RETURN_FALSE; @@ -364,7 +364,7 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) msql_globals.num_links++; } efree(hashed_details); - msql_globals.default_link=return_value->value.lval; + msql_globals.default_link=Z_LVAL_P(return_value); } /* }}} */ @@ -466,7 +466,7 @@ PHP_FUNCTION(msql_select_db) convert_to_string(db); - if (msqlSelectDB(msql,db->value.str.val)==-1) { + if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) { RETURN_FALSE; } else { RETURN_TRUE; @@ -503,7 +503,7 @@ PHP_FUNCTION(msql_create_db) ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); convert_to_string(db); - if (msqlCreateDB(msql,db->value.str.val)<0) { + if (msqlCreateDB(msql,Z_STRVAL_P(db))<0) { RETURN_FALSE; } else { RETURN_TRUE; @@ -540,7 +540,7 @@ PHP_FUNCTION(msql_drop_db) ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); convert_to_string(db); - if (msqlDropDB(msql,db->value.str.val)<0) { + if (msqlDropDB(msql,Z_STRVAL_P(db))<0) { RETURN_FALSE; } else { RETURN_TRUE; @@ -578,7 +578,7 @@ PHP_FUNCTION(msql_query) ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); convert_to_string(query); - if ((af_rows = msqlQuery(msql,query->value.str.val))==-1) { + if ((af_rows = msqlQuery(msql,Z_STRVAL_P(query)))==-1) { RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msqlStoreResult(), af_rows), msql_globals.le_query); @@ -615,12 +615,12 @@ PHP_FUNCTION(msql_db_query) ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); convert_to_string(db); - if (msqlSelectDB(msql,db->value.str.val)==-1) { + if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) { RETURN_FALSE; } convert_to_string(query); - if ((af_rows = msqlQuery(msql,query->value.str.val))==-1) { + if ((af_rows = msqlQuery(msql,Z_STRVAL_P(query)))==-1) { RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msqlStoreResult(), af_rows), msql_globals.le_query); @@ -691,7 +691,7 @@ PHP_FUNCTION(msql_list_tables) ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); convert_to_string(db); - if (msqlSelectDB(msql,db->value.str.val)==-1) { + if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) { RETURN_FALSE; } if ((msql_result=msqlListTables(msql))==NULL) { @@ -732,11 +732,11 @@ PHP_FUNCTION(msql_list_fields) ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); convert_to_string(db); - if (msqlSelectDB(msql,db->value.str.val)==-1) { + if (msqlSelectDB(msql,Z_STRVAL_P(db))==-1) { RETURN_FALSE; } convert_to_string(table); - if ((msql_result=msqlListFields(msql,table->value.str.val))==NULL) { + if ((msql_result=msqlListFields(msql,Z_STRVAL_P(table)))==NULL) { php_error(E_WARNING,"Unable to save mSQL query result"); RETURN_FALSE; } @@ -784,29 +784,29 @@ PHP_FUNCTION(msql_result) MSQL_GET_QUERY(result); convert_to_long(row); - if (row->value.lval<0 || row->value.lval>=msqlNumRows(msql_result)) { - php_error(E_WARNING,"Unable to jump to row %d on mSQL query index %d",row->value.lval,result->value.lval); + if (Z_LVAL_P(row)<0 || Z_LVAL_P(row)>=msqlNumRows(msql_result)) { + php_error(E_WARNING,"Unable to jump to row %d on mSQL query index %d",Z_LVAL_P(row),Z_LVAL_P(result)); RETURN_FALSE; } - msqlDataSeek(msql_result,row->value.lval); + msqlDataSeek(msql_result,Z_LVAL_P(row)); if ((sql_row=msqlFetchRow(msql_result))==NULL) { /* shouldn't happen? */ RETURN_FALSE; } if (field) { - switch(field->type) { + switch(Z_TYPE_P(field)) { case IS_STRING: { int i=0; m_field *tmp_field; char *table_name,*field_name,*tmp; - if ((tmp=strchr(field->value.str.val,'.'))) { + if ((tmp=strchr(Z_STRVAL_P(field),'.'))) { *tmp = 0; - table_name = estrdup(field->value.str.val); + table_name = estrdup(Z_STRVAL_P(field)); field_name = estrdup(tmp+1); } else { table_name = NULL; - field_name = estrndup(field->value.str.val,field->value.str.len); + field_name = estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field)); } msqlFieldSeek(msql_result,0); while ((tmp_field=msqlFetchField(msql_result))) { @@ -818,7 +818,7 @@ PHP_FUNCTION(msql_result) } if (!tmp_field) { /* no match found */ php_error(E_WARNING,"%s%s%s not found in mSQL query index %d", - (table_name?table_name:""), (table_name?".":""), field_name, result->value.lval); + (table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_P(result)); efree(field_name); if (table_name) { efree(table_name); @@ -833,7 +833,7 @@ PHP_FUNCTION(msql_result) break; default: convert_to_long(field); - field_offset = field->value.lval; + field_offset = Z_LVAL_P(field); if (field_offset<0 || field_offset>=msqlNumFields(msql_result)) { php_error(E_WARNING,"Bad column offset specified"); RETURN_FALSE; @@ -844,12 +844,12 @@ PHP_FUNCTION(msql_result) if (sql_row[field_offset]) { if (PG(magic_quotes_runtime)) { - return_value->value.str.val = php_addslashes(sql_row[field_offset],0,&return_value->value.str.len,0 TSRMLS_CC); + Z_STRVAL_P(return_value) = php_addslashes(sql_row[field_offset],0,&Z_STRLEN_P(return_value),0 TSRMLS_CC); } else { - return_value->value.str.len = (sql_row[field_offset]?strlen(sql_row[field_offset]):0); - return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset],return_value->value.str.len); + Z_STRLEN_P(return_value) = (sql_row[field_offset]?strlen(sql_row[field_offset]):0); + Z_STRVAL_P(return_value) = (char *) safe_estrndup(sql_row[field_offset],Z_STRLEN_P(return_value)); } - return_value->type = IS_STRING; + Z_TYPE_P(return_value) = IS_STRING; } else { ZVAL_FALSE(return_value); } @@ -980,8 +980,8 @@ PHP_FUNCTION(msql_fetch_row) PHP_FUNCTION(msql_fetch_object) { php_msql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); - if (return_value->type==IS_ARRAY) { - object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht); + if (Z_TYPE_P(return_value)==IS_ARRAY) { + object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value)); } } /* }}} */ @@ -1009,12 +1009,12 @@ PHP_FUNCTION(msql_data_seek) MSQL_GET_QUERY(result); convert_to_long(offset); if (!msql_result || - offset->value.lval<0 || - offset->value.lval>=msqlNumRows(msql_result)) { - php_error(E_WARNING,"Offset %d is invalid for mSQL query index %d",offset->value.lval,result->value.lval); + Z_LVAL_P(offset)<0 || + Z_LVAL_P(offset)>=msqlNumRows(msql_result)) { + php_error(E_WARNING,"Offset %d is invalid for mSQL query index %d",Z_LVAL_P(offset),Z_LVAL_P(result)); RETURN_FALSE; } - msqlDataSeek(msql_result,offset->value.lval); + msqlDataSeek(msql_result,Z_LVAL_P(offset)); RETURN_TRUE; } /* }}} */ @@ -1087,11 +1087,11 @@ PHP_FUNCTION(msql_fetch_field) MSQL_GET_QUERY(result); if (field) { - if (field->value.lval<0 || field->value.lval>=msqlNumRows(msql_result)) { + if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumRows(msql_result)) { php_error(E_NOTICE,"mSQL: Bad field offset specified"); RETURN_FALSE; } - msqlFieldSeek(msql_result,field->value.lval); + msqlFieldSeek(msql_result,Z_LVAL_P(field)); } if (!msql_result || (msql_field=msqlFetchField(msql_result))==NULL) { RETURN_FALSE; @@ -1109,7 +1109,7 @@ PHP_FUNCTION(msql_fetch_field) add_property_long(return_value, "unique",(msql_field->flags&UNIQUE_FLAG?1:0)); #endif - add_property_string(return_value, "type",php_msql_get_field_name(msql_field->type), 1); + add_property_string(return_value, "type",php_msql_get_field_name(Z_TYPE_P(msql_field)), 1); } /* }}} */ @@ -1130,12 +1130,12 @@ PHP_FUNCTION(msql_field_seek) if(!msql_result) { RETURN_FALSE; } - if (offset->value.lval<0 || offset->value.lval>=msqlNumFields(msql_result)) { + if (Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)>=msqlNumFields(msql_result)) { php_error(E_WARNING,"Field %d is invalid for mSQL query index %d", - offset->value.lval,result->value.lval); + Z_LVAL_P(offset),Z_LVAL_P(result)); RETURN_FALSE; } - msqlFieldSeek(msql_result,offset->value.lval); + msqlFieldSeek(msql_result,Z_LVAL_P(offset)); RETURN_TRUE; } /* }}} */ @@ -1164,65 +1164,65 @@ static void php_msql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) RETURN_FALSE; } convert_to_long(field); - if (field->value.lval<0 || field->value.lval>=msqlNumFields(msql_result)) { - php_error(E_WARNING,"Field %d is invalid for mSQL query index %d",field->value.lval,result->value.lval); + if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumFields(msql_result)) { + php_error(E_WARNING,"Field %d is invalid for mSQL query index %d",Z_LVAL_P(field),Z_LVAL_P(result)); RETURN_FALSE; } - msqlFieldSeek(msql_result,field->value.lval); + msqlFieldSeek(msql_result,Z_LVAL_P(field)); if ((msql_field=msqlFetchField(msql_result))==NULL) { RETURN_FALSE; } switch (entry_type) { case PHP_MSQL_FIELD_NAME: - return_value->value.str.len = strlen(msql_field->name); - return_value->value.str.val = estrndup(msql_field->name,return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(msql_field->name); + Z_STRVAL_P(return_value) = estrndup(msql_field->name,Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case PHP_MSQL_FIELD_TABLE: - return_value->value.str.len = strlen(msql_field->table); - return_value->value.str.val = estrndup(msql_field->table,return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(msql_field->table); + Z_STRVAL_P(return_value) = estrndup(msql_field->table,Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case PHP_MSQL_FIELD_LEN: - return_value->value.lval = msql_field->length; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = msql_field->length; + Z_TYPE_P(return_value) = IS_LONG; break; case PHP_MSQL_FIELD_TYPE: - return_value->value.str.val = estrdup(php_msql_get_field_name(msql_field->type)); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrdup(php_msql_get_field_name(Z_TYPE_P(msql_field))); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case PHP_MSQL_FIELD_FLAGS: #if MSQL1 if ((msql_field->flags&NOT_NULL_FLAG) && (msql_field->flags&PRI_KEY_FLAG)) { - return_value->value.str.val = estrndup("primary key not null",20); - return_value->value.str.len = 20; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup("primary key not null",20); + Z_STRLEN_P(return_value) = 20; + Z_TYPE_P(return_value) = IS_STRING; } else if (msql_field->flags&NOT_NULL_FLAG) { - return_value->value.str.val = estrndup("not null",8); - return_value->value.str.len = 8; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup("not null",8); + Z_STRLEN_P(return_value) = 8; + Z_TYPE_P(return_value) = IS_STRING; } else if (msql_field->flags&PRI_KEY_FLAG) { - return_value->value.str.val = estrndup("primary key",11); - return_value->value.str.len = 11; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup("primary key",11); + Z_STRLEN_P(return_value) = 11; + Z_TYPE_P(return_value) = IS_STRING; } else { ZVAL_FALSE(return_value); } #else if ((msql_field->flags&NOT_NULL_FLAG) && (msql_field->flags&UNIQUE_FLAG)) { - return_value->value.str.val = estrndup("unique not null",15); - return_value->value.str.len = 15; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup("unique not null",15); + Z_STRLEN_P(return_value) = 15; + Z_TYPE_P(return_value) = IS_STRING; } else if (msql_field->flags&NOT_NULL_FLAG) { - return_value->value.str.val = estrndup("not null",8); - return_value->value.str.len = 8; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup("not null",8); + Z_STRLEN_P(return_value) = 8; + Z_TYPE_P(return_value) = IS_STRING; } else if (msql_field->flags&UNIQUE_FLAG) { - return_value->value.str.val = estrndup("unique",6); - return_value->value.str.len = 6; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup("unique",6); + Z_STRLEN_P(return_value) = 6; + Z_TYPE_P(return_value) = IS_STRING; } else { ZVAL_FALSE(return_value); } @@ -1287,7 +1287,7 @@ PHP_FUNCTION(msql_free_result) } MSQL_GET_QUERY(result); - zend_list_delete(result->value.lval); + zend_list_delete(Z_LVAL_P(result)); RETURN_TRUE; } /* }}} */ diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 995bc157b1..a6a1f0fb38 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -160,7 +160,7 @@ static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate static int _clean_invalid_results(list_entry *le TSRMLS_DC) { - if (le->type == le_result) { + if (Z_TYPE_P(le) == le_result) { mssql_link *mssql_ptr = ((mssql_result *) le->ptr)->mssql_ptr; if (!mssql_ptr->valid) { @@ -279,7 +279,7 @@ PHP_MINIT_FUNCTION(mssql) le_result = zend_register_list_destructors_ex(_free_mssql_result, NULL, "mssql result", module_number); le_link = zend_register_list_destructors_ex(_close_mssql_link, NULL, "mssql link", module_number); le_plink = zend_register_list_destructors_ex(NULL, _close_mssql_plink, "mssql link persistent", module_number); - mssql_module_entry.type = type; + Z_TYPE(mssql_module_entry) = type; if (dbinit()==FAIL) { return FAILURE; @@ -379,11 +379,11 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) WRONG_PARAM_COUNT; } convert_to_string_ex(yyhost); - host = (*yyhost)->value.str.val; + host = Z_STRVAL_PP(yyhost); user=passwd=NULL; - hashed_details_length = (*yyhost)->value.str.len+5+3; + hashed_details_length = Z_STRLEN_PP(yyhost)+5+3; hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"mssql_%s__",(*yyhost)->value.str.val); + sprintf(hashed_details,"mssql_%s__",Z_STRVAL_PP(yyhost)); } break; case 2: { @@ -394,12 +394,12 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } convert_to_string_ex(yyhost); convert_to_string_ex(yyuser); - host = (*yyhost)->value.str.val; - user = (*yyuser)->value.str.val; + host = Z_STRVAL_PP(yyhost); + user = Z_STRVAL_PP(yyuser); passwd=NULL; - hashed_details_length = (*yyhost)->value.str.len+(*yyuser)->value.str.len+5+3; + hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+5+3; hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"mssql_%s_%s_",(*yyhost)->value.str.val,(*yyuser)->value.str.val); + sprintf(hashed_details,"mssql_%s_%s_",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser)); } break; case 3: { @@ -411,12 +411,12 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) convert_to_string_ex(yyhost); convert_to_string_ex(yyuser); convert_to_string_ex(yypasswd); - host = (*yyhost)->value.str.val; - user = (*yyuser)->value.str.val; - passwd = (*yypasswd)->value.str.val; - hashed_details_length = (*yyhost)->value.str.len+(*yyuser)->value.str.len+(*yypasswd)->value.str.len+5+3; + host = Z_STRVAL_PP(yyhost); + user = Z_STRVAL_PP(yyuser); + passwd = Z_STRVAL_PP(yypasswd); + hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+5+3; hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"mssql_%s_%s_%s",(*yyhost)->value.str.val,(*yyuser)->value.str.val,(*yypasswd)->value.str.val); /* SAFE */ + sprintf(hashed_details,"mssql_%s_%s_%s",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd)); /* SAFE */ } break; default: @@ -502,7 +502,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* hash it up */ mssql_ptr = (mssql_link *) malloc(sizeof(mssql_link)); memcpy(mssql_ptr, &mssql, sizeof(mssql_link)); - new_le.type = le_plink; + Z_TYPE(new_le) = le_plink; new_le.ptr = mssql_ptr; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, &new_le, sizeof(list_entry), NULL)==FAILURE) { free(mssql_ptr); @@ -513,7 +513,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MS_SQL_G(num_persistent)++; MS_SQL_G(num_links)++; } else { /* we do */ - if (le->type != le_plink) { + if (Z_TYPE_P(le) != le_plink) { #if BROKEN_MSSQL_PCONNECTS log_error("PHP/MS SQL: Hashed persistent link is not a MS SQL link!",php_rqst->server); #endif @@ -562,16 +562,16 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) int type,link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (int) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - return_value->value.lval = link; + Z_LVAL_P(return_value) = link; php_mssql_set_default_link(link TSRMLS_CC); - return_value->type = IS_RESOURCE; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; } else { @@ -618,8 +618,8 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) { efree(hashed_details); RETURN_FALSE; @@ -627,7 +627,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MS_SQL_G(num_links)++; } efree(hashed_details); - php_mssql_set_default_link(return_value->value.lval TSRMLS_CC); + php_mssql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); } @@ -684,7 +684,7 @@ PHP_FUNCTION(mssql_close) ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink); if (mssql_link_index) - zend_list_delete((*mssql_link_index)->value.lval); + zend_list_delete(Z_LVAL_PP(mssql_link_index)); else zend_list_delete(id); @@ -724,8 +724,8 @@ PHP_FUNCTION(mssql_select_db) convert_to_string_ex(db); - if (dbuse(mssql_ptr->link, (*db)->value.str.val)==FAIL) { - php_error(E_WARNING,"MS SQL: Unable to select database: %s", (*db)->value.str.val); + if (dbuse(mssql_ptr->link, Z_STRVAL_PP(db))==FAIL) { + php_error(E_WARNING,"MS SQL: Unable to select database: %s", Z_STRVAL_PP(db)); RETURN_FALSE; } else { RETURN_TRUE; @@ -747,8 +747,8 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off case SQLINT2: case SQLINT4: case SQLINTN: { - result->value.lval = (long) anyintcol(offset); - result->type = IS_LONG; + Z_LVAL_P(result) = (long) anyintcol(offset); + Z_TYPE_P(result) = IS_LONG; break; } case SQLCHAR: @@ -761,14 +761,14 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off while (length>0 && data[length-1] == ' ') { /* nuke trailing whitespace */ length--; } - result->value.str.val = estrndup(data,length); - result->value.str.len = length; - result->type = IS_STRING; + Z_STRVAL_P(result) = estrndup(data,length); + Z_STRLEN_P(result) = length; + Z_TYPE_P(result) = IS_STRING; break; } case SQLFLT8: { - result->value.dval = (double) floatcol(offset); - result->type = IS_DOUBLE; + Z_DVAL_P(result) = (double) floatcol(offset); + Z_TYPE_P(result) = IS_DOUBLE; break; } case SQLVARBINARY: @@ -782,9 +782,9 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset)); memcpy(res_buf,bin,res_length); res_buf[res_length] = '\0'; - result->value.str.len = res_length; - result->value.str.val = res_buf; - result->type = IS_STRING; + Z_STRLEN_P(result) = res_length; + Z_STRVAL_P(result) = res_buf; + Z_TYPE_P(result) = IS_STRING; } break; case SQLNUMERIC: @@ -798,9 +798,9 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off res_buf = (char *) emalloc(res_length + 1); res_length = dbconvert(NULL,column_type,dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1); - result->value.str.val = res_buf; - result->value.str.len = res_length; - result->type = IS_STRING; + Z_STRVAL_P(result) = res_buf; + Z_STRLEN_P(result) = res_length; + Z_TYPE_P(result) = IS_STRING; } else { php_error(E_WARNING,"MS SQL: column %d has unknown data type (%d)", offset, coltype(offset)); ZVAL_FALSE(result); @@ -827,9 +827,9 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset)); memcpy(res_buf, bin, res_length); res_buf[res_length] = '\0'; - result->value.str.len = res_length; - result->value.str.val = res_buf; - result->type = IS_STRING; + Z_STRLEN_P(result) = res_length; + Z_STRVAL_P(result) = res_buf; + Z_TYPE_P(result) = IS_STRING; } else if (dbwillconvert(coltype(offset),SQLCHAR)) { unsigned char *res_buf; @@ -840,9 +840,9 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int res_buf = (unsigned char *) emalloc(res_length + 1); res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1); - result->value.str.val = res_buf; - result->value.str.len = res_length; - result->type = IS_STRING; + Z_STRVAL_P(result) = res_buf; + Z_STRLEN_P(result) = res_length; + Z_TYPE_P(result) = IS_STRING; } else { php_error(E_WARNING,"MS SQL: column %d has unknown data type (%d)", offset, coltype(offset)); ZVAL_FALSE(result); @@ -878,7 +878,7 @@ static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int r column_types[i] = coltype(i+1); - result->fields[i].type = column_types[i]; + result->Z_TYPE(fields[i]) = column_types[i]; /* set numeric flag */ switch (column_types[i]) { case SQLINT1: @@ -938,7 +938,7 @@ PHP_FUNCTION(mssql_fetch_batch) WRONG_PARAM_COUNT; } - if ((*mssql_result_index)->type==IS_RESOURCE && (*mssql_result_index)->value.lval==0) { + if (Z_TYPE_PP(mssql_result_index)==IS_RESOURCE && Z_LVAL_PP(mssql_result_index)==0) { RETURN_FALSE; } @@ -983,7 +983,7 @@ PHP_FUNCTION(mssql_query) } id = -1; convert_to_long_ex(zbatchsize); - batchsize = (*zbatchsize)->value.lval; + batchsize = Z_LVAL_PP(zbatchsize); break; default: WRONG_PARAM_COUNT; @@ -994,7 +994,7 @@ PHP_FUNCTION(mssql_query) convert_to_string_ex(query); - if (dbcmd(mssql_ptr->link, (*query)->value.str.val)==FAIL) { + if (dbcmd(mssql_ptr->link, Z_STRVAL_PP(query))==FAIL) { php_error(E_WARNING,"MS SQL: Unable to set query"); RETURN_FALSE; } @@ -1063,12 +1063,12 @@ PHP_FUNCTION(mssql_free_result) WRONG_PARAM_COUNT; } - if ((*mssql_result_index)->type==IS_RESOURCE && (*mssql_result_index)->value.lval==0) { + if (Z_TYPE_PP(mssql_result_index)==IS_RESOURCE && Z_LVAL_PP(mssql_result_index)==0) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result); - zend_list_delete((*mssql_result_index)->value.lval); + zend_list_delete(Z_LVAL_PP(mssql_result_index)); RETURN_TRUE; } @@ -1096,8 +1096,8 @@ PHP_FUNCTION(mssql_num_rows) ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result); - return_value->value.lval = result->num_rows; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = result->num_rows; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1115,8 +1115,8 @@ PHP_FUNCTION(mssql_num_fields) ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result); - return_value->value.lval = result->num_fields; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = result->num_fields; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1141,7 +1141,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) RETURN_FALSE; } convert_to_long_ex(resulttype); - result_type = (*resulttype)->value.lval; + result_type = Z_LVAL_PP(resulttype); break; default: WRONG_PARAM_COUNT; @@ -1166,7 +1166,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) { if (PG(magic_quotes_runtime)) { - data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &result->data[result->cur_row][i].value.str.len, 1 TSRMLS_CC); + data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &result->data[result->Z_STRLEN(cur_row][i]), 1 TSRMLS_CC); should_copy = 0; } else @@ -1187,17 +1187,17 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) } else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) { if (result_type & MSSQL_NUM) - add_index_long(return_value, i, result->data[result->cur_row][i].value.lval); + add_index_long(return_value, i, result->data[result->Z_LVAL(cur_row][i])); if (result_type & MSSQL_ASSOC) - add_assoc_long(return_value, result->fields[i].name, result->data[result->cur_row][i].value.lval); + add_assoc_long(return_value, result->fields[i].name, result->data[result->Z_LVAL(cur_row][i])); } else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) { if (result_type & MSSQL_NUM) - add_index_double(return_value, i, result->data[result->cur_row][i].value.dval); + add_index_double(return_value, i, result->data[result->Z_DVAL(cur_row][i])); if (result_type & MSSQL_ASSOC) - add_assoc_double(return_value, result->fields[i].name, result->data[result->cur_row][i].value.dval); + add_assoc_double(return_value, result->fields[i].name, result->data[result->Z_DVAL(cur_row][i])); } } else @@ -1225,8 +1225,8 @@ PHP_FUNCTION(mssql_fetch_row) PHP_FUNCTION(mssql_fetch_object) { php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC); - if (return_value->type==IS_ARRAY) { - object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht); + if (Z_TYPE_P(return_value)==IS_ARRAY) { + object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value)); } } @@ -1256,12 +1256,12 @@ PHP_FUNCTION(mssql_data_seek) ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result); convert_to_long_ex(offset); - if ((*offset)->value.lval<0 || (*offset)->value.lval>=result->num_rows) { + if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=result->num_rows) { php_error(E_WARNING,"MS SQL: Bad row offset"); RETURN_FALSE; } - result->cur_row = (*offset)->value.lval; + result->cur_row = Z_LVAL_PP(offset); RETURN_TRUE; } @@ -1337,7 +1337,7 @@ PHP_FUNCTION(mssql_fetch_field) RETURN_FALSE; } convert_to_long_ex(offset); - field_offset = (*offset)->value.lval; + field_offset = Z_LVAL_PP(offset); break; default: WRONG_PARAM_COUNT; @@ -1365,7 +1365,7 @@ PHP_FUNCTION(mssql_fetch_field) add_property_long(return_value, "max_length",result->fields[field_offset].max_length); add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1); add_property_long(return_value, "numeric", result->fields[field_offset].numeric); - add_property_string(return_value, "type", php_mssql_get_field_name(result->fields[field_offset].type), 1); + add_property_string(return_value, "type", php_mssql_get_field_name(result->Z_TYPE(fields[field_offset])), 1); } /* }}} */ @@ -1390,7 +1390,7 @@ PHP_FUNCTION(mssql_field_length) RETURN_FALSE; } convert_to_long_ex(offset); - field_offset = (*offset)->value.lval; + field_offset = Z_LVAL_PP(offset); break; default: WRONG_PARAM_COUNT; @@ -1411,8 +1411,8 @@ PHP_FUNCTION(mssql_field_length) RETURN_FALSE; } - return_value->value.lval = result->fields[field_offset].max_length; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = result->fields[field_offset].max_length; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1437,7 +1437,7 @@ PHP_FUNCTION(mssql_field_name) RETURN_FALSE; } convert_to_long_ex(offset); - field_offset = (*offset)->value.lval; + field_offset = Z_LVAL_PP(offset); break; default: WRONG_PARAM_COUNT; @@ -1458,9 +1458,9 @@ PHP_FUNCTION(mssql_field_name) RETURN_FALSE; } - return_value->value.str.val = estrdup(result->fields[field_offset].name); - return_value->value.str.len = strlen(result->fields[field_offset].name); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrdup(result->fields[field_offset].name); + Z_STRLEN_P(return_value) = strlen(result->fields[field_offset].name); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -1485,7 +1485,7 @@ PHP_FUNCTION(mssql_field_type) RETURN_FALSE; } convert_to_long_ex(offset); - field_offset = (*offset)->value.lval; + field_offset = Z_LVAL_PP(offset); break; default: WRONG_PARAM_COUNT; @@ -1506,9 +1506,9 @@ PHP_FUNCTION(mssql_field_type) RETURN_FALSE; } - return_value->value.str.val = estrdup(php_mssql_get_field_name(result->fields[field_offset].type)); - return_value->value.str.len = strlen(php_mssql_get_field_name(result->fields[field_offset].type)); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrdup(php_mssql_get_field_name(result->Z_TYPE(fields[field_offset]))); + Z_STRLEN_P(return_value) = strlen(php_mssql_get_field_name(result->Z_TYPE(fields[field_offset]))); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -1528,7 +1528,7 @@ PHP_FUNCTION(mssql_field_seek) ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result); convert_to_long_ex(offset); - field_offset = (*offset)->value.lval; + field_offset = Z_LVAL_PP(offset); if (field_offset<0 || field_offset >= result->num_fields) { php_error(E_WARNING,"MS SQL: Bad column offset"); @@ -1556,30 +1556,30 @@ PHP_FUNCTION(mssql_result) ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result); convert_to_long_ex(row); - if ((*row)->value.lval < 0 || (*row)->value.lval >= result->num_rows) { - php_error(E_WARNING,"MS SQL: Bad row offset (%d)", (*row)->value.lval); + if (Z_LVAL_PP(row) < 0 || Z_LVAL_PP(row) >= result->num_rows) { + php_error(E_WARNING,"MS SQL: Bad row offset (%d)", Z_LVAL_PP(row)); RETURN_FALSE; } - switch((*field)->type) { + switch(Z_TYPE_PP(field)) { case IS_STRING: { int i; for (i=0; i<result->num_fields; i++) { - if (!strcasecmp(result->fields[i].name, (*field)->value.str.val)) { + if (!strcasecmp(result->fields[i].name, Z_STRVAL_PP(field))) { field_offset = i; break; } } if (i>=result->num_fields) { /* no match found */ - php_error(E_WARNING,"MS SQL: %s field not found in result", (*field)->value.str.val); + php_error(E_WARNING,"MS SQL: %s field not found in result", Z_STRVAL_PP(field)); RETURN_FALSE; } break; } default: convert_to_long_ex(field); - field_offset = (*field)->value.lval; + field_offset = Z_LVAL_PP(field); if (field_offset<0 || field_offset>=result->num_fields) { php_error(E_WARNING,"MS SQL: Bad column offset specified"); RETURN_FALSE; @@ -1587,7 +1587,7 @@ PHP_FUNCTION(mssql_result) break; } - *return_value = result->data[(*row)->value.lval][field_offset]; + *return_value = result->data[Z_LVAL_PP(row)][field_offset]; ZVAL_COPY_CTOR(return_value); } /* }}} */ @@ -1638,7 +1638,7 @@ PHP_FUNCTION(mssql_min_error_severity) WRONG_PARAM_COUNT; } convert_to_long_ex(severity); - MS_SQL_G(min_error_severity) = (*severity)->value.lval; + MS_SQL_G(min_error_severity) = Z_LVAL_PP(severity); } /* }}} */ @@ -1653,7 +1653,7 @@ PHP_FUNCTION(mssql_min_message_severity) WRONG_PARAM_COUNT; } convert_to_long_ex(severity); - MS_SQL_G(min_message_severity) = (*severity)->value.lval; + MS_SQL_G(min_message_severity) = Z_LVAL_PP(severity); } /* }}} */ @@ -1691,7 +1691,7 @@ PHP_FUNCTION(mssql_init) convert_to_string_ex(sp_name); - if (dbrpcinit(mssql_ptr->link, (*sp_name)->value.str.val,0)==FAIL) { + if (dbrpcinit(mssql_ptr->link, Z_STRVAL_PP(sp_name),0)==FAIL) { php_error(E_WARNING,"MS SQL: unable to init stored procedure"); RETURN_FALSE; } @@ -1737,7 +1737,7 @@ PHP_FUNCTION(mssql_bind) RETURN_FALSE; } convert_to_long_ex(yytype); - type=(*yytype)->value.lval; + type=Z_LVAL_PP(yytype); is_null=FALSE; is_output=FALSE; maxlen=-1; @@ -1752,9 +1752,9 @@ PHP_FUNCTION(mssql_bind) } convert_to_long_ex(yytype); convert_to_long_ex(yyis_output); - type=(*yytype)->value.lval; + type=Z_LVAL_PP(yytype); is_null=FALSE; - is_output=(*yyis_output)->value.lval; + is_output=Z_LVAL_PP(yyis_output); maxlen=-1; } break; @@ -1768,9 +1768,9 @@ PHP_FUNCTION(mssql_bind) convert_to_long_ex(yytype); convert_to_long_ex(yyis_output); convert_to_long_ex(yyis_null); - type=(*yytype)->value.lval; - is_output=(*yyis_output)->value.lval; - is_null=(*yyis_null)->value.lval; + type=Z_LVAL_PP(yytype); + is_output=Z_LVAL_PP(yyis_output); + is_null=Z_LVAL_PP(yyis_null); maxlen=-1; } break; @@ -1785,10 +1785,10 @@ PHP_FUNCTION(mssql_bind) convert_to_long_ex(yyis_output); convert_to_long_ex(yyis_null); convert_to_long_ex(yymaxlen); - type=(*yytype)->value.lval; - is_output=(*yyis_output)->value.lval; - is_null=(*yyis_null)->value.lval; - maxlen=(*yymaxlen)->value.lval; + type=Z_LVAL_PP(yytype); + is_output=Z_LVAL_PP(yyis_output); + is_null=Z_LVAL_PP(yyis_null); + maxlen=Z_LVAL_PP(yymaxlen); } break; @@ -1812,8 +1812,8 @@ PHP_FUNCTION(mssql_bind) } else { convert_to_string_ex(var); - datalen=(*var)->value.str.len; - value=(LPBYTE)(*var)->value.str.val; + datalen=Z_STRLEN_PP(var); + value=(LPBYTE)Z_STRVAL_PP(var); } } else { /* fixed-length type */ @@ -1829,14 +1829,14 @@ PHP_FUNCTION(mssql_bind) case SQLFLT8: convert_to_double_ex(var); - value=(LPBYTE)(&(*var)->value.dval); + value=(LPBYTE)(&Z_DVAL_PP(var)); break; case SQLINT1: case SQLINT2: case SQLINT4: convert_to_long_ex(var); - value=(LPBYTE)(&(*var)->value.lval); + value=(LPBYTE)(&Z_LVAL_PP(var)); break; default: @@ -1859,13 +1859,13 @@ PHP_FUNCTION(mssql_bind) } memset((void*)&bind,0,sizeof(mssql_bind)); - zend_hash_add(statement->binds,(*param_name)->value.str.val,(*param_name)->value.str.len,&bind,sizeof(mssql_bind),(void **)&bindp); + zend_hash_add(statement->binds,Z_STRVAL_PP(param_name),Z_STRLEN_PP(param_name),&bind,sizeof(mssql_bind),(void **)&bindp); bindp->zval=*var; zval_add_ref(var); /* no call to dbrpcparam if RETVAL */ - if ( strcmp("RETVAL",(*param_name)->value.str.val)!=0 ) { - if (dbrpcparam(mssql_ptr->link, (*param_name)->value.str.val, (BYTE)status, type, maxlen, datalen, (LPCBYTE)value)==FAIL) { + if ( strcmp("RETVAL",Z_STRVAL_PP(param_name))!=0 ) { + if (dbrpcparam(mssql_ptr->link, Z_STRVAL_PP(param_name), (BYTE)status, type, maxlen, datalen, (LPCBYTE)value)==FAIL) { php_error(E_WARNING,"MS SQL: Unable to set parameter"); RETURN_FALSE; } @@ -1967,20 +1967,20 @@ PHP_FUNCTION(mssql_execute) case SQLINT2: case SQLINT4: convert_to_long_ex(&bind->zval); - bind->zval->value.lval=*((int *)(dbretdata(mssql_ptr->link,i))); + bind->Z_LVAL_P(zval)=*((int *)(dbretdata(mssql_ptr->link,i))); break; case SQLFLT8: convert_to_double_ex(&bind->zval); - bind->zval->value.dval=*((double *)(dbretdata(mssql_ptr->link,i))); + bind->Z_DVAL_P(zval)=*((double *)(dbretdata(mssql_ptr->link,i))); break; case SQLCHAR: case SQLVARCHAR: case SQLTEXT: convert_to_string_ex(&bind->zval); - bind->zval->value.str.len=dbretlen(mssql_ptr->link,i); - bind->zval->value.str.val = estrndup(dbretdata(mssql_ptr->link,i),bind->zval->value.str.len); + bind->Z_STRLEN_P(zval)=dbretlen(mssql_ptr->link,i); + bind->Z_STRVAL_P(zval) = estrndup(dbretdata(mssql_ptr->link,i),bind->Z_STRLEN_P(zval)); break; } } @@ -1995,7 +1995,7 @@ PHP_FUNCTION(mssql_execute) if (zend_hash_find(statement->binds, "RETVAL", 6, (void**)&bind)==SUCCESS) { if (dbhasretstat(mssql_ptr->link)) { convert_to_long_ex(&bind->zval); - bind->zval->value.lval=dbretstatus(mssql_ptr->link); + bind->Z_LVAL_P(zval)=dbretstatus(mssql_ptr->link); } else { php_error(E_WARNING,"mssql_execute: stored procedure has no return value. Nothing was returned into RETVAL"); @@ -2035,7 +2035,7 @@ PHP_FUNCTION(mssql_guid_string) } convert_to_string_ex(binary); convert_to_long_ex(short_format); - sf = (*short_format)->value.lval; + sf = Z_LVAL_PP(short_format); break; default: @@ -2043,7 +2043,7 @@ PHP_FUNCTION(mssql_guid_string) break; } - dbconvert(NULL, SQLBINARY, (BYTE*)(*binary)->value.str.val, 16, SQLCHAR, buffer, -1); + dbconvert(NULL, SQLBINARY, (BYTE*)Z_STRVAL_PP(binary), 16, SQLCHAR, buffer, -1); if (sf) { php_strtoupper(buffer, 32); diff --git a/ext/muscat/muscat.c b/ext/muscat/muscat.c index 2b32633205..3e538d7145 100644 --- a/ext/muscat/muscat.c +++ b/ext/muscat/muscat.c @@ -210,7 +210,7 @@ PHP_FUNCTION(muscat_setup_net) WRONG_PARAM_COUNT; } - if ((*socket_arg)->type!=IS_RESOURCE) { + if (Z_TYPE_PP(socket_arg)!=IS_RESOURCE) { zend_error(E_ERROR,"First parameter must be a socket handle"); RETURN_FALSE; } @@ -324,7 +324,7 @@ PHP_FUNCTION(muscat_close) if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &muscat_handle_arg) == FAILURE){ WRONG_PARAM_COUNT; } - if ((*muscat_handle_arg)->type!=IS_RESOURCE) { + if (Z_TYPE_PP(muscat_handle_arg)!=IS_RESOURCE) { zend_error(E_ERROR,"First parameter must be a muscat handle"); RETURN_FALSE; } @@ -334,7 +334,7 @@ PHP_FUNCTION(muscat_close) _muscat_close(handle); // Let destructor take care of efree! - zend_list_delete((*muscat_handle_arg)->value.lval); + zend_list_delete(Z_LVAL_PP(muscat_handle_arg)); } /* }}} */ diff --git a/ext/muscat/muscat_net.c b/ext/muscat/muscat_net.c index 9e1621d6f9..a480d2414d 100644 --- a/ext/muscat/muscat_net.c +++ b/ext/muscat/muscat_net.c @@ -40,7 +40,7 @@ int _net_muscat_close(struct MuscatNet_handle *handle) { } int _net_muscat_give(struct MuscatNet_handle *handle, char* string) { - handle->muscat_response.type=' '; + handle->Z_TYPE(muscat_response)=' '; SOCK_WRITEL(string,strlen(string),handle->socketd); SOCK_WRITEL("\n",1,handle->socketd); } @@ -52,7 +52,7 @@ int _net_muscat_get(struct MuscatNet_handle * handle) { int clen; int rlen; - if (handle->muscat_response.type == 'P') return GIVING; + if (handle->Z_TYPE(muscat_response) == 'P') return GIVING; // we can use bcom ourselves!!! // read in the 6 byte header... @@ -66,7 +66,7 @@ int _net_muscat_get(struct MuscatNet_handle * handle) { return 1; // NEED TO RAISE ERROR HERE } handle->muscat_response.bcom[5]=0; - handle->muscat_response.type=handle->muscat_response.bcom[0]; + handle->Z_TYPE(muscat_response)=handle->muscat_response.bcom[0]; // now read bcom[1-4] and turn to an int clen=atoi(&(handle->muscat_response.bcom[1]))+1; @@ -83,7 +83,7 @@ int _net_muscat_get(struct MuscatNet_handle * handle) { } void _net_discard(struct MuscatNet_handle * handle) { - while(handle->muscat_response.type!='P') { + while(handle->Z_TYPE(muscat_response)!='P') { if (0!=_net_muscat_get(handle)) break; } } diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 2ae17886b1..9b44b4c958 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -316,7 +316,7 @@ ZEND_MODULE_STARTUP_D(mysql) le_result = zend_register_list_destructors_ex(_free_mysql_result, NULL, "mysql result", module_number); le_link = zend_register_list_destructors_ex(_close_mysql_link, NULL, "mysql link", module_number); le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number); - mysql_module_entry.type = type; + Z_TYPE(mysql_module_entry) = type; REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); @@ -438,7 +438,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MYSQL_DO_CONNECT_RETURN_FALSE(); } convert_to_string_ex(z_user); - user = (*z_user)->value.str.val; + user = Z_STRVAL_PP(z_user); } break; case 3: { @@ -447,8 +447,8 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } convert_to_string_ex(z_user); convert_to_string_ex(z_passwd); - user = (*z_user)->value.str.val; - passwd = (*z_passwd)->value.str.val; + user = Z_STRVAL_PP(z_user); + passwd = Z_STRVAL_PP(z_passwd); } break; default: @@ -541,7 +541,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } /* hash it up */ - new_le.type = le_plink; + Z_TYPE(new_le) = le_plink; new_le.ptr = mysql; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { free(mysql); @@ -551,7 +551,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MySG(num_persistent)++; MySG(num_links)++; } else { /* we do */ - if (le->type != le_plink) { + if (Z_TYPE_P(le) != le_plink) { MYSQL_DO_CONNECT_RETURN_FALSE(); } /* ensure that the link did not die */ @@ -590,16 +590,16 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) int type, link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { MYSQL_DO_CONNECT_RETURN_FALSE(); } link = (int) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - return_value->value.lval = link; + Z_LVAL_P(return_value) = link; php_mysql_set_default_link(link TSRMLS_CC); - return_value->type = IS_RESOURCE; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); MYSQL_DO_CONNECT_CLEANUP(); return; @@ -638,8 +638,8 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, mysql, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); @@ -648,7 +648,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } efree(hashed_details); - php_mysql_set_default_link(return_value->value.lval TSRMLS_CC); + php_mysql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); MYSQL_DO_CONNECT_CLEANUP(); } /* }}} */ @@ -752,7 +752,7 @@ PHP_FUNCTION(mysql_select_db) convert_to_string_ex(db); - if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) { + if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) { RETURN_FALSE; } else { RETURN_TRUE; @@ -896,7 +896,7 @@ PHP_FUNCTION(mysql_create_db) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); convert_to_string_ex(db); - if (mysql_create_db(&mysql->conn, (*db)->value.str.val)==0) { + if (mysql_create_db(&mysql->conn, Z_STRVAL_PP(db))==0) { RETURN_TRUE; } else { RETURN_FALSE; @@ -935,7 +935,7 @@ PHP_FUNCTION(mysql_drop_db) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); convert_to_string_ex(db); - if (mysql_drop_db(&mysql->conn, (*db)->value.str.val)==0) { + if (mysql_drop_db(&mysql->conn, Z_STRVAL_PP(db))==0) { RETURN_TRUE; } else { RETURN_FALSE; @@ -954,7 +954,7 @@ static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link if (db) { convert_to_string_ex(db); - if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) { + if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) { RETURN_FALSE; } } @@ -977,11 +977,11 @@ static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link convert_to_string_ex(query); /* mysql_query is binary unsafe, use mysql_real_query */ #if MYSQL_VERSION_ID > 32199 - if (mysql_real_query(&mysql->conn, (*query)->value.str.val, (*query)->value.str.len)!=0) { + if (mysql_real_query(&mysql->conn, Z_STRVAL_PP(query), Z_STRLEN_PP(query))!=0) { RETURN_FALSE; } #else - if (mysql_query(&mysql->conn, (*query)->value.str.val)!=0) { + if (mysql_query(&mysql->conn, Z_STRVAL_PP(query))!=0) { RETURN_FALSE; } #endif @@ -1152,7 +1152,7 @@ PHP_FUNCTION(mysql_list_tables) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); convert_to_string_ex(db); - if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) { + if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) { RETURN_FALSE; } if ((mysql_result=mysql_list_tables(&mysql->conn, NULL))==NULL) { @@ -1195,11 +1195,11 @@ PHP_FUNCTION(mysql_list_fields) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); convert_to_string_ex(db); - if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) { + if (mysql_select_db(&mysql->conn, Z_STRVAL_PP(db))!=0) { RETURN_FALSE; } convert_to_string_ex(table); - if ((mysql_result=mysql_list_fields(&mysql->conn, (*table)->value.str.val, NULL))==NULL) { + if ((mysql_result=mysql_list_fields(&mysql->conn, Z_STRVAL_PP(table), NULL))==NULL) { php_error(E_WARNING, "Unable to save MySQL query result"); RETURN_FALSE; } @@ -1311,8 +1311,8 @@ PHP_FUNCTION(mysql_affected_rows) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); /* conversion from int64 to long happing here */ - return_value->value.lval = (long) mysql_affected_rows(&mysql->conn); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = (long) mysql_affected_rows(&mysql->conn); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1333,7 +1333,7 @@ PHP_FUNCTION(mysql_escape_string) */ Z_STRVAL_P(return_value) = (char *) emalloc(Z_STRLEN_PP(str)*2+1); Z_STRLEN_P(return_value) = mysql_escape_string(Z_STRVAL_P(return_value), Z_STRVAL_PP(str), Z_STRLEN_PP(str)); - return_value->type = IS_STRING; + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -1365,8 +1365,8 @@ PHP_FUNCTION(mysql_insert_id) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); /* conversion from int64 to long happing here */ - return_value->value.lval = (long) mysql_insert_id(&mysql->conn); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = (long) mysql_insert_id(&mysql->conn); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1400,29 +1400,29 @@ PHP_FUNCTION(mysql_result) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); convert_to_long_ex(row); - if ((*row)->value.lval<0 || (*row)->value.lval>=(int)mysql_num_rows(mysql_result)) { - php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", (*row)->value.lval, (*result)->value.lval); + if (Z_LVAL_PP(row)<0 || Z_LVAL_PP(row)>=(int)mysql_num_rows(mysql_result)) { + php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", Z_LVAL_PP(row), Z_LVAL_PP(result)); RETURN_FALSE; } - mysql_data_seek(mysql_result, (*row)->value.lval); + mysql_data_seek(mysql_result, Z_LVAL_PP(row)); if ((sql_row=mysql_fetch_row(mysql_result))==NULL || (sql_row_lengths=mysql_fetch_lengths(mysql_result))==NULL) { /* shouldn't happen? */ RETURN_FALSE; } if (field) { - switch((*field)->type) { + switch(Z_TYPE_PP(field)) { case IS_STRING: { int i=0; MYSQL_FIELD *tmp_field; char *table_name, *field_name, *tmp; - if ((tmp=strchr((*field)->value.str.val, '.'))) { - table_name = estrndup((*field)->value.str.val, tmp-(*field)->value.str.val); + if ((tmp=strchr(Z_STRVAL_PP(field), '.'))) { + table_name = estrndup(Z_STRVAL_PP(field), tmp-Z_STRVAL_PP(field)); field_name = estrdup(tmp+1); } else { table_name = NULL; - field_name = estrndup((*field)->value.str.val,(*field)->value.str.len); + field_name = estrndup(Z_STRVAL_PP(field),Z_STRLEN_PP(field)); } mysql_field_seek(mysql_result, 0); while ((tmp_field=mysql_fetch_field(mysql_result))) { @@ -1434,7 +1434,7 @@ PHP_FUNCTION(mysql_result) } if (!tmp_field) { /* no match found */ php_error(E_WARNING, "%s%s%s not found in MySQL result index %d", - (table_name?table_name:""), (table_name?".":""), field_name, (*result)->value.lval); + (table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_PP(result)); efree(field_name); if (table_name) { efree(table_name); @@ -1449,7 +1449,7 @@ PHP_FUNCTION(mysql_result) break; default: convert_to_long_ex(field); - field_offset = (*field)->value.lval; + field_offset = Z_LVAL_PP(field); if (field_offset<0 || field_offset>=(int)mysql_num_fields(mysql_result)) { php_error(E_WARNING, "Bad column offset specified"); RETURN_FALSE; @@ -1459,16 +1459,16 @@ PHP_FUNCTION(mysql_result) } if (sql_row[field_offset]) { - return_value->type = IS_STRING; + Z_TYPE_P(return_value) = IS_STRING; if (PG(magic_quotes_runtime)) { - return_value->value.str.val = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&return_value->value.str.len, 0 TSRMLS_CC); + Z_STRVAL_P(return_value) = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&Z_STRLEN_P(return_value), 0 TSRMLS_CC); } else { - return_value->value.str.len = sql_row_lengths[field_offset]; - return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset], return_value->value.str.len); + Z_STRLEN_P(return_value) = sql_row_lengths[field_offset]; + Z_STRVAL_P(return_value) = (char *) safe_estrndup(sql_row[field_offset], Z_STRLEN_P(return_value)); } } else { - return_value->type = IS_NULL; + Z_TYPE_P(return_value) = IS_NULL; } } /* }}} */ @@ -1488,8 +1488,8 @@ PHP_FUNCTION(mysql_num_rows) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); /* conversion from int64 to long happing here */ - return_value->value.lval = (long)mysql_num_rows(mysql_result); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = (long)mysql_num_rows(mysql_result); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1506,8 +1506,8 @@ PHP_FUNCTION(mysql_num_fields) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); - return_value->value.lval = mysql_num_fields(mysql_result); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = mysql_num_fields(mysql_result); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1612,7 +1612,7 @@ PHP_FUNCTION(mysql_fetch_object) php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 2); if (Z_TYPE_P(return_value) == IS_ARRAY) { - object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht); + object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value)); } } /* }}} */ @@ -1649,11 +1649,11 @@ PHP_FUNCTION(mysql_data_seek) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); convert_to_long_ex(offset); - if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_rows(mysql_result)) { - php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval); + if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_rows(mysql_result)) { + php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d", Z_LVAL_PP(offset), Z_LVAL_PP(result)); RETURN_FALSE; } - mysql_data_seek(mysql_result, (*offset)->value.lval); + mysql_data_seek(mysql_result, Z_LVAL_PP(offset)); RETURN_TRUE; } /* }}} */ @@ -1773,11 +1773,11 @@ PHP_FUNCTION(mysql_fetch_field) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); if (field) { - if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) { + if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) { php_error(E_WARNING, "MySQL: Bad field offset"); RETURN_FALSE; } - mysql_field_seek(mysql_result, (*field)->value.lval); + mysql_field_seek(mysql_result, Z_LVAL_PP(field)); } if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) { RETURN_FALSE; @@ -1794,9 +1794,9 @@ PHP_FUNCTION(mysql_fetch_field) add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); add_property_long(return_value, "multiple_key",(mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); add_property_long(return_value, "unique_key",(mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); - add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); + add_property_long(return_value, "numeric", IS_NUM(Z_TYPE_P(mysql_field))?1:0); add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); - add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type), 1); + add_property_string(return_value, "type", php_mysql_get_field_name(Z_TYPE_P(mysql_field)), 1); add_property_long(return_value, "unsigned",(mysql_field->flags&UNSIGNED_FLAG?1:0)); add_property_long(return_value, "zerofill",(mysql_field->flags&ZEROFILL_FLAG?1:0)); } @@ -1817,11 +1817,11 @@ PHP_FUNCTION(mysql_field_seek) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); convert_to_long_ex(offset); - if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_fields(mysql_result)) { - php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval); + if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=(int)mysql_num_fields(mysql_result)) { + php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(offset), Z_LVAL_PP(result)); RETURN_FALSE; } - mysql_field_seek(mysql_result, (*offset)->value.lval); + mysql_field_seek(mysql_result, Z_LVAL_PP(offset)); RETURN_TRUE; } /* }}} */ @@ -1850,35 +1850,35 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); convert_to_long_ex(field); - if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) { - php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*field)->value.lval, (*result)->value.lval); + if (Z_LVAL_PP(field)<0 || Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) { + php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", Z_LVAL_PP(field), Z_LVAL_PP(result)); RETURN_FALSE; } - mysql_field_seek(mysql_result, (*field)->value.lval); + mysql_field_seek(mysql_result, Z_LVAL_PP(field)); if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) { RETURN_FALSE; } switch (entry_type) { case PHP_MYSQL_FIELD_NAME: - return_value->value.str.len = strlen(mysql_field->name); - return_value->value.str.val = estrndup(mysql_field->name, return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(mysql_field->name); + Z_STRVAL_P(return_value) = estrndup(mysql_field->name, Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case PHP_MYSQL_FIELD_TABLE: - return_value->value.str.len = strlen(mysql_field->table); - return_value->value.str.val = estrndup(mysql_field->table, return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(mysql_field->table); + Z_STRVAL_P(return_value) = estrndup(mysql_field->table, Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case PHP_MYSQL_FIELD_LEN: - return_value->value.lval = mysql_field->length; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = mysql_field->length; + Z_TYPE_P(return_value) = IS_LONG; break; case PHP_MYSQL_FIELD_TYPE: - return_value->value.str.val = php_mysql_get_field_name(mysql_field->type); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->value.str.val = estrndup(return_value->value.str.val, return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = php_mysql_get_field_name(Z_TYPE_P(mysql_field)); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_STRVAL_P(return_value) = estrndup(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case PHP_MYSQL_FIELD_FLAGS: strcpy(buf, ""); @@ -1944,9 +1944,9 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) len--; } - return_value->value.str.len = len; - return_value->value.str.val = estrndup(buf, len); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = len; + Z_STRVAL_P(return_value) = estrndup(buf, len); + Z_TYPE_P(return_value) = IS_STRING; break; default: @@ -2011,13 +2011,13 @@ PHP_FUNCTION(mysql_free_result) WRONG_PARAM_COUNT; } - if ((*result)->type==IS_RESOURCE && (*result)->value.lval==0) { + if (Z_TYPE_PP(result)==IS_RESOURCE && Z_LVAL_PP(result)==0) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); - zend_list_delete((*result)->value.lval); + zend_list_delete(Z_LVAL_PP(result)); RETURN_TRUE; } /* }}} */ diff --git a/ext/notes/php_notes.c b/ext/notes/php_notes.c index 6f5a9a98f7..8b0367aa8c 100644 --- a/ext/notes/php_notes.c +++ b/ext/notes/php_notes.c @@ -174,7 +174,7 @@ PHP_FUNCTION(notes_create_db) RETURN_FALSE; } - if (error = NSFDbCreate ((*db)->value.str.val, (USHORT) DBCLASS_NOTEFILE, FALSE)) { + if (error = NSFDbCreate (Z_STRVAL_PP(db), (USHORT) DBCLASS_NOTEFILE, FALSE)) { OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to create database: %s", error_string); NotesTerm(); @@ -217,7 +217,7 @@ PHP_FUNCTION(notes_drop_db) RETURN_FALSE; } - if (error = NSFDbDelete ((*db)->value.str.val)) { + if (error = NSFDbDelete (Z_STRVAL_PP(db))) { OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to delete database: %s", error_string); NotesTerm(); @@ -264,7 +264,7 @@ PHP_FUNCTION(notes_version) RETURN_FALSE; } - if (error = NSFDbOpen((*db)->value.str.val, &db_handle)) { + if (error = NSFDbOpen(Z_STRVAL_PP(db), &db_handle)) { OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); @@ -339,7 +339,7 @@ PHP_FUNCTION(notes_create_note) RETURN_FALSE; } - if (error = NSFDbOpen((*db)->value.str.val, &db_handle)) { + if (error = NSFDbOpen(Z_STRVAL_PP(db), &db_handle)) { OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); @@ -356,7 +356,7 @@ PHP_FUNCTION(notes_create_note) } /* Append the form name item to the new note */ - if (error = NSFItemSetText(note_handle, FIELD_FORM, (*form_name)->value.str.val, MAXWORD)) { + if (error = NSFItemSetText(note_handle, FIELD_FORM, Z_STRVAL_PP(form_name), MAXWORD)) { OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to use the form: %s", error_string); NSFNoteClose (note_handle); @@ -485,20 +485,20 @@ PHP_FUNCTION(notes_mark_read) ActionTable[curAction].AddFlag = FALSE; - ActionTable[curAction].NoteID = strtoul ((*note_id)->value.str.val, &pEnd, 16); + ActionTable[curAction].NoteID = strtoul (Z_STRVAL_PP(note_id), &pEnd, 16); - if (error = NSFDbOpen((*db)->value.str.val, &db_handle)) { + if (error = NSFDbOpen(Z_STRVAL_PP(db), &db_handle)) { OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); NotesTerm(); RETURN_FALSE; } - error = UpdateUnread (db_handle, (*user_name)->value.str.val, UserNameLen, + error = UpdateUnread (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable, ActionCount, &UndoID); if ((error == NOERROR) && UndoID) { - error = UndoUnreadStatus (db_handle, (*user_name)->value.str.val, UserNameLen, ActionTable, + error = UndoUnreadStatus (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable, ActionCount, UndoID); } @@ -567,7 +567,7 @@ PHP_FUNCTION(notes_mark_unread) curArg = 2; - UserNameLen = strlen ((*user_name)->value.str.val); + UserNameLen = strlen (Z_STRVAL_PP(user_name)); curAction = 0; ActionCount = 1; @@ -575,9 +575,9 @@ PHP_FUNCTION(notes_mark_unread) ActionTable[curAction].AddFlag = TRUE; ActionTable[curAction].NoteID = - strtoul ((*note_id)->value.str.val, &pEnd, 16); + strtoul (Z_STRVAL_PP(note_id), &pEnd, 16); - if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){ + if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); @@ -585,12 +585,12 @@ PHP_FUNCTION(notes_mark_unread) RETURN_FALSE; } - error = UpdateUnread (db_handle, (*user_name)->value.str.val, UserNameLen, + error = UpdateUnread (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable, ActionCount, &UndoID); if ( (error == NOERROR) && UndoID ){ - error = UndoUnreadStatus (db_handle, (*user_name)->value.str.val, UserNameLen, ActionTable, + error = UndoUnreadStatus (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable, ActionCount, UndoID); } @@ -888,7 +888,7 @@ PHP_FUNCTION(notes_unread) RETURN_FALSE; } - if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){ + if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); @@ -896,12 +896,12 @@ PHP_FUNCTION(notes_unread) RETURN_FALSE; } - UserNameLen = strlen((*user_name)->value.str.val); + UserNameLen = strlen(Z_STRVAL_PP(user_name)); /* Get the unread list */ if( error = NSFDbGetUnreadNoteTable ( db_handle, - (*user_name)->value.str.val, + Z_STRVAL_PP(user_name), UserNameLen, TRUE, /* Create the list if it's not already there */ &table_handle) ){ @@ -1020,8 +1020,8 @@ PHP_FUNCTION(notes_header_info) } OSPathNetConstruct( NULL, /* port name */ - (*server)->value.str.val, - (*mail_box)->value.str.val, + Z_STRVAL_PP(server), + Z_STRVAL_PP(mail_box), szMailFilePath); /* Open the message file. */ @@ -1053,10 +1053,10 @@ PHP_FUNCTION(notes_header_info) object_init(return_value); - if (error = MailOpenMessage (MessageList, (WORD)(*msg_number)->value.lval, &hMessage)){ + if (error = MailOpenMessage (MessageList, (WORD)Z_LVAL_PP(msg_number), &hMessage)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); - php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)(*msg_number)->value.lval, error_string); + php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)Z_LVAL_PP(msg_number), error_string); if (hMessageList != NULLHANDLE){ @@ -1073,7 +1073,7 @@ PHP_FUNCTION(notes_header_info) /* Get the originator's name/address. */ - if (error = MailGetMessageOriginator(MessageList, (WORD)(*msg_number)->value.lval, + if (error = MailGetMessageOriginator(MessageList, (WORD)Z_LVAL_PP(msg_number), Originator, sizeof(Originator), &OriginatorLength)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); @@ -1253,8 +1253,8 @@ PHP_FUNCTION(notes_body) } OSPathNetConstruct( NULL, /* port name */ - (*server)->value.str.val, - (*mail_box)->value.str.val, + Z_STRVAL_PP(server), + Z_STRVAL_PP(mail_box), szMailFilePath); /* Open the message file. */ @@ -1281,10 +1281,10 @@ PHP_FUNCTION(notes_body) RETURN_FALSE; } - if (error = MailOpenMessage (MessageList, (WORD)(*msg_number)->value.lval, &hMessage)){ + if (error = MailOpenMessage (MessageList, (WORD)Z_LVAL_PP(msg_number), &hMessage)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); - php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)(*msg_number)->value.lval, error_string); + php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)Z_LVAL_PP(msg_number), error_string); if (hMessageList != NULLHANDLE){ @@ -1447,7 +1447,7 @@ PHP_FUNCTION(notes_find_note) RETURN_FALSE; } - if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){ + if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); @@ -1455,35 +1455,35 @@ PHP_FUNCTION(notes_find_note) RETURN_FALSE; } - if( strcmp( (*type)->value.str.val, "FORM" ) == 0 ){ + if( strcmp( Z_STRVAL_PP(type), "FORM" ) == 0 ){ - if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_FORM, ¬e_id)) != ERR_NOT_FOUND) { + if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_FORM, ¬e_id)) != ERR_NOT_FOUND) { RETVAL_LONG( (long) note_id ); } - } else if( strcmp( (*type)->value.str.val, "VIEW" ) == 0 ){ + } else if( strcmp( Z_STRVAL_PP(type), "VIEW" ) == 0 ){ - if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_VIEW, ¬e_id)) != ERR_NOT_FOUND) { + if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_VIEW, ¬e_id)) != ERR_NOT_FOUND) { RETVAL_LONG( (long) note_id ); } - } else if( strcmp( (*type)->value.str.val, "FILTER" ) == 0 ){ + } else if( strcmp( Z_STRVAL_PP(type), "FILTER" ) == 0 ){ - if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_FILTER, ¬e_id)) != ERR_NOT_FOUND) { + if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_FILTER, ¬e_id)) != ERR_NOT_FOUND) { RETVAL_LONG( (long) note_id ); } - } else if( strcmp( (*type)->value.str.val, "FIELD" ) == 0 ){ + } else if( strcmp( Z_STRVAL_PP(type), "FIELD" ) == 0 ){ - if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_FIELD, ¬e_id)) != ERR_NOT_FOUND) { + if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_FIELD, ¬e_id)) != ERR_NOT_FOUND) { RETVAL_LONG( (long) note_id ); } } else{ - if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_ALL, ¬e_id)) != ERR_NOT_FOUND) { + if ((error = NIFFindDesignNote(db_handle, Z_STRVAL_PP(name), NOTE_CLASS_ALL, ¬e_id)) != ERR_NOT_FOUND) { RETVAL_LONG( (long) note_id ); } @@ -1548,7 +1548,7 @@ PHP_FUNCTION(notes_nav_create) RETURN_FALSE; } - if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){ + if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); @@ -1573,7 +1573,7 @@ PHP_FUNCTION(notes_nav_create) * Set the view name. */ error = NSFItemSetText( view_handle, VIEW_TITLE_ITEM, - (*name)->value.str.val, MAXWORD ); + Z_STRVAL_PP(name), MAXWORD ); if ( error ){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); @@ -1740,7 +1740,7 @@ PHP_FUNCTION(notes_search) RETURN_FALSE; } - if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){ + if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){ OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); php_error(E_WARNING,"Unable to open database: %s", error_string); @@ -1773,7 +1773,7 @@ PHP_FUNCTION(notes_search) allocated search handle */ (HCOLLECTION) NULLHANDLE, /* no collection specified - query all docs */ - (*keywords)->value.str.val, /* query string */ + Z_STRVAL_PP(keywords), /* query string */ FT_SEARCH_SCORES | /* find relevancy scores */ FT_SEARCH_STEM_WORDS, /* find word variants */ 0, /* maximum number of docs to @@ -1867,7 +1867,7 @@ PHP_FUNCTION(notes_search) allocated search handle */ (HCOLLECTION) NULLHANDLE, /* no collection specified - query all docs */ - (*keywords)->value.str.val, /* query string */ + Z_STRVAL_PP(keywords), /* query string */ FT_SEARCH_SCORES | /* find relevancy scores */ FT_SEARCH_REFINE, /* refine the search - use the * given id table */ @@ -1985,7 +1985,7 @@ PHP_FUNCTION(notes_copy_db) /* Open the input database. */ - if (error = NSFDbOpen ((*db_input)->value.str.val, &input_handle)){ + if (error = NSFDbOpen (Z_STRVAL_PP(db_input), &input_handle)){ NSFDbClose (input_handle); OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); @@ -1996,7 +1996,7 @@ PHP_FUNCTION(notes_copy_db) /* Create and open the output database. */ - if (error = NSFDbCreate ((*db_output)->value.str.val, DBCLASS_NOTEFILE, FALSE)) + if (error = NSFDbCreate (Z_STRVAL_PP(db_output), DBCLASS_NOTEFILE, FALSE)) { NSFDbClose (input_handle); OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); @@ -2005,7 +2005,7 @@ PHP_FUNCTION(notes_copy_db) RETURN_FALSE; } - if (error = NSFDbOpen ((*db_output)->value.str.val, &output_handle)) + if (error = NSFDbOpen (Z_STRVAL_PP(db_output), &output_handle)) { NSFDbClose (input_handle); OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); @@ -2129,7 +2129,7 @@ specified to indicate that we do not want any cutoff date. */ /* Add the database title to the database information buffer */ - NSFDbInfoModify (output_db_info, INFOPARSE_TITLE, (*title)->value.str.val); + NSFDbInfoModify (output_db_info, INFOPARSE_TITLE, Z_STRVAL_PP(title)); if (error = NSFDbInfoSet (output_handle, output_db_info)) { NSFDbClose (input_handle); @@ -2257,7 +2257,7 @@ PHP_FUNCTION(notes_list_msgs) RETURN_FALSE; } - if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){ + if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){ NSFDbClose (db_handle); OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string)); diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index ce3387db93..a871a6d281 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -688,9 +688,9 @@ _oci_bind_post_exec(void *data TSRMLS_DC) zval *val = bind->zval; zval_dtor(val); ZVAL_NULL(val); - } else if (bind->zval->type == IS_STRING && (bind->zval->value.str.val != empty_string)) { - bind->zval->value.str.val = erealloc(bind->zval->value.str.val, bind->zval->value.str.len+1); - bind->zval->value.str.val[ bind->zval->value.str.len ] = '\0'; + } else if (bind->Z_TYPE_P(zval) == IS_STRING && (bind->Z_STRVAL_P(zval) != empty_string)) { + bind->Z_STRVAL_P(zval) = erealloc(bind->Z_STRVAL_P(zval), bind->Z_STRLEN_P(zval)+1); + bind->Z_STRVAL_P(zval)[ bind->Z_STRLEN_P(zval) ] = '\0'; } @@ -847,7 +847,7 @@ _oci_coll_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) zend_list_delete(coll->conn->id); /* Note sure if we need to free the object. Have an oracle TAR out on this one. - OCIDescriptorFree(descr->ocidescr, descr->type); */ + OCIDescriptorFree(descr->ocidescr, Z_TYPE_P(descr)); */ oci_debug("END _oci_coll_list_dtor: %d",coll->id); @@ -869,7 +869,7 @@ _oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) CALL_OCI(OCIDescriptorFree( descr->ocidescr, - descr->type)); + Z_TYPE_P(descr))); oci_debug("END _oci_descriptor_list_dtor: %d",descr->id); @@ -1085,19 +1085,19 @@ oci_get_col(oci_statement *statement, int col, zval **value) } if (value) { - if ((*value)->type == IS_STRING) { + if (Z_TYPE_PP(value) == IS_STRING) { for (i = 0; i < statement->ncolumns; i++) { outcol = oci_get_col(statement, i + 1, 0); if (outcol == NULL) { continue; - } else if (((int) outcol->name_len == (*value)->value.str.len) - && (! strncmp(outcol->name,(*value)->value.str.val,(*value)->value.str.len))) { + } else if (((int) outcol->name_len == Z_STRLEN_PP(value)) + && (! strncmp(outcol->name,Z_STRVAL_PP(value),Z_STRLEN_PP(value)))) { return outcol; } } } else { convert_to_long_ex(value); - return oci_get_col(statement,(*value)->value.lval,0); + return oci_get_col(statement,Z_LVAL_PP(value),0); } } else if (col != -1) { if (zend_hash_index_find(statement->columns, col, (void **)&outcol) == FAILURE) { @@ -1121,23 +1121,23 @@ oci_new_desc(int type,oci_connection *connection) descr = emalloc(sizeof(oci_descriptor)); - descr->type = type; + Z_TYPE_P(descr) = type; - switch (descr->type) { + switch (Z_TYPE_P(descr)) { case OCI_DTYPE_FILE: case OCI_DTYPE_LOB: case OCI_DTYPE_ROWID: break; default: - php_error(E_WARNING, "Unknown descriptor type %d.",descr->type); + php_error(E_WARNING, "Unknown descriptor type %d.",Z_TYPE_P(descr)); return 0; } CALL_OCI_RETURN(OCI(error), OCIDescriptorAlloc( OCI(pEnv), (dvoid*)&(descr->ocidescr), - descr->type, + Z_TYPE_P(descr), (size_t) 0, (dvoid **) 0)); @@ -1170,12 +1170,12 @@ _oci_get_ocicoll(zval *id,oci_collection **collection TSRMLS_DC) php_error(E_WARNING, "cannot find collection"); return 0; } - if ((*collection = oci_get_coll((*coll)->value.lval TSRMLS_CC)) == NULL) { + if ((*collection = oci_get_coll(Z_LVAL_PP(coll) TSRMLS_CC)) == NULL) { php_error(E_WARNING, "collection not found"); return 0; } - return (*coll)->value.lval; + return Z_LVAL_PP(coll); } /* }}} */ @@ -1195,12 +1195,12 @@ _oci_get_ocidesc(zval *id,oci_descriptor **descriptor TSRMLS_DC) return 0; } - if ((*descriptor = oci_get_desc((*desc)->value.lval TSRMLS_CC)) == NULL) { + if ((*descriptor = oci_get_desc(Z_LVAL_PP(desc) TSRMLS_CC)) == NULL) { php_error(E_WARNING, "descriptor not found"); return 0; } - return (*desc)->value.lval; + return Z_LVAL_PP(desc); } /* }}} */ @@ -1815,7 +1815,7 @@ oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer,u *loblen = 0; - if (mydescr->type == OCI_DTYPE_FILE) { + if (Z_TYPE_P(mydescr) == OCI_DTYPE_FILE) { CALL_OCI_RETURN(connection->error, OCILobFileOpen( connection->pServiceContext, connection->pError, @@ -1875,7 +1875,7 @@ oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer,u return -1; } - if (mydescr->type == OCI_DTYPE_FILE) { + if (Z_TYPE_P(mydescr) == OCI_DTYPE_FILE) { CALL_OCI_RETURN(connection->error, OCILobFileClose( connection->pServiceContext, connection->pError, @@ -2006,8 +2006,8 @@ oci_bind_in_callback(dvoid *ictxp, /* context pointer */ /* "normal string bind */ convert_to_string(val); - *bufpp = val->value.str.val; - *alenp = val->value.str.len; + *bufpp = Z_STRVAL_P(val); + *alenp = Z_STRLEN_P(val); *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->pStmt != 0) { /* RSET */ @@ -2049,18 +2049,18 @@ oci_bind_out_callback(dvoid *octxp, /* context pointer */ return retval; } - if ((val->type == IS_OBJECT) || (val->type == IS_RESOURCE)) { + if ((Z_TYPE_P(val) == IS_OBJECT) || (Z_TYPE_P(val) == IS_RESOURCE)) { retval = OCI_CONTINUE; } else { convert_to_string(val); zval_dtor(val); - val->value.str.len = OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - val->value.str.val = emalloc(phpbind->zval->value.str.len); + Z_STRLEN_P(val) = OCI_PIECE_SIZE; /* 64K-1 is max XXX */ + Z_STRVAL_P(val) = emalloc(phpbind->Z_STRLEN_P(zval)); /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &phpbind->zval->value.str.len; - *bufpp = phpbind->zval->value.str.val; + *alenpp = (ub4*) &phpbind->Z_STRLEN_P(zval); + *bufpp = phpbind->Z_STRVAL_P(zval); *piecep = OCI_ONE_PIECE; *rcodepp = &phpbind->retcode; *indpp = &phpbind->indicator; @@ -2443,7 +2443,7 @@ static oci_server *_oci_open_server(char *dbname,int persistent) static int _oci_session_cleanup(void *data TSRMLS_DC) { list_entry *le = (list_entry *) data; - if (le->type == le_session) { + if (Z_TYPE_P(le) == le_session) { oci_server *server = ((oci_session*) le->ptr)->server; if (server->is_open == 2) return 1; @@ -2669,7 +2669,7 @@ PHP_FUNCTION(ocidefinebyname) switch (ac) { case 4: convert_to_long_ex(type); - ocitype = (ub2) (*type)->value.lval; + ocitype = (ub2) Z_LVAL_PP(type); /* possible breakthru */ } @@ -2685,8 +2685,8 @@ PHP_FUNCTION(ocidefinebyname) define = ecalloc(1,sizeof(oci_define)); if (zend_hash_add(statement->defines, - (*name)->value.str.val, - (*name)->value.str.len, + Z_STRVAL_PP(name), + Z_STRLEN_PP(name), define, sizeof(oci_define), (void **)&tmp_define) == SUCCESS) { @@ -2697,9 +2697,9 @@ PHP_FUNCTION(ocidefinebyname) RETURN_FALSE; } - define->name = (text*) estrndup((*name)->value.str.val,(*name)->value.str.len); - define->name_len = (*name)->value.str.len; - define->type = ocitype; + define->name = (text*) estrndup(Z_STRVAL_PP(name),Z_STRLEN_PP(name)); + define->name_len = Z_STRLEN_PP(name); + Z_TYPE_P(define) = ocitype; define->zval = *var; zval_add_ref(var); @@ -2738,11 +2738,11 @@ PHP_FUNCTION(ocibindbyname) switch (ac) { case 5: convert_to_long_ex(type); - ocitype = (ub2) (*type)->value.lval; + ocitype = (ub2) Z_LVAL_PP(type); /* possible breakthru */ case 4: convert_to_long_ex(maxlen); - value_sz = (*maxlen)->value.lval; + value_sz = Z_LVAL_PP(maxlen); /* possible breakthru */ } @@ -2751,7 +2751,7 @@ PHP_FUNCTION(ocibindbyname) switch (ocitype) { #ifdef WITH_COLLECTIONS case SQLT_NTY: - if((*var)->type != IS_OBJECT) { + if(Z_TYPE_PP(var) != IS_OBJECT) { php_error(E_WARNING,"Variable must be allocated using OCINewCollection()"); RETURN_FALSE; } @@ -2772,7 +2772,7 @@ PHP_FUNCTION(ocibindbyname) case SQLT_CLOB: case SQLT_BLOB: case SQLT_RDD: - if ((*var)->type != IS_OBJECT) { + if (Z_TYPE_PP(var) != IS_OBJECT) { php_error(E_WARNING,"Variable must be allocated using OCINewDescriptor()"); RETURN_FALSE; } @@ -2801,7 +2801,7 @@ PHP_FUNCTION(ocibindbyname) if ((ocitype == SQLT_CHR) && (value_sz == -1)) { convert_to_string_ex(var); - value_sz = (*var)->value.str.len; + value_sz = Z_STRLEN_PP(var); } if (value_sz == 0) { @@ -2827,8 +2827,8 @@ PHP_FUNCTION(ocibindbyname) statement->pStmt, /* statement handle */ (OCIBind **)&bindp->pBind, /* bind hdl (will alloc) */ statement->pError, /* error handle */ - (text*) (*name)->value.str.val, /* placeholder name */ - (*name)->value.str.len, /* placeholder length */ + (text*) Z_STRVAL_PP(name), /* placeholder name */ + Z_STRLEN_PP(name), /* placeholder length */ (dvoid *)0, /* in/out data */ value_sz, /* OCI_MAX_DATA_SIZE, */ /* max size of input/output data */ (ub2)ocitype, /* in/out data type */ @@ -2940,7 +2940,7 @@ PHP_FUNCTION(ocisavelob) offset = 0; if (zend_get_parameters_ex(2, &arg, &oarg) == SUCCESS) { convert_to_long_ex(oarg); - offparam = (*oarg)->value.lval; + offparam = Z_LVAL_PP(oarg); CALL_OCI_RETURN(connection->error, OCILobGetLength( connection->pServiceContext, @@ -2964,7 +2964,7 @@ PHP_FUNCTION(ocisavelob) offset++; convert_to_string_ex(arg); - loblen = (*arg)->value.str.len; + loblen = Z_STRLEN_PP(arg); if (loblen < 1) { php_error(E_WARNING, "Cannot save a lob wich size is less than 1 byte"); @@ -2977,7 +2977,7 @@ PHP_FUNCTION(ocisavelob) mylob, &loblen, (ub4) offset, - (dvoid *) (*arg)->value.str.val, + (dvoid *) Z_STRVAL_PP(arg), (ub4) loblen, OCI_ONE_PIECE, (dvoid *)0, @@ -3035,11 +3035,11 @@ PHP_FUNCTION(ocisavelobfile) convert_to_string_ex(arg); - if (php_check_open_basedir((*arg)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(arg) TSRMLS_CC)) { RETURN_FALSE; } - filename = (*arg)->value.str.val; + filename = Z_STRVAL_PP(arg); if ((fp = VCWD_OPEN(filename, O_RDONLY|O_BINARY)) == -1) { php_error(E_WARNING, "Can't open file %s", filename); @@ -3145,13 +3145,13 @@ PHP_FUNCTION(ociwritelobtofile) switch (ac) { case 3: convert_to_long_ex(zlength); - length = (*zlength)->value.lval; + length = Z_LVAL_PP(zlength); case 2: convert_to_long_ex(zstart); - start = (*zstart)->value.lval; + start = Z_LVAL_PP(zstart); case 1: convert_to_string_ex(zfilename); - filename = (*zfilename)->value.str.val; + filename = Z_STRVAL_PP(zfilename); } if (filename && *filename) { @@ -3177,7 +3177,7 @@ PHP_FUNCTION(ociwritelobtofile) goto bail; } - if (descr->type == OCI_DTYPE_FILE) { + if (Z_TYPE_P(descr) == OCI_DTYPE_FILE) { CALL_OCI_RETURN(connection->error, OCILobFileOpen( connection->pServiceContext, connection->pError, @@ -3264,7 +3264,7 @@ PHP_FUNCTION(ociwritelobtofile) fp = 0; } - if (descr->type == OCI_DTYPE_FILE) { + if (Z_TYPE_P(descr) == OCI_DTYPE_FILE) { CALL_OCI_RETURN(connection->error,OCILobFileClose( connection->pServiceContext, connection->pError, @@ -3358,7 +3358,7 @@ PHP_FUNCTION(ociwritetemporarylob) } convert_to_string_ex(var); - loblen = (*var)->value.str.len; + loblen = Z_STRLEN_PP(var); if (loblen < 1) { php_error(E_WARNING, "Cannot save a lob that is less than 1 byte"); @@ -3371,7 +3371,7 @@ PHP_FUNCTION(ociwritetemporarylob) mylob, (ub4 *) &loblen, (ub4) offset, - (dvoid *) (*var)->value.str.val, + (dvoid *) Z_STRVAL_PP(var), (ub4) loblen, OCI_ONE_PIECE, (dvoid *)0, @@ -3472,7 +3472,7 @@ PHP_FUNCTION(ocinewdescriptor) if (zend_get_parameters_ex(2, &conn, &type) == SUCCESS) { convert_to_long_ex(type); - dtype = (*type)->value.lval; + dtype = Z_LVAL_PP(type); } else if (zend_get_parameters_ex(1, &conn) == FAILURE) { WRONG_PARAM_COUNT; } @@ -3785,7 +3785,7 @@ PHP_FUNCTION(ociinternaldebug) WRONG_PARAM_COUNT; } convert_to_long_ex(arg); - OCI(debug_mode) = (*arg)->value.lval; + OCI(debug_mode) = Z_LVAL_PP(arg); } @@ -3802,7 +3802,7 @@ PHP_FUNCTION(ociexecute) if (zend_get_parameters_ex(2, &stmt, &mode) == SUCCESS) { convert_to_long_ex(mode); - execmode = (*mode)->value.lval; + execmode = Z_LVAL_PP(mode); } else if (zend_get_parameters_ex(1, &stmt) == SUCCESS) { execmode = OCI_COMMIT_ON_SUCCESS; } else { @@ -3887,7 +3887,7 @@ PHP_FUNCTION(ocifetchinto) switch (ac) { case 3: convert_to_long_ex(fmode); - mode = (*fmode)->value.lval; + mode = Z_LVAL_PP(fmode); /* possible breakthru */ } @@ -3918,7 +3918,7 @@ PHP_FUNCTION(ocifetchinto) _oci_make_zval(element,statement,column,"OCIFetchInto",mode TSRMLS_CC); if ((mode & OCI_NUM) || (! (mode & OCI_ASSOC))) { - zend_hash_index_update((*array)->value.ht,i,(void *)&element,sizeof(zval*),NULL); + zend_hash_index_update(Z_ARRVAL_PP(array),i,(void *)&element,sizeof(zval*),NULL); used=1; } @@ -3926,7 +3926,7 @@ PHP_FUNCTION(ocifetchinto) if (used) { element->refcount++; } - zend_hash_update((*array)->value.ht,column->name,column->name_len+1,(void *)&element,sizeof(zval*),NULL); + zend_hash_update(Z_ARRVAL_PP(array),column->name,column->name_len+1,(void *)&element,sizeof(zval*),NULL); } } @@ -3958,7 +3958,7 @@ PHP_FUNCTION(ocifetchstatement) switch (ac) { case 3: convert_to_long_ex(fmode); - mode = (*fmode)->value.lval; + mode = Z_LVAL_PP(fmode); /* possible breakthru */ } @@ -3978,7 +3978,7 @@ PHP_FUNCTION(ocifetchstatement) namebuf = estrndup(columns[ i ]->name,columns[ i ]->name_len); - zend_hash_update((*array)->value.ht, namebuf, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); + zend_hash_update(Z_ARRVAL_PP(array), namebuf, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); efree(namebuf); } @@ -4196,7 +4196,7 @@ PHP_FUNCTION(ociparse) convert_to_string_ex(query); - statement = oci_parse(connection,(*query)->value.str.val,(*query)->value.str.len); + statement = oci_parse(connection,Z_STRVAL_PP(query),Z_STRLEN_PP(query)); if (statement) { RETURN_RESOURCE(statement->id); @@ -4223,7 +4223,7 @@ PHP_FUNCTION(ocisetprefetch) OCI_GET_STMT(statement,stmt); - oci_setprefetch(statement,(*size)->value.lval); + oci_setprefetch(statement,Z_LVAL_PP(size)); RETURN_TRUE; } @@ -4499,7 +4499,7 @@ PHP_FUNCTION(ocicollappend) * a value passed in is a 0 length string, consider it a null */ convert_to_string_ex(arg); - if((*arg)->value.str.len == 0) { + if(Z_STRLEN_PP(arg) == 0) { CALL_OCI_RETURN(connection->error, OCICollAppend( OCI(pEnv), connection->pError, @@ -4520,8 +4520,8 @@ PHP_FUNCTION(ocicollappend) CALL_OCI_RETURN(connection->error, OCIDateFromText( connection->pError, - (*arg)->value.str.val, - (*arg)->value.str.len, + Z_STRVAL_PP(arg), + Z_STRLEN_PP(arg), 0, 0, 0, @@ -4552,8 +4552,8 @@ PHP_FUNCTION(ocicollappend) CALL_OCI_RETURN(connection->error, OCIStringAssignText( OCI(pEnv), connection->pError, - (*arg)->value.str.val, - (*arg)->value.str.len, + Z_STRVAL_PP(arg), + Z_STRLEN_PP(arg), &ocistr)); if (connection->error) { @@ -4586,7 +4586,7 @@ PHP_FUNCTION(ocicollappend) case OCI_TYPECODE_NUMBER : /* NUMBER */ case OCI_TYPECODE_SMALLINT : /* SMALLINT */ convert_to_double_ex(arg); - ndx = (double)(*arg)->value.dval; + ndx = (double)Z_DVAL_PP(arg); CALL_OCI_RETURN(connection->error, OCINumberFromReal( connection->pError, @@ -4642,7 +4642,7 @@ PHP_FUNCTION(ocicollgetelem) } convert_to_long_ex(arg); - ndx = (*arg)->value.lval; + ndx = Z_LVAL_PP(arg); connection = coll->conn; @@ -4789,7 +4789,7 @@ PHP_FUNCTION(ocicollassignelem) } convert_to_long_ex(index); - ndx = (*index)->value.lval; + ndx = Z_LVAL_PP(index); connection = coll->conn; @@ -4804,7 +4804,7 @@ PHP_FUNCTION(ocicollassignelem) */ convert_to_string_ex(val); - if((*val)->value.str.len == 0) { + if(Z_STRLEN_PP(val) == 0) { CALL_OCI_RETURN(connection->error, OCICollAssignElem( OCI(pEnv), connection->pError, @@ -4825,8 +4825,8 @@ PHP_FUNCTION(ocicollassignelem) convert_to_string_ex(val); CALL_OCI_RETURN(connection->error, OCIDateFromText( connection->pError, - (*val)->value.str.val, - (*val)->value.str.len, + Z_STRVAL_PP(val), + Z_STRLEN_PP(val), 0, 0, 0, @@ -4857,8 +4857,8 @@ PHP_FUNCTION(ocicollassignelem) CALL_OCI_RETURN(connection->error, OCIStringAssignText( OCI(pEnv), connection->pError, - (*val)->value.str.val, - (*val)->value.str.len, + Z_STRVAL_PP(val), + Z_STRLEN_PP(val), &ocistr)); if (connection->error) { @@ -4892,7 +4892,7 @@ PHP_FUNCTION(ocicollassignelem) case OCI_TYPECODE_NUMBER : /* NUMBER */ case OCI_TYPECODE_SMALLINT : /* SMALLINT */ convert_to_double_ex(val); - dnum = (double)(*val)->value.dval; + dnum = (double)Z_DVAL_PP(val); CALL_OCI_RETURN(connection->error, OCINumberFromReal( connection->pError, @@ -5002,7 +5002,7 @@ PHP_FUNCTION(ocicolltrim) CALL_OCI_RETURN(coll->conn->error, OCICollTrim( OCI(pEnv), coll->conn->pError, - (*arg)->value.lval, + Z_LVAL_PP(arg), coll->coll)); if (coll->conn->error) { @@ -5050,10 +5050,10 @@ PHP_FUNCTION(ocinewcollection) OCI(pEnv), connection->pError, connection->pServiceContext, - ac==3?(text *)(*schema)->value.str.val:(text *)0, - ac==3?(ub4)(*schema)->value.str.len: (ub4)0, - (text *) (*tdo)->value.str.val, - (ub4) (*tdo)->value.str.len, + ac==3?(text *)Z_STRVAL_PP(schema):(text *)0, + ac==3?(ub4)Z_STRLEN_PP(schema): (ub4)0, + (text *) Z_STRVAL_PP(tdo), + (ub4) Z_STRLEN_PP(tdo), (CONST text *) 0, (ub4) 0, OCI_DURATION_SESSION, diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 1d68dc7516..7a5ff39c9a 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -372,7 +372,7 @@ PHP_MINIT_FUNCTION(odbc) le_result = zend_register_list_destructors_ex(_free_odbc_result, NULL, "odbc result", module_number); le_conn = zend_register_list_destructors_ex(_close_odbc_conn, NULL, "odbc link", module_number); le_pconn = zend_register_list_destructors_ex(NULL, _close_odbc_pconn, "odbc link persistent", module_number); - odbc_module_entry.type = type; + Z_TYPE(odbc_module_entry) = type; REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); @@ -549,17 +549,17 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) convert_to_long_ex(pv_flag); - if ((*pv_res)->value.lval) { + if (Z_LVAL_PP(pv_res)) { ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); if (mode) - result->longreadlen = (*pv_flag)->value.lval; + result->longreadlen = Z_LVAL_PP(pv_flag); else - result->binmode = (*pv_flag)->value.lval; + result->binmode = Z_LVAL_PP(pv_flag); } else { if (mode) - ODBCG(defaultlrl) = (*pv_flag)->value.lval; + ODBCG(defaultlrl) = Z_LVAL_PP(pv_flag); else - ODBCG(defaultbinmode) = (*pv_flag)->value.lval; + ODBCG(defaultbinmode) = Z_LVAL_PP(pv_flag); } RETURN_TRUE; } @@ -649,7 +649,7 @@ void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type) static int _close_pconn_with_id(list_entry *le, int *id TSRMLS_DC) { - if(le->type == le_pconn && (((odbc_connection *)(le->ptr))->id == *id)){ + if(Z_TYPE_P(le) == le_pconn && (((odbc_connection *)(le->ptr))->id == *id)){ return 1; }else{ return 0; @@ -685,17 +685,17 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) RETURN_FALSE; } - if ((*pv_num)->value.lval > result->numcols) { + if (Z_LVAL_PP(pv_num) > result->numcols) { php_error(E_WARNING, "Field index larger than number of fields"); RETURN_FALSE; } - if ((*pv_num)->value.lval < 1) { + if (Z_LVAL_PP(pv_num) < 1) { php_error(E_WARNING, "Field numbering starts at 1"); RETURN_FALSE; } - SQLColAttributes(result->stmt, (UWORD)(*pv_num)->value.lval, + SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num), (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len); @@ -783,7 +783,7 @@ PHP_FUNCTION(odbc_prepare) ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); convert_to_string_ex(pv_query); - query = (*pv_query)->value.str.val; + query = Z_STRVAL_PP(pv_query); result = (odbc_result *)emalloc(sizeof(odbc_result)); if (result == NULL) { @@ -889,7 +889,7 @@ PHP_FUNCTION(odbc_execute) case 2: if (zend_get_parameters_ex(2, &pv_res, &pv_param_arr) == FAILURE) WRONG_PARAM_COUNT; - if ((*pv_param_arr)->type != IS_ARRAY) { + if (Z_TYPE_PP(pv_param_arr) != IS_ARRAY) { php_error(E_WARNING, "No array passed to odbc_execute()"); return; } @@ -907,24 +907,24 @@ PHP_FUNCTION(odbc_execute) } if (result->numparams > 0) { - if ((ne = zend_hash_num_elements((*pv_param_arr)->value.ht)) < result->numparams) { + if ((ne = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr))) < result->numparams) { php_error(E_WARNING,"Not enough parameters (%d should be %d) given", ne, result->numparams); RETURN_FALSE; } - zend_hash_internal_pointer_reset((*pv_param_arr)->value.ht); + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(pv_param_arr)); params = (params_t *)emalloc(sizeof(params_t) * result->numparams); for(i = 1; i <= result->numparams; i++) { - if (zend_hash_get_current_data((*pv_param_arr)->value.ht, (void **) &tmp) == FAILURE) { + if (zend_hash_get_current_data(Z_ARRVAL_PP(pv_param_arr), (void **) &tmp) == FAILURE) { php_error(E_WARNING,"Error getting parameter"); SQLFreeStmt(result->stmt,SQL_RESET_PARAMS); efree(params); RETURN_FALSE; } convert_to_string(*tmp); - if ((*tmp)->type != IS_STRING) { + if (Z_TYPE_PP(tmp) != IS_STRING) { php_error(E_WARNING,"Error converting parameter"); SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); efree(params); @@ -933,7 +933,7 @@ PHP_FUNCTION(odbc_execute) SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision, &scale, &nullable); - params[i-1].vallen = (*tmp)->value.str.len; + params[i-1].vallen = Z_STRLEN_PP(tmp); params[i-1].fp = -1; if (IS_SQL_BINARY(sqltype)) @@ -941,10 +941,10 @@ PHP_FUNCTION(odbc_execute) else ctype = SQL_C_CHAR; - if ((*tmp)->value.str.val[0] == '\'' && - (*tmp)->value.str.val[(*tmp)->value.str.len - 1] == '\'') { - filename = &(*tmp)->value.str.val[1]; - filename[(*tmp)->value.str.len - 2] = '\0'; + if (Z_STRVAL_PP(tmp)[0] == '\'' && + Z_STRVAL_PP(tmp)[Z_STRLEN_PP(tmp) - 1] == '\'') { + filename = &Z_STRVAL_PP(tmp)[1]; + filename[Z_STRLEN_PP(tmp) - 2] = '\0'; if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) { php_error(E_WARNING,"Can't open file %s", filename); @@ -970,10 +970,10 @@ PHP_FUNCTION(odbc_execute) #endif rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT, ctype, sqltype, precision, scale, - (*tmp)->value.str.val, 0, + Z_STRVAL_PP(tmp), 0, ¶ms[i-1].vallen); } - zend_hash_move_forward((*pv_param_arr)->value.ht); + zend_hash_move_forward(Z_ARRVAL_PP(pv_param_arr)); } } /* Close cursor, needed for doing multiple selects */ @@ -1126,7 +1126,7 @@ PHP_FUNCTION(odbc_exec) ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); convert_to_string_ex(pv_query); - query = (*pv_query)->value.str.val; + query = Z_STRVAL_PP(pv_query); result = (odbc_result *)emalloc(sizeof(odbc_result)); if (result == NULL) { @@ -1228,7 +1228,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(pv_row); - rownum = (*pv_row)->value.lval; + rownum = Z_LVAL_PP(pv_row); break; default: WRONG_PARAM_COUNT; @@ -1276,8 +1276,8 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) for(i = 0; i < result->numcols; i++) { ALLOC_ZVAL(tmp); tmp->refcount = 1; - tmp->type = IS_STRING; - tmp->value.str.len = 0; + Z_TYPE_P(tmp) = IS_STRING; + Z_STRLEN_P(tmp) = 0; sql_c_type = SQL_C_CHAR; switch(result->values[i].coltype) { @@ -1285,14 +1285,14 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) case SQL_VARBINARY: case SQL_LONGVARBINARY: if (result->binmode <= 0) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } if (result->binmode == 1) sql_c_type = SQL_C_BINARY; case SQL_LONGVARCHAR: if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } @@ -1306,29 +1306,29 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) RETURN_FALSE; } if (rc == SQL_SUCCESS_WITH_INFO) { - tmp->value.str.len = result->longreadlen; + Z_STRLEN_P(tmp) = result->longreadlen; } else if (result->values[i].vallen == SQL_NULL_DATA) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } else { - tmp->value.str.len = result->values[i].vallen; + Z_STRLEN_P(tmp) = result->values[i].vallen; } - tmp->value.str.val = estrndup(buf, tmp->value.str.len); + Z_STRVAL_P(tmp) = estrndup(buf, Z_STRLEN_P(tmp)); break; default: if (result->values[i].vallen == SQL_NULL_DATA) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } - tmp->value.str.len = result->values[i].vallen; - tmp->value.str.val = estrndup(result->values[i].value,tmp->value.str.len); + Z_STRLEN_P(tmp) = result->values[i].vallen; + Z_STRVAL_P(tmp) = estrndup(result->values[i].value,Z_STRLEN_P(tmp)); break; } if (result_type & ODBC_NUM) { - zend_hash_index_update(return_value->value.ht, i, &tmp, sizeof(pval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(return_value), i, &tmp, sizeof(pval *), NULL); } else { - zend_hash_update(return_value->value.ht, result->values[i].name, strlen(result->values[i].name)+1, &tmp, sizeof(pval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].name)+1, &tmp, sizeof(pval *), NULL); } } if (buf) efree(buf); @@ -1341,7 +1341,7 @@ PHP_FUNCTION(odbc_fetch_object) { php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, ODBC_OBJECT); if (Z_TYPE_P(return_value) == IS_ARRAY) { - object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht); + object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value)); } } /* }}} */ @@ -1382,7 +1382,7 @@ PHP_FUNCTION(odbc_fetch_into) WRONG_PARAM_COUNT; SEPARATE_ZVAL(pv_row); convert_to_long_ex(pv_row); - rownum = (*pv_row)->value.lval; + rownum = Z_LVAL_PP(pv_row); break; default: WRONG_PARAM_COUNT; @@ -1405,7 +1405,7 @@ PHP_FUNCTION(odbc_fetch_into) RETURN_FALSE; } - if ((*pv_res_arr)->type != IS_ARRAY) { + if (Z_TYPE_PP(pv_res_arr) != IS_ARRAY) { if (array_init(*pv_res_arr) == FAILURE) { php_error(E_WARNING, "Can't convert to type Array"); RETURN_FALSE; @@ -1435,8 +1435,8 @@ PHP_FUNCTION(odbc_fetch_into) for(i = 0; i < result->numcols; i++) { ALLOC_ZVAL(tmp); tmp->refcount = 1; - tmp->type = IS_STRING; - tmp->value.str.len = 0; + Z_TYPE_P(tmp) = IS_STRING; + Z_STRLEN_P(tmp) = 0; sql_c_type = SQL_C_CHAR; switch(result->values[i].coltype) { @@ -1444,14 +1444,14 @@ PHP_FUNCTION(odbc_fetch_into) case SQL_VARBINARY: case SQL_LONGVARBINARY: if (result->binmode <= 0) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } if (result->binmode == 1) sql_c_type = SQL_C_BINARY; case SQL_LONGVARCHAR: if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } @@ -1465,26 +1465,26 @@ PHP_FUNCTION(odbc_fetch_into) RETURN_FALSE; } if (rc == SQL_SUCCESS_WITH_INFO) { - tmp->value.str.len = result->longreadlen; + Z_STRLEN_P(tmp) = result->longreadlen; } else if (result->values[i].vallen == SQL_NULL_DATA) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } else { - tmp->value.str.len = result->values[i].vallen; + Z_STRLEN_P(tmp) = result->values[i].vallen; } - tmp->value.str.val = estrndup(buf, tmp->value.str.len); + Z_STRVAL_P(tmp) = estrndup(buf, Z_STRLEN_P(tmp)); break; default: if (result->values[i].vallen == SQL_NULL_DATA) { - tmp->value.str.val = empty_string; + Z_STRVAL_P(tmp) = empty_string; break; } - tmp->value.str.len = result->values[i].vallen; - tmp->value.str.val = estrndup(result->values[i].value,tmp->value.str.len); + Z_STRLEN_P(tmp) = result->values[i].vallen; + Z_STRVAL_P(tmp) = estrndup(result->values[i].value,Z_STRLEN_P(tmp)); break; } - zend_hash_index_update((*pv_res_arr)->value.ht, i, &tmp, sizeof(pval *), NULL); + zend_hash_index_update(Z_ARRVAL_PP(pv_res_arr), i, &tmp, sizeof(pval *), NULL); } if (buf) efree(buf); RETURN_LONG(result->numcols); @@ -1540,7 +1540,7 @@ PHP_FUNCTION(odbc_fetch_row) if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(pv_row); - rownum = (*pv_row)->value.lval; + rownum = Z_LVAL_PP(pv_row); } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); @@ -1598,11 +1598,11 @@ PHP_FUNCTION(odbc_result) WRONG_PARAM_COUNT; } - if ((*pv_field)->type == IS_STRING) { - field = (*pv_field)->value.str.val; + if (Z_TYPE_PP(pv_field) == IS_STRING) { + field = Z_STRVAL_PP(pv_field); } else { convert_to_long_ex(pv_field); - field_ind = (*pv_field)->value.lval - 1; + field_ind = Z_LVAL_PP(pv_field) - 1; } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); @@ -1792,7 +1792,7 @@ PHP_FUNCTION(odbc_result_all) php_printf("<table><tr>"); } else { convert_to_string_ex(pv_format); - php_printf("<table %s ><tr>",(*pv_format)->value.str.val); + php_printf("<table %s ><tr>",Z_STRVAL_PP(pv_format)); } for(i = 0; i < result->numcols; i++) @@ -2029,7 +2029,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) WRONG_PARAM_COUNT; } convert_to_long_ex(pv_opt); - cur_opt = (*pv_opt)->value.lval; + cur_opt = Z_LVAL_PP(pv_opt); /* Confirm the cur_opt range */ if (! (cur_opt == SQL_CUR_USE_IF_NEEDED || @@ -2049,9 +2049,9 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) convert_to_string_ex(pv_uid); convert_to_string_ex(pv_pwd); - db = (*pv_db)->value.str.val; - uid = (*pv_uid)->value.str.val; - pwd = (*pv_pwd)->value.str.val; + db = Z_STRVAL_PP(pv_db); + uid = Z_STRVAL_PP(pv_uid); + pwd = Z_STRVAL_PP(pv_pwd); if (ODBCG(allow_persistent) <= 0) { persistent = 0; @@ -2099,7 +2099,7 @@ try_and_get_another_connection: RETURN_FALSE; } - new_le.type = le_pconn; + Z_TYPE(new_le) = le_pconn; new_le.ptr = db_conn; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_len + 1, &new_le, sizeof(list_entry), NULL) == FAILURE) { @@ -2111,7 +2111,7 @@ try_and_get_another_connection: ODBCG(num_links)++; db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn); } else { /* found connection */ - if (le->type != le_pconn) { + if (Z_TYPE_P(le) != le_pconn) { RETURN_FALSE; } /* @@ -2147,15 +2147,15 @@ try_and_get_another_connection: (void **) &index_ptr) == SUCCESS) { int type, conn_id; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } conn_id = (int)index_ptr->ptr; ptr = zend_list_find(conn_id, &type); /* check if the connection is still there */ if (ptr && (type == le_conn || type == le_pconn)) { zend_list_addref(conn_id); - return_value->value.lval = conn_id; - return_value->type = IS_RESOURCE; + Z_LVAL_P(return_value) = conn_id; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; } else { @@ -2173,8 +2173,8 @@ try_and_get_another_connection: RETURN_FALSE; } db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_conn); - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_len + 1, (void *) &new_index_ptr, sizeof(list_entry), NULL) == FAILURE) { efree(hashed_details); @@ -2221,11 +2221,11 @@ PHP_FUNCTION(odbc_close) } } - zend_list_delete((*pv_conn)->value.lval); + zend_list_delete(Z_LVAL_PP(pv_conn)); if(is_pconn){ zend_hash_apply_with_argument(&EG(persistent_list), - (apply_func_arg_t) _close_pconn_with_id, (void *) &((*pv_conn)->value.lval) TSRMLS_CC); + (apply_func_arg_t) _close_pconn_with_id, (void *) &(Z_LVAL_PP(pv_conn)) TSRMLS_CC); } } /* }}} */ @@ -2333,17 +2333,17 @@ PHP_FUNCTION(odbc_field_name) RETURN_FALSE; } - if ((*pv_num)->value.lval > result->numcols) { + if (Z_LVAL_PP(pv_num) > result->numcols) { php_error(E_WARNING, "Field index larger than number of fields"); RETURN_FALSE; } - if ((*pv_num)->value.lval < 1) { + if (Z_LVAL_PP(pv_num) < 1) { php_error(E_WARNING, "Field numbering starts at 1"); RETURN_FALSE; } - RETURN_STRING(result->values[(*pv_num)->value.lval - 1].name, 1) + RETURN_STRING(result->values[Z_LVAL_PP(pv_num) - 1].name, 1) } /* }}} */ @@ -2369,17 +2369,17 @@ PHP_FUNCTION(odbc_field_type) RETURN_FALSE; } - if ((*pv_num)->value.lval > result->numcols) { + if (Z_LVAL_PP(pv_num) > result->numcols) { php_error(E_WARNING, "Field index larger than number of fields"); RETURN_FALSE; } - if ((*pv_num)->value.lval < 1) { + if (Z_LVAL_PP(pv_num) < 1) { php_error(E_WARNING, "Field numbering starts at 1"); RETURN_FALSE; } - SQLColAttributes(result->stmt, (UWORD)(*pv_num)->value.lval, + SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num), SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL); RETURN_STRING(tmp,1) } @@ -2423,7 +2423,7 @@ PHP_FUNCTION(odbc_field_num) } convert_to_string_ex(pv_name); - fname = (*pv_name)->value.str.val; + fname = Z_STRVAL_PP(pv_name); field_ind = -1; for(i = 0; i < result->numcols; i++) { @@ -2465,7 +2465,7 @@ PHP_FUNCTION(odbc_autocommit) if (pv_onoff && (*pv_onoff)) { convert_to_long_ex(pv_onoff); rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, - ((*pv_onoff)->value.lval) ? + (Z_LVAL_PP(pv_onoff)) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(conn, SQL_NULL_HSTMT, "Set autocommit"); @@ -2576,14 +2576,14 @@ PHP_FUNCTION(odbc_setoption) convert_to_long_ex(pv_opt); convert_to_long_ex(pv_val); - switch ((*pv_which)->value.lval) { + switch (Z_LVAL_PP(pv_which)) { case 1: /* SQLSetConnectOption */ ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn); if (conn->persistent) { php_error(E_WARNING, "Can't set option for persistent connection"); RETURN_FALSE; } - rc = SQLSetConnectOption(conn->hdbc, (unsigned short)((*pv_opt)->value.lval), (*pv_val)->value.lval); + rc = SQLSetConnectOption(conn->hdbc, (unsigned short)(Z_LVAL_PP(pv_opt)), Z_LVAL_PP(pv_val)); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(conn, SQL_NULL_HSTMT, "SetConnectOption"); RETURN_FALSE; @@ -2592,7 +2592,7 @@ PHP_FUNCTION(odbc_setoption) case 2: /* SQLSetStmtOption */ ZEND_FETCH_RESOURCE(result, odbc_result *, pv_handle, -1, "ODBC result", le_result); - rc = SQLSetStmtOption(result->stmt, (unsigned short)((*pv_opt)->value.lval), ((*pv_val)->value.lval)); + rc = SQLSetStmtOption(result->stmt, (unsigned short)(Z_LVAL_PP(pv_opt)), (Z_LVAL_PP(pv_val))); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption"); @@ -2631,16 +2631,16 @@ PHP_FUNCTION(odbc_tables) switch (argc) { case 5: convert_to_string_ex(pv_type); - type = (*pv_type)->value.str.val; + type = Z_STRVAL_PP(pv_type); case 4: convert_to_string_ex(pv_table); - table = (*pv_table)->value.str.val; + table = Z_STRVAL_PP(pv_table); case 3: convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); case 2: convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); } ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); @@ -2714,16 +2714,16 @@ PHP_FUNCTION(odbc_columns) switch (argc) { case 5: convert_to_string_ex(pv_column); - column = (*pv_column)->value.str.val; + column = Z_STRVAL_PP(pv_column); case 4: convert_to_string_ex(pv_table); - table = (*pv_table)->value.str.val; + table = Z_STRVAL_PP(pv_table); case 3: convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); case 2: convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); } ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); @@ -2794,13 +2794,13 @@ PHP_FUNCTION(odbc_columnprivileges) WRONG_PARAM_COUNT; } convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); convert_to_string_ex(pv_table); - table = (*pv_table)->value.str.val; + table = Z_STRVAL_PP(pv_table); convert_to_string_ex(pv_column); - column = (*pv_column)->value.str.val; + column = Z_STRVAL_PP(pv_column); } else { WRONG_PARAM_COUNT; } @@ -2877,17 +2877,17 @@ PHP_FUNCTION(odbc_foreignkeys) WRONG_PARAM_COUNT; } convert_to_string_ex(pv_pcat); - pcat = (*pv_pcat)->value.str.val; + pcat = Z_STRVAL_PP(pv_pcat); convert_to_string_ex(pv_pschema); - pschema = (*pv_pschema)->value.str.val; + pschema = Z_STRVAL_PP(pv_pschema); convert_to_string_ex(pv_ptable); - ptable = (*pv_ptable)->value.str.val; + ptable = Z_STRVAL_PP(pv_ptable); convert_to_string_ex(pv_fcat); - fcat = (*pv_fcat)->value.str.val; + fcat = Z_STRVAL_PP(pv_fcat); convert_to_string_ex(pv_fschema); - fschema = (*pv_fschema)->value.str.val; + fschema = Z_STRVAL_PP(pv_fschema); convert_to_string_ex(pv_ftable); - ftable = (*pv_ftable)->value.str.val; + ftable = Z_STRVAL_PP(pv_ftable); #ifdef HAVE_DBMAKER #define EMPTY_TO_NULL(xstr) \ if ((int)strlen((xstr)) == 0) (xstr) = NULL @@ -2977,7 +2977,7 @@ PHP_FUNCTION(odbc_gettypeinfo) WRONG_PARAM_COUNT; } convert_to_long_ex(pv_data_type); - data_type = (SWORD) (*pv_data_type)->value.lval; + data_type = (SWORD) Z_LVAL_PP(pv_data_type); } else { WRONG_PARAM_COUNT; } @@ -3045,11 +3045,11 @@ PHP_FUNCTION(odbc_primarykeys) WRONG_PARAM_COUNT; } convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); convert_to_string_ex(pv_table); - table = (*pv_table)->value.str.val; + table = Z_STRVAL_PP(pv_table); } else { WRONG_PARAM_COUNT; } @@ -3125,13 +3125,13 @@ PHP_FUNCTION(odbc_procedurecolumns) WRONG_PARAM_COUNT; } convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); convert_to_string_ex(pv_proc); - proc = (*pv_proc)->value.str.val; + proc = Z_STRVAL_PP(pv_proc); convert_to_string_ex(pv_col); - col = (*pv_col)->value.str.val; + col = Z_STRVAL_PP(pv_col); } else { WRONG_PARAM_COUNT; } @@ -3209,11 +3209,11 @@ PHP_FUNCTION(odbc_procedures) WRONG_PARAM_COUNT; } convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); convert_to_string_ex(pv_proc); - proc = (*pv_proc)->value.str.val; + proc = Z_STRVAL_PP(pv_proc); } else { WRONG_PARAM_COUNT; } @@ -3289,17 +3289,17 @@ PHP_FUNCTION(odbc_specialcolumns) WRONG_PARAM_COUNT; } convert_to_long_ex(pv_type); - type = (UWORD) (*pv_type)->value.lval; + type = (UWORD) Z_LVAL_PP(pv_type); convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); convert_to_string_ex(pv_name); - name = (*pv_name)->value.str.val; + name = Z_STRVAL_PP(pv_name); convert_to_long_ex(pv_scope); - scope = (UWORD) (*pv_scope)->value.lval; + scope = (UWORD) Z_LVAL_PP(pv_scope); convert_to_long_ex(pv_nullable); - nullable = (UWORD) (*pv_nullable)->value.lval; + nullable = (UWORD) Z_LVAL_PP(pv_nullable); } else { WRONG_PARAM_COUNT; } @@ -3376,15 +3376,15 @@ PHP_FUNCTION(odbc_statistics) WRONG_PARAM_COUNT; } convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); convert_to_string_ex(pv_name); - name = (*pv_name)->value.str.val; + name = Z_STRVAL_PP(pv_name); convert_to_long_ex(pv_unique); - unique = (UWORD) (*pv_unique)->value.lval; + unique = (UWORD) Z_LVAL_PP(pv_unique); convert_to_long_ex(pv_reserved); - reserved = (UWORD) (*pv_reserved)->value.lval; + reserved = (UWORD) Z_LVAL_PP(pv_reserved); } else { WRONG_PARAM_COUNT; } @@ -3458,11 +3458,11 @@ PHP_FUNCTION(odbc_tableprivileges) WRONG_PARAM_COUNT; } convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; + cat = Z_STRVAL_PP(pv_cat); convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; + schema = Z_STRVAL_PP(pv_schema); convert_to_string_ex(pv_table); - table = (*pv_table)->value.str.val; + table = Z_STRVAL_PP(pv_table); } else { WRONG_PARAM_COUNT; } diff --git a/ext/odbc/velocis.c b/ext/odbc/velocis.c index b9e8888ae0..9bbe23c1ae 100644 --- a/ext/odbc/velocis.c +++ b/ext/odbc/velocis.c @@ -224,9 +224,9 @@ PHP_FUNCTION(velocis_connect) convert_to_string(serv); convert_to_string(user); convert_to_string(pass); - Serv = serv->value.str.val; - User = user->value.str.val; - Pass = pass->value.str.val; + Serv = Z_STRVAL_P(serv); + User = Z_STRVAL_P(user); + Pass = Z_STRVAL_P(pass); stat = SQLAllocConnect(henv,&hdbc); if ( stat != SQL_SUCCESS ) { php_error(E_WARNING,"Velocis: Could not allocate connection handle"); @@ -258,14 +258,14 @@ PHP_FUNCTION(velocis_close) WRONG_PARAM_COUNT; } convert_to_long(id); - conn = velocis_find_conn(list,id->value.lval); + conn = velocis_find_conn(list,Z_LVAL_P(id)); if ( !conn ) { - php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval); + php_error(E_WARNING,"Velocis: Not connection index (%d)",Z_LVAL_P(id)); RETURN_FALSE; } SQLDisconnect(conn->hdbc); SQLFreeConnect(conn->hdbc); - velocis_del_conn(list,id->value.lval); + velocis_del_conn(list,Z_LVAL_P(id)); php_velocis_module.num_links--; RETURN_TRUE; } @@ -285,13 +285,13 @@ PHP_FUNCTION(velocis_exec) WRONG_PARAM_COUNT; } convert_to_long(ind); - conn = velocis_find_conn(list,ind->value.lval); + conn = velocis_find_conn(list,Z_LVAL_P(ind)); if ( !conn ) { - php_error(E_WARNING,"Velocis: Not connection index (%d)",ind->value.lval); + php_error(E_WARNING,"Velocis: Not connection index (%d)",Z_LVAL_P(ind)); RETURN_FALSE; } convert_to_string(exec_str); - query = exec_str->value.str.val; + query = Z_STRVAL_P(exec_str); res = (Vresult *)emalloc(sizeof(Vresult)); if ( res == NULL ) { @@ -380,21 +380,21 @@ PHP_FUNCTION(velocis_fetch) WRONG_PARAM_COUNT; } convert_to_long(ind); - res = velocis_find_result(list,ind->value.lval); + res = velocis_find_result(list,Z_LVAL_P(ind)); if ( !res ) { - php_error(E_WARNING,"Velocis: Not result index (%d)",ind->value.lval); + php_error(E_WARNING,"Velocis: Not result index (%d)",Z_LVAL_P(ind)); RETURN_FALSE; } stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - velocis_del_result(list,ind->value.lval); + velocis_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error(E_WARNING,"Velocis: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - velocis_del_result(list,ind->value.lval); + velocis_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; } res->fetched = 1; @@ -416,16 +416,16 @@ PHP_FUNCTION(velocis_result) WRONG_PARAM_COUNT; } convert_to_long(ind); - res = velocis_find_result(list,ind->value.lval); + res = velocis_find_result(list,Z_LVAL_P(ind)); if ( !res ) { - php_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval"); + php_error(E_WARNING,"Velocis: Not result index (%d),Z_LVAL_P(ind)"); RETURN_FALSE; } - if ( col->type == IS_STRING ) { - field = col->value.str.val; + if ( Z_TYPE_P(col) == IS_STRING ) { + field = Z_STRVAL_P(col); } else { convert_to_long(col); - indx = col->value.lval; + indx = Z_LVAL_P(col); } if ( field ) { for ( i = 0; i < res->numcols; i++ ) { @@ -448,13 +448,13 @@ PHP_FUNCTION(velocis_result) stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - velocis_del_result(list,ind->value.lval); + velocis_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error(E_WARNING,"Velocis: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - velocis_del_result(list,ind->value.lval); + velocis_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; } res->fetched = 1; @@ -477,13 +477,13 @@ l1: res->values[indx].value,4095,&res->values[indx].vallen); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - velocis_del_result(list,ind->value.lval); + velocis_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error(E_WARNING,"Velocis: SQLGetData return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - velocis_del_result(list,ind->value.lval); + velocis_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; } if ( res->values[indx].valtype == SQL_LONGVARCHAR ) { @@ -507,13 +507,13 @@ PHP_FUNCTION(velocis_freeresult) WRONG_PARAM_COUNT; } convert_to_long(ind); - res = velocis_find_result(list,ind->value.lval); + res = velocis_find_result(list,Z_LVAL_P(ind)); if ( !res ) { - php_error(E_WARNING,"Velocis: Not result index (%d)",ind->value.lval); + php_error(E_WARNING,"Velocis: Not result index (%d)",Z_LVAL_P(ind)); RETURN_FALSE; } SQLFreeStmt(res->hstmt,SQL_DROP); - velocis_del_result(list,ind->value.lval); + velocis_del_result(list,Z_LVAL_P(ind)); RETURN_TRUE; } @@ -527,9 +527,9 @@ PHP_FUNCTION(velocis_autocommit) WRONG_PARAM_COUNT; } convert_to_long(id); - conn = velocis_find_conn(list,id->value.lval); + conn = velocis_find_conn(list,Z_LVAL_P(id)); if ( !conn ) { - php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval); + php_error(E_WARNING,"Velocis: Not connection index (%d)",Z_LVAL_P(id)); RETURN_FALSE; } stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON); @@ -550,9 +550,9 @@ PHP_FUNCTION(velocis_off_autocommit) WRONG_PARAM_COUNT; } convert_to_long(id); - conn = velocis_find_conn(list,id->value.lval); + conn = velocis_find_conn(list,Z_LVAL_P(id)); if ( !conn ) { - php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval); + php_error(E_WARNING,"Velocis: Not connection index (%d)",Z_LVAL_P(id)); RETURN_FALSE; } stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF); @@ -573,9 +573,9 @@ PHP_FUNCTION(velocis_commit) WRONG_PARAM_COUNT; } convert_to_long(id); - conn = velocis_find_conn(list,id->value.lval); + conn = velocis_find_conn(list,Z_LVAL_P(id)); if ( !conn ) { - php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval); + php_error(E_WARNING,"Velocis: Not connection index (%d)",Z_LVAL_P(id)); RETURN_FALSE; } stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT); @@ -596,9 +596,9 @@ PHP_FUNCTION(velocis_rollback) WRONG_PARAM_COUNT; } convert_to_long(id); - conn = velocis_find_conn(list,id->value.lval); + conn = velocis_find_conn(list,Z_LVAL_P(id)); if ( !conn ) { - php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval); + php_error(E_WARNING,"Velocis: Not connection index (%d)",Z_LVAL_P(id)); RETURN_FALSE; } stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK); @@ -619,13 +619,13 @@ PHP_FUNCTION(velocis_fieldname) WRONG_PARAM_COUNT; } convert_to_long(ind); - res = velocis_find_result(list,ind->value.lval); + res = velocis_find_result(list,Z_LVAL_P(ind)); if ( !res ) { - php_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval"); + php_error(E_WARNING,"Velocis: Not result index (%d),Z_LVAL_P(ind)"); RETURN_FALSE; } convert_to_long(col); - indx = col->value.lval; + indx = Z_LVAL_P(col); if ( indx < 0 || indx >= res->numcols ) { php_error(E_WARNING,"Velocis: Field index not in range"); RETURN_FALSE; @@ -642,9 +642,9 @@ PHP_FUNCTION(velocis_fieldnum) WRONG_PARAM_COUNT; } convert_to_long(ind); - res = velocis_find_result(list,ind->value.lval); + res = velocis_find_result(list,Z_LVAL_P(ind)); if ( !res ) { - php_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval"); + php_error(E_WARNING,"Velocis: Not result index (%d),Z_LVAL_P(ind)"); RETURN_FALSE; } RETURN_LONG(res->numcols); diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index cf3df2aacc..ebf8c2b000 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2323,7 +2323,7 @@ PHP_FUNCTION(openssl_private_encrypt) cryptedlen = EVP_PKEY_size(pkey); cryptedbuf = emalloc(cryptedlen + 1); - switch (pkey->type) { + switch (Z_TYPE_P(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: successful = (RSA_private_encrypt(data_len, @@ -2379,7 +2379,7 @@ PHP_FUNCTION(openssl_private_decrypt) cryptedlen = EVP_PKEY_size(pkey); crypttemp = emalloc(cryptedlen + 1); - switch (pkey->type) { + switch (Z_TYPE_P(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: cryptedlen = RSA_private_decrypt(data_len, @@ -2442,7 +2442,7 @@ PHP_FUNCTION(openssl_public_encrypt) cryptedlen = EVP_PKEY_size(pkey); cryptedbuf = emalloc(cryptedlen + 1); - switch (pkey->type) { + switch (Z_TYPE_P(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: successful = (RSA_public_encrypt(data_len, @@ -2499,7 +2499,7 @@ PHP_FUNCTION(openssl_public_decrypt) cryptedlen = EVP_PKEY_size(pkey); crypttemp = emalloc(cryptedlen + 1); - switch (pkey->type) { + switch (Z_TYPE_P(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: cryptedlen = RSA_public_decrypt(data_len, diff --git a/ext/oracle/oracle.c b/ext/oracle/oracle.c index 5db6739143..3716cad895 100644 --- a/ext/oracle/oracle.c +++ b/ext/oracle/oracle.c @@ -483,7 +483,7 @@ void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent) } /* hash it up */ - new_le.type = le_pconn; + Z_TYPE(new_le) = le_pconn; new_le.ptr = db_conn; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { free(db_conn); @@ -494,7 +494,7 @@ void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent) ORA(num_links)++; zend_hash_add(ORA(conns),(void*)&db_conn,sizeof(void*),(void*)&db_conn,sizeof(void*),NULL); } else { /* we do */ - if (le->type != le_pconn) { + if (Z_TYPE_P(le) != le_pconn) { RETURN_FALSE; } @@ -531,15 +531,15 @@ void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent) int type,link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (int) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_conn || type==le_pconn)) { zend_list_addref(link); - return_value->value.lval = link; - return_value->type = IS_RESOURCE; + Z_LVAL_P(return_value) = link; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; } else { @@ -574,8 +574,8 @@ void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, db_conn, le_conn); /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); RETURN_FALSE; @@ -600,7 +600,7 @@ PHP_FUNCTION(ora_logoff) } ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn); - zend_list_delete((*arg)->value.lval); + zend_list_delete(Z_LVAL_PP(arg)); } /* }}} */ @@ -631,7 +631,7 @@ PHP_FUNCTION(ora_open) cursor->open = 1; cursor->conn_ptr = conn; ZEND_REGISTER_RESOURCE(return_value, cursor, le_cursor); - cursor->conn_id = return_value->value.lval; + cursor->conn_id = Z_LVAL_P(return_value); } /* }}} */ @@ -648,7 +648,7 @@ PHP_FUNCTION(ora_close) } ZEND_FETCH_RESOURCE(cursor, oraCursor *, arg, -1, "Oracle-Cursor", le_cursor); - zend_list_delete((*arg)->value.lval); + zend_list_delete(Z_LVAL_PP(arg)); RETURN_TRUE; } @@ -751,7 +751,7 @@ PHP_FUNCTION(ora_parse) case 3: zend_get_parameters_ex(3,&curs,&sql,&def); convert_to_long_ex(def); - if ((*def)->value.lval) { + if (Z_LVAL_PP(def)) { defer = DEFER_PARSE; } break; @@ -763,7 +763,7 @@ PHP_FUNCTION(ora_parse) } convert_to_string_ex(sql); - query = (text *) estrndup((*sql)->value.str.val,(*sql)->value.str.len); + query = (text *) estrndup(Z_STRVAL_PP(sql),Z_STRLEN_PP(sql)); if (query == NULL) { php_error(E_WARNING, "Invalid query"); @@ -811,7 +811,7 @@ PHP_FUNCTION(ora_bind) case 5: zend_get_parameters_ex(5,&curs,&pvar,&svar,&plen,&ptyp); convert_to_long_ex(ptyp); - inout = (*ptyp)->value.lval; + inout = Z_LVAL_PP(ptyp); break; case 4: zend_get_parameters_ex(4,&curs,&pvar,&svar,&plen); @@ -843,13 +843,13 @@ PHP_FUNCTION(ora_bind) RETURN_FALSE; } - if ((paramname = estrndup((*pvar)->value.str.val, (*pvar)->value.str.len)) == NULL) { + if ((paramname = estrndup(Z_STRVAL_PP(pvar), Z_STRLEN_PP(pvar))) == NULL) { php_error(E_WARNING, "Out of memory for parametername"); efree(newparam); RETURN_FALSE; } - if (zend_hash_add(cursor->params, paramname, (*pvar)->value.str.len + 1, + if (zend_hash_add(cursor->params, paramname, Z_STRLEN_PP(pvar) + 1, newparam, sizeof(oraParam), (void **)¶mptr) == FAILURE) { /* XXX zend_hash_destroy */ efree(paramname); @@ -861,7 +861,7 @@ PHP_FUNCTION(ora_bind) efree(newparam); efree(paramname); - paramptr->progvl = (*plen)->value.lval + 1; + paramptr->progvl = Z_LVAL_PP(plen) + 1; paramptr->inout = inout; if ((paramptr->progv = (text *)emalloc(paramptr->progvl)) == NULL) { @@ -873,7 +873,7 @@ PHP_FUNCTION(ora_bind) paramptr->alen = paramptr->progvl; if (obndra(&cursor->cda, - (*svar)->value.str.val, + Z_STRVAL_PP(svar), -1, (ub1 *)paramptr->progv, paramptr->progvl, @@ -1002,7 +1002,7 @@ PHP_FUNCTION(ora_do) memset(cursor, 0, sizeof(oraCursor)); - query = (text *) estrndup((*sql)->value.str.val,(*sql)->value.str.len); + query = (text *) estrndup(Z_STRVAL_PP(sql),Z_STRLEN_PP(sql)); if (query == NULL) { php_error(E_WARNING, "Invalid query in Ora_Do"); @@ -1019,7 +1019,7 @@ PHP_FUNCTION(ora_do) } cursor->open = 1; cursor->conn_ptr = conn; - cursor->conn_id = (*con)->value.lval; + cursor->conn_id = Z_LVAL_PP(con); /* Prepare stmt */ @@ -1107,7 +1107,7 @@ PHP_FUNCTION(ora_fetch_into) case 3: zend_get_parameters_ex(3, &curs, &arr, &flg); convert_to_long_ex(flg); - flags = (*flg)->value.lval; + flags = Z_LVAL_PP(flg); break; default: @@ -1133,14 +1133,14 @@ PHP_FUNCTION(ora_fetch_into) } cursor->fetched++; - if ((*arr)->type != IS_ARRAY){ + if (Z_TYPE_PP(arr) != IS_ARRAY){ pval_destructor(*arr); if (array_init(*arr) == FAILURE){ php_error(E_WARNING, "Can't convert to type Array"); RETURN_FALSE; } } - zend_hash_internal_pointer_reset((*arr)->value.ht); + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(arr)); for (i = 0; i < cursor->ncols; i++) { if (cursor->columns[i].col_retcode == 1405) { @@ -1162,8 +1162,8 @@ PHP_FUNCTION(ora_fetch_into) } else { MAKE_STD_ZVAL(tmp); - tmp->type = IS_STRING; - tmp->value.str.len = 0; + Z_TYPE_P(tmp) = IS_STRING; + Z_STRLEN_P(tmp) = 0; switch(cursor->columns[i].dbtype) { case SQLT_LNG: @@ -1201,24 +1201,24 @@ PHP_FUNCTION(ora_fetch_into) } } if (cursor->columns[i].buf && offset) { - tmp->value.str.len = offset; + Z_STRLEN_P(tmp) = offset; } else { - tmp->value.str.len = 0; + Z_STRLEN_P(tmp) = 0; } } break; default: - tmp->value.str.len = min(cursor->columns[i].col_retlen, + Z_STRLEN_P(tmp) = min(cursor->columns[i].col_retlen, cursor->columns[i].dsize); break; } - tmp->value.str.val = estrndup(cursor->columns[i].buf,tmp->value.str.len); + Z_STRVAL_P(tmp) = estrndup(cursor->columns[i].buf,Z_STRLEN_P(tmp)); } if (flags&ORA_FETCHINTO_ASSOC){ - zend_hash_update((*arr)->value.ht, cursor->columns[i].cbuf, cursor->columns[i].cbufl+1, (void *) &tmp, sizeof(pval*), NULL); + zend_hash_update(Z_ARRVAL_PP(arr), cursor->columns[i].cbuf, cursor->columns[i].cbufl+1, (void *) &tmp, sizeof(pval*), NULL); } else { - zend_hash_index_update((*arr)->value.ht, i, (void *) &tmp, sizeof(pval*), NULL); + zend_hash_index_update(Z_ARRVAL_PP(arr), i, (void *) &tmp, sizeof(pval*), NULL); } } @@ -1249,18 +1249,18 @@ PHP_FUNCTION(ora_columnname) RETURN_FALSE; } - if ((*col)->value.lval >= cursor->ncols){ + if (Z_LVAL_PP(col) >= cursor->ncols){ php_error(E_WARNING, "Column index larger than number of columns"); RETURN_FALSE; } - if ((*col)->value.lval < 0){ + if (Z_LVAL_PP(col) < 0){ php_error(E_WARNING, "Column numbering starts at 0"); RETURN_FALSE; } - RETURN_STRINGL(cursor->columns[(*col)->value.lval].cbuf, - cursor->columns[(*col)->value.lval].cbufl,1); + RETURN_STRINGL(cursor->columns[Z_LVAL_PP(col)].cbuf, + cursor->columns[Z_LVAL_PP(col)].cbufl,1); } /* }}} */ @@ -1281,7 +1281,7 @@ PHP_FUNCTION(ora_columntype) } convert_to_long_ex(col); - colno = (*col)->value.lval; + colno = Z_LVAL_PP(col); if (cursor->ncols == 0){ php_error(E_WARNING, "No tuples available at this cursor index"); @@ -1355,17 +1355,17 @@ PHP_FUNCTION(ora_columnsize) RETURN_FALSE; } - if ((*col)->value.lval >= cursor->ncols){ + if (Z_LVAL_PP(col) >= cursor->ncols){ php_error(E_WARNING, "Column index larger than number of columns"); RETURN_FALSE; } - if ((*col)->value.lval < 0){ + if (Z_LVAL_PP(col) < 0){ php_error(E_WARNING, "Column numbering starts at 0"); RETURN_FALSE; } - RETURN_LONG(cursor->columns[(*col)->value.lval].dbsize); + RETURN_LONG(cursor->columns[Z_LVAL_PP(col)].dbsize); } /* }}} */ @@ -1394,7 +1394,7 @@ PHP_FUNCTION(ora_getcolumn) } convert_to_long_ex(col); - colno = (*col)->value.lval; + colno = Z_LVAL_PP(col); if (colno >= cursor->ncols){ php_error(E_WARNING, "Column index larger than number of columns"); @@ -1759,7 +1759,7 @@ int ora_set_param_values(oraCursor *cursor, int isout TSRMLS_DC) } convert_to_string(*pdata); - plen = (*pdata)->value.str.len; + plen = Z_STRLEN_PP(pdata); if (param->progvl <= plen){ php_error(E_NOTICE, "Input value will be truncated"); @@ -1767,7 +1767,7 @@ int ora_set_param_values(oraCursor *cursor, int isout TSRMLS_DC) len = min(param->progvl - 1, plen); - strncpy(param->progv, (*pdata)->value.str.val, len); + strncpy(param->progv, Z_STRVAL_PP(pdata), len); param->progv[len] = '\0'; } diff --git a/ext/ovrimos/ovrimos.c b/ext/ovrimos/ovrimos.c index b40c7a6b57..836480e0c5 100644 --- a/ext/ovrimos/ovrimos.c +++ b/ext/ovrimos/ovrimos.c @@ -340,7 +340,7 @@ PHP_FUNCTION(ovrimos_execute) RETURN_FALSE; } convert_to_string(*tmp); - if ((*tmp)->type != IS_STRING) { + if (Z_TYPE_PP(tmp) != IS_STRING) { php_error(E_WARNING, "Error converting parameter %d to string in call to ovrimos_execute()", icol); @@ -348,11 +348,11 @@ PHP_FUNCTION(ovrimos_execute) } /* PHP data to param type */ - from_type.type = T_VARCHAR; - from_type.u.length = (*tmp)->value.str.len; + Z_TYPE(from_type) = T_VARCHAR; + from_type.u.length = Z_STRLEN_PP(tmp); *buffer = 0; - memcpy(buffer + 1, (*tmp)->value.str.val, + memcpy(buffer + 1, Z_STRVAL_PP(tmp), from_type.u.length); buffer[from_type.u.length + 1] = 0; @@ -654,17 +654,17 @@ PHP_FUNCTION(ovrimos_fetch_into) } convert_to_long(arg_id); - pstmt = (PSTATEMENT) arg_id->value.lval; + pstmt = (PSTATEMENT) Z_LVAL_P(arg_id); stmt = pstmt->statement; if (arg_how != 0) { - if (arg_how->type != IS_STRING) { + if (Z_TYPE_P(arg_how) != IS_STRING) { php_error(E_WARNING, "Third argument not string in ovrimos_fetch_into()"); RETURN_FALSE; } - s_how = arg_how->value.str.val; + s_how = Z_STRVAL_P(arg_how); if (stricmp(s_how, "next") == 0) { how = h_next; } else if (stricmp(s_how, "prev") == 0) { @@ -687,7 +687,7 @@ PHP_FUNCTION(ovrimos_fetch_into) } if (arg_row != 0) { convert_to_long(arg_row); - rownum = arg_row->value.lval; + rownum = Z_LVAL_P(arg_row); switch (how) { case h_next: case h_prev: @@ -699,7 +699,7 @@ PHP_FUNCTION(ovrimos_fetch_into) } } - if (arr->type != IS_ARRAY) { + if (Z_TYPE_P(arr) != IS_ARRAY) { if (array_init(arr) == FAILURE) { php_error(E_WARNING, "Can't convert to type Array"); @@ -731,16 +731,16 @@ PHP_FUNCTION(ovrimos_fetch_into) char buffer[10240]; tmp = (pval *) emalloc(sizeof(pval)); tmp->refcount = 1; - tmp->type = IS_STRING; - tmp->value.str.len = 0; + Z_TYPE_P(tmp) = IS_STRING; + Z_STRLEN_P(tmp) = 0; /* Produce column value in 'tmp' ... */ column_to_string(stmt, icol, buffer, &len, pstmt); - tmp->value.str.len = len; - tmp->value.str.val = estrndup(buffer, len); + Z_STRLEN_P(tmp) = len; + Z_STRVAL_P(tmp) = estrndup(buffer, len); - zend_hash_index_update(arr->value.ht, icol, &tmp, + zend_hash_index_update(Z_ARRVAL_P(arr), icol, &tmp, sizeof(pval *), NULL); } @@ -785,16 +785,16 @@ PHP_FUNCTION(ovrimos_fetch_row) convert_to_long(arg_id); - pstmt = (PSTATEMENT) arg_id->value.lval; + pstmt = (PSTATEMENT) Z_LVAL_P(arg_id); stmt = (SQLS) pstmt->statement; if (arg_how != 0) { - if (arg_how->type != IS_STRING) { + if (Z_TYPE_P(arg_how) != IS_STRING) { php_error(E_WARNING, "Second argument not string in ovrimos_fetch_row()"); RETURN_FALSE; } - s_how = arg_how->value.str.val; + s_how = Z_STRVAL_P(arg_how); if (stricmp(s_how, "next") == 0) { how = h_next; } else if (stricmp(s_how, "prev") == 0) { @@ -817,7 +817,7 @@ PHP_FUNCTION(ovrimos_fetch_row) } if (arg_row != 0) { convert_to_long(arg_row); - rownum = arg_row->value.lval; + rownum = Z_LVAL_P(arg_row); switch (how) { case h_next: case h_prev: @@ -869,23 +869,23 @@ PHP_FUNCTION(ovrimos_result) &arg_field) == FAILURE) WRONG_PARAM_COUNT; convert_to_long(arg_id); - pstmt = (PSTATEMENT) arg_id->value.lval; + pstmt = (PSTATEMENT) Z_LVAL_P(arg_id); stmt = (SQLS) pstmt->statement; colnb = sqlGetOutputColNb(stmt); - if (arg_field->type == IS_STRING) { + if (Z_TYPE_P(arg_field) == IS_STRING) { int i; for (i = 0; i < colnb; i++) { if (!stricmp - (arg_field->value.str.val, + (Z_STRVAL_P(arg_field), sqlGetOutputColName(stmt, i))) { icol = i; break; } } - } else if (arg_field->type == IS_LONG) { - icol = arg_field->value.lval - 1; + } else if (Z_TYPE_P(arg_field) == IS_LONG) { + icol = Z_LVAL_P(arg_field) - 1; } else { php_error(E_WARNING, "Second argument neither number nor string in ovrimos_result()"); diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c index 2dd45c86d7..2a4e564dc1 100644 --- a/ext/pdf/pdf.c +++ b/ext/pdf/pdf.c @@ -2453,10 +2453,10 @@ PHP_FUNCTION(pdf_setpolydash) zend_hash_get_current_data(array, (void **) &keydataptr); keydata = *keydataptr; - if (keydata->type == IS_DOUBLE) { - darray[i] = (float) keydata->value.dval; - } else if (keydata->type == IS_LONG) { - darray[i] = (float) keydata->value.lval; + if (Z_TYPE_P(keydata) == IS_DOUBLE) { + darray[i] = (float) Z_DVAL_P(keydata); + } else if (Z_TYPE_P(keydata) == IS_LONG) { + darray[i] = (float) Z_LVAL_P(keydata); } else { php_error(E_WARNING,"PDFlib set_polydash: illegal darray value"); } diff --git a/ext/pfpro/pfpro.c b/ext/pfpro/pfpro.c index 740894fb37..dec12594a4 100644 --- a/ext/pfpro/pfpro.c +++ b/ext/pfpro/pfpro.c @@ -432,11 +432,11 @@ PHP_FUNCTION(pfpro_process) } - switch ((*entry)->type) { + switch (Z_TYPE_PP(entry)) { case IS_STRING: - if (strchr((*entry)->value.str.val, '&') - || strchr((*entry)->value.str.val, '=')) { - sprintf(tmpbuf, "[%d]=", (*entry)->value.str.len); + if (strchr(Z_STRVAL_PP(entry), '&') + || strchr(Z_STRVAL_PP(entry), '=')) { + sprintf(tmpbuf, "[%d]=", Z_STRLEN_PP(entry)); if (pass == 1) strcpy(parmlist + parmlength, tmpbuf); parmlength += strlen(tmpbuf); @@ -448,13 +448,13 @@ PHP_FUNCTION(pfpro_process) } if (pass == 1) - strcpy(parmlist + parmlength, (*entry)->value.str.val); - parmlength += (*entry)->value.str.len; + strcpy(parmlist + parmlength, Z_STRVAL_PP(entry)); + parmlength += Z_STRLEN_PP(entry); break; case IS_LONG: - sprintf(tmpbuf, "=%d", (*entry)->value.lval); + sprintf(tmpbuf, "=%d", Z_LVAL_PP(entry)); if (pass == 1) strcpy(parmlist + parmlength, tmpbuf); parmlength += strlen(tmpbuf); @@ -462,7 +462,7 @@ PHP_FUNCTION(pfpro_process) break; case IS_DOUBLE: - sprintf(tmpbuf, "=%.2f", (*entry)->value.dval); + sprintf(tmpbuf, "=%.2f", Z_DVAL_PP(entry)); if (pass == 1) strcpy(parmlist + parmlength, tmpbuf); parmlength += strlen(tmpbuf); diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 39efcc268e..5c7626ac67 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -189,7 +189,7 @@ static int _rollback_transactions(zend_rsrc_list_entry *rsrc TSRMLS_DC) { PGconn *link; - if (rsrc->type != le_plink) + if (Z_TYPE_P(rsrc) != le_plink) return 0; link = (PGconn *) rsrc->ptr; @@ -438,7 +438,7 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) PQsetNoticeProcessor(pgsql, _notice_handler, NULL); /* hash it up */ - new_le.type = le_plink; + Z_TYPE(new_le) = le_plink; new_le.ptr = pgsql; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); @@ -447,7 +447,7 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) PGG(num_links)++; PGG(num_persistent)++; } else { /* we do */ - if (le->type != le_plink) { + if (Z_TYPE_P(le) != le_plink) { RETURN_FALSE; } /* ensure that the link did not die */ @@ -481,16 +481,16 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) int type,link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (int) (long) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { - return_value->value.lval = link; + Z_LVAL_P(return_value) = link; zend_list_addref(link); php_pgsql_set_default_link(link); - return_value->type = IS_RESOURCE; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; } else { @@ -519,8 +519,8 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) ZEND_REGISTER_RESOURCE(return_value, pgsql, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { efree(hashed_details); RETURN_FALSE; @@ -528,7 +528,7 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) PGG(num_links)++; } efree(hashed_details); - php_pgsql_set_default_link(return_value->value.lval); + php_pgsql_set_default_link(Z_LVAL_P(return_value)); } /* }}} */ @@ -635,29 +635,29 @@ void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch(entry_type) { case PHP_PG_DBNAME: - return_value->value.str.val = PQdb(pgsql); + Z_STRVAL_P(return_value) = PQdb(pgsql); break; case PHP_PG_ERROR_MESSAGE: - return_value->value.str.val = PQerrorMessage(pgsql); + Z_STRVAL_P(return_value) = PQerrorMessage(pgsql); break; case PHP_PG_OPTIONS: - return_value->value.str.val = PQoptions(pgsql); + Z_STRVAL_P(return_value) = PQoptions(pgsql); break; case PHP_PG_PORT: - return_value->value.str.val = PQport(pgsql); + Z_STRVAL_P(return_value) = PQport(pgsql); break; case PHP_PG_TTY: - return_value->value.str.val = PQtty(pgsql); + Z_STRVAL_P(return_value) = PQtty(pgsql); break; case PHP_PG_HOST: - return_value->value.str.val = PQhost(pgsql); + Z_STRVAL_P(return_value) = PQhost(pgsql); break; default: RETURN_FALSE; } - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->value.str.val = (char *) estrdup(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -767,8 +767,8 @@ PHP_FUNCTION(pg_exec) pg_result->row = -1; ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result); /* - return_value->value.lval = zend_list_insert(pg_result,le_result); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(pg_result,le_result); + Z_TYPE_P(return_value) = IS_LONG; */ } else { RETURN_FALSE; @@ -875,23 +875,23 @@ void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch (entry_type) { case PHP_PG_NUM_ROWS: - return_value->value.lval = PQntuples(pgsql_result); + Z_LVAL_P(return_value) = PQntuples(pgsql_result); break; case PHP_PG_NUM_FIELDS: - return_value->value.lval = PQnfields(pgsql_result); + Z_LVAL_P(return_value) = PQnfields(pgsql_result); break; case PHP_PG_CMD_TUPLES: #if HAVE_PQCMDTUPLES - return_value->value.lval = atoi(PQcmdTuples(pgsql_result)); + Z_LVAL_P(return_value) = atoi(PQcmdTuples(pgsql_result)); #else php_error(E_WARNING,"This compilation does not support pg_cmdtuples()"); - return_value->value.lval = 0; + Z_LVAL_P(return_value) = 0; #endif break; default: RETURN_FALSE; } - return_value->type = IS_LONG; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -967,7 +967,7 @@ char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list) if ((tmp_name = PQgetvalue(result,i,name_offset))==NULL) { continue; } - new_oid_entry.type = le_string; + Z_TYPE(new_oid_entry) = le_string; new_oid_entry.ptr = estrdup(tmp_name); zend_hash_update(list,hashed_oid_key,strlen(hashed_oid_key)+1,(void *) &new_oid_entry, sizeof(list_entry), NULL); if (!ret && atoi(tmp_oid)==oid) { @@ -1007,19 +1007,19 @@ void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch (entry_type) { case PHP_PG_FIELD_NAME: - return_value->value.str.val = PQfname(pgsql_result, Z_LVAL_PP(field)); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->value.str.val = estrndup(return_value->value.str.val,return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = PQfname(pgsql_result, Z_LVAL_PP(field)); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_STRVAL_P(return_value) = estrndup(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; case PHP_PG_FIELD_SIZE: - return_value->value.lval = PQfsize(pgsql_result, Z_LVAL_PP(field)); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = PQfsize(pgsql_result, Z_LVAL_PP(field)); + Z_TYPE_P(return_value) = IS_LONG; break; case PHP_PG_FIELD_TYPE: - return_value->value.str.val = get_field_name(pg_result->conn, PQftype(pgsql_result, Z_LVAL_PP(field)), &EG(regular_list)); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = get_field_name(pg_result->conn, PQftype(pgsql_result, Z_LVAL_PP(field)), &EG(regular_list)); + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; break; default: RETURN_FALSE; @@ -1068,8 +1068,8 @@ PHP_FUNCTION(pg_fieldnum) pgsql_result = pg_result->result; convert_to_string_ex(field); - return_value->value.lval = PQfnumber(pgsql_result, Z_STRVAL_PP(field)); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = PQfnumber(pgsql_result, Z_STRVAL_PP(field)); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1120,12 +1120,12 @@ PHP_FUNCTION(pg_result) } if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) { - return_value->type = IS_NULL; + Z_TYPE_P(return_value) = IS_NULL; } else { - return_value->value.str.val = PQgetvalue(pgsql_result, pgsql_row, field_offset); - return_value->value.str.len = (return_value->value.str.val ? strlen(return_value->value.str.val) : 0); - return_value->value.str.val = safe_estrndup(return_value->value.str.val,return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = PQgetvalue(pgsql_result, pgsql_row, field_offset); + Z_STRLEN_P(return_value) = (Z_STRVAL_P(return_value) ? strlen(Z_STRVAL_P(return_value)) : 0); + Z_STRVAL_P(return_value) = safe_estrndup(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } } /* }}} */ @@ -1251,8 +1251,8 @@ PHP_FUNCTION(pg_fetch_array) PHP_FUNCTION(pg_fetch_object) { php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); - if (return_value->type==IS_ARRAY) { - object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht); + if (Z_TYPE_P(return_value)==IS_ARRAY) { + object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value)); } } /* }}} */ @@ -1310,13 +1310,13 @@ void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch (entry_type) { case PHP_PG_DATA_LENGTH: - return_value->value.lval = PQgetlength(pgsql_result, pgsql_row, field_offset); + Z_LVAL_P(return_value) = PQgetlength(pgsql_result, pgsql_row, field_offset); break; case PHP_PG_DATA_ISNULL: - return_value->value.lval = PQgetisnull(pgsql_result, pgsql_row, field_offset); + Z_LVAL_P(return_value) = PQgetisnull(pgsql_result, pgsql_row, field_offset); break; } - return_value->type = IS_LONG; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1371,20 +1371,20 @@ PHP_FUNCTION(pg_getlastoid) ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result); pgsql_result = pg_result->result; #ifndef HAVE_PQOIDVALUE - return_value->value.str.val = (char *) PQoidStatus(pgsql_result); - if (return_value->value.str.val) { - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->value.str.val = estrndup(return_value->value.str.val, return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = (char *) PQoidStatus(pgsql_result); + if (Z_STRVAL_P(return_value)) { + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_STRVAL_P(return_value) = estrndup(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } else { - return_value->value.str.val = empty_string; + Z_STRVAL_P(return_value) = empty_string; } #else - return_value->value.lval = (int) PQoidValue(pgsql_result); - if (return_value->value.lval == InvalidOid) { + Z_LVAL_P(return_value) = (int) PQoidValue(pgsql_result); + if (Z_LVAL_P(return_value) == InvalidOid) { RETURN_FALSE; } else { - return_value->type = IS_LONG; + Z_TYPE_P(return_value) = IS_LONG; } #endif } @@ -1514,8 +1514,8 @@ PHP_FUNCTION(pg_locreate) RETURN_FALSE; } - return_value->value.lval = pgsql_oid; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = pgsql_oid; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1641,8 +1641,8 @@ PHP_FUNCTION(pg_loopen) } else { pgsql_lofp->conn = pgsql; pgsql_lofp->lofd = pgsql_lofd; - return_value->value.lval = zend_list_insert(pgsql_lofp, le_lofp); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp); + Z_TYPE_P(return_value) = IS_LONG; } } } else { @@ -1655,8 +1655,8 @@ PHP_FUNCTION(pg_loopen) pgsql_lofp->lofd = pgsql_lofd; ZEND_REGISTER_RESOURCE(return_value, pgsql_lofp, le_lofp); /* - return_value->value.lval = zend_list_insert(pgsql_lofp, le_lofp); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp); + Z_TYPE_P(return_value) = IS_LONG; */ } } @@ -1792,8 +1792,8 @@ PHP_FUNCTION(pg_loreadall) } tbytes += i; } - return_value->value.lval = tbytes; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = tbytes; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1915,8 +1915,8 @@ PHP_FUNCTION(pg_set_client_encoding) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); convert_to_string_ex(encoding); - return_value->value.lval = PQsetClientEncoding(pgsql, Z_STRVAL_PP(encoding)); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = PQsetClientEncoding(pgsql, Z_STRVAL_PP(encoding)); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1952,11 +1952,11 @@ PHP_FUNCTION(pg_client_encoding) #define pg_encoding_to_char(x) "SQL_ASCII" #endif - return_value->value.str.val + Z_STRVAL_P(return_value) = (char *) pg_encoding_to_char(PQclientEncoding(pgsql)); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->value.str.val = (char *) estrdup(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ #endif diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 4a6f4d6968..42b5c55d2b 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -151,11 +151,11 @@ PHP_FUNCTION(posix_kill) convert_to_long(pid); convert_to_long(sig); - result = kill(pid->value.lval, sig->value.lval); + result = kill(Z_LVAL_P(pid), Z_LVAL_P(sig)); if (result< 0) { php_error(E_WARNING, "posix_kill(%d, %d) failed with '%s'", - pid->value.lval, - sig->value.lval, + Z_LVAL_P(pid), + Z_LVAL_P(sig), strerror(errno)); RETURN_FALSE; } @@ -243,10 +243,10 @@ PHP_FUNCTION(posix_setuid) convert_to_long(uid); - result = setuid(uid->value.lval); + result = setuid(Z_LVAL_P(uid)); if (result < 0) { php_error(E_WARNING, "posix_setuid(%d) failed with '%s'. Must be root", - uid->value.lval, + Z_LVAL_P(uid), strerror(errno)); RETURN_FALSE; } @@ -268,10 +268,10 @@ PHP_FUNCTION(posix_setgid) convert_to_long(gid); - result = setgid(gid->value.lval); + result = setgid(Z_LVAL_P(gid)); if (result < 0) { php_error(E_WARNING, "posix_setgid(%d) failed with '%s'. Must be root", - gid->value.lval, + Z_LVAL_P(gid), strerror(errno)); RETURN_FALSE; } @@ -294,10 +294,10 @@ PHP_FUNCTION(posix_seteuid) convert_to_long(uid); - result = seteuid(uid->value.lval); + result = seteuid(Z_LVAL_P(uid)); if (result < 0) { php_error(E_WARNING, "posix_setuid(%d) failed with '%s'.", - uid->value.lval, + Z_LVAL_P(uid), strerror(errno)); RETURN_FALSE; } @@ -323,10 +323,10 @@ PHP_FUNCTION(posix_setegid) convert_to_long(gid); - result = setegid(gid->value.lval); + result = setegid(Z_LVAL_P(gid)); if (result < 0) { php_error(E_WARNING, "posix_setgid(%d) failed with '%s'.", - gid->value.lval, + Z_LVAL_P(gid), strerror(errno)); RETURN_FALSE; } @@ -420,11 +420,11 @@ PHP_FUNCTION(posix_setpgid) convert_to_long(pid); convert_to_long(pgid); - result = setpgid(pid->value.lval, pgid->value.lval); + result = setpgid(Z_LVAL_P(pid), Z_LVAL_P(pgid)); if (result< 0) { php_error(E_WARNING, "posix_setpgid(%d, %d) failed with '%s'", - pid->value.lval, - pgid->value.lval, + Z_LVAL_P(pid), + Z_LVAL_P(pgid), strerror(errno)); RETURN_FALSE; } @@ -446,16 +446,16 @@ PHP_FUNCTION(posix_getpgid) } convert_to_long(pid); - pgid = getpgid(pid->value.lval); + pgid = getpgid(Z_LVAL_P(pid)); if (pgid < 0) { php_error(E_WARNING, "posix_getpgid(%d) failed with '%s'", - pid->value.lval, + Z_LVAL_P(pid), strerror(errno)); RETURN_FALSE; } - return_value->type= IS_LONG; - return_value->value.lval = pgid; + Z_TYPE_P(return_value)= IS_LONG; + Z_LVAL_P(return_value) = pgid; #else RETURN_FALSE; #endif @@ -475,16 +475,16 @@ PHP_FUNCTION(posix_getsid) } convert_to_long(pid); - sid = getsid(pid->value.lval); + sid = getsid(Z_LVAL_P(pid)); if (sid < 0) { php_error(E_WARNING, "posix_getsid(%d) failed with '%s'", - pid->value.lval, + Z_LVAL_P(pid), strerror(errno)); RETURN_FALSE; } - return_value->type= IS_LONG; - return_value->value.lval = sid; + Z_TYPE_P(return_value)= IS_LONG; + Z_LVAL_P(return_value) = sid; #else RETURN_FALSE; #endif @@ -576,10 +576,10 @@ PHP_FUNCTION(posix_ttyname) } convert_to_long(fd); - p = ttyname(fd->value.lval); + p = ttyname(Z_LVAL_P(fd)); if (p == NULL) { php_error(E_WARNING, "posix_ttyname(%d) failed with '%s'", - fd->value.lval, + Z_LVAL_P(fd), strerror(errno)); RETURN_FALSE; } @@ -600,7 +600,7 @@ PHP_FUNCTION(posix_isatty) } convert_to_long(fd); - result = isatty(fd->value.lval); + result = isatty(Z_LVAL_P(fd)); if (!result) RETURN_FALSE; @@ -656,13 +656,13 @@ PHP_FUNCTION(posix_mkfifo) convert_to_string(path); convert_to_long(mode); - if (PG(safe_mode) && (!php_checkuid(path->value.str.val, NULL, CHECKUID_ALLOW_ONLY_DIR))) { + if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(path), NULL, CHECKUID_ALLOW_ONLY_DIR))) { RETURN_FALSE; } - result = mkfifo(path->value.str.val, mode->value.lval); + result = mkfifo(Z_STRVAL_P(path), Z_LVAL_P(mode)); if (result < 0) { php_error(E_WARNING, "posix_mkfifo(%s) failed with '%s'", - path->value.str.val, + Z_STRVAL_P(path), strerror(errno)); RETURN_FALSE; } @@ -703,10 +703,10 @@ PHP_FUNCTION(posix_getgrnam) } convert_to_string(name); - g = getgrnam(name->value.str.val); + g = getgrnam(Z_STRVAL_P(name)); if (!g) { php_error(E_WARNING, "posix_getgrnam(%s) failed with '%s'", - name->value.str.val, + Z_STRVAL_P(name), strerror(errno)); RETURN_FALSE; } @@ -738,10 +738,10 @@ PHP_FUNCTION(posix_getgrgid) } convert_to_long(gid); - g = getgrgid(gid->value.lval); + g = getgrgid(Z_LVAL_P(gid)); if (!g) { php_error(E_WARNING, "posix_getgrgid(%d) failed with '%s'", - gid->value.lval, + Z_LVAL_P(gid), strerror(errno)); RETURN_FALSE; } @@ -770,10 +770,10 @@ PHP_FUNCTION(posix_getpwnam) } convert_to_string(name); - pw = getpwnam(name->value.str.val); + pw = getpwnam(Z_STRVAL_P(name)); if (!pw) { php_error(E_WARNING, "posix_getpwnam(%s) failed with '%s'", - name->value.str.val, + Z_STRVAL_P(name), strerror(errno)); RETURN_FALSE; } @@ -802,10 +802,10 @@ PHP_FUNCTION(posix_getpwuid) } convert_to_long(uid); - pw = getpwuid(uid->value.lval); + pw = getpwuid(Z_LVAL_P(uid)); if (!pw) { php_error(E_WARNING, "posix_getpwuid(%d) failed with '%s'", - uid->value.lval, + Z_LVAL_P(uid), strerror(errno)); RETURN_FALSE; } diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index fe1c7028aa..d4131c49e0 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -126,26 +126,26 @@ PHP_FUNCTION(pspell_new) config = new_pspell_config(); convert_to_string_ex(language); - pspell_config_replace(config, "language-tag", (*language)->value.str.val); + pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language)); if(argc > 1){ convert_to_string_ex(spelling); - if((*spelling)->value.str.len > 0){ - pspell_config_replace(config, "spelling", (*spelling)->value.str.val); + if(Z_STRLEN_PP(spelling) > 0){ + pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling)); } } if(argc > 2){ convert_to_string_ex(jargon); - if((*jargon)->value.str.len > 0){ - pspell_config_replace(config, "jargon", (*jargon)->value.str.val); + if(Z_STRLEN_PP(jargon) > 0){ + pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon)); } } if(argc > 3){ convert_to_string_ex(encoding); - if((*encoding)->value.str.len > 0){ - pspell_config_replace(config, "encoding", (*encoding)->value.str.val); + if(Z_STRLEN_PP(encoding) > 0){ + pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding)); } } @@ -204,30 +204,30 @@ PHP_FUNCTION(pspell_new_personal) config = new_pspell_config(); convert_to_string_ex(personal); - pspell_config_replace(config, "personal", (*personal)->value.str.val); + pspell_config_replace(config, "personal", Z_STRVAL_PP(personal)); pspell_config_replace(config, "save-repl", "false"); convert_to_string_ex(language); - pspell_config_replace(config, "language-tag", (*language)->value.str.val); + pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language)); if(argc > 2){ convert_to_string_ex(spelling); - if((*spelling)->value.str.len > 0){ - pspell_config_replace(config, "spelling", (*spelling)->value.str.val); + if(Z_STRLEN_PP(spelling) > 0){ + pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling)); } } if(argc > 3){ convert_to_string_ex(jargon); - if((*jargon)->value.str.len > 0){ - pspell_config_replace(config, "jargon", (*jargon)->value.str.val); + if(Z_STRLEN_PP(jargon) > 0){ + pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon)); } } if(argc > 4){ convert_to_string_ex(encoding); - if((*encoding)->value.str.len > 0){ - pspell_config_replace(config, "encoding", (*encoding)->value.str.val); + if(Z_STRLEN_PP(encoding) > 0){ + pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding)); } } @@ -285,7 +285,7 @@ PHP_FUNCTION(pspell_new_config) } convert_to_long_ex(conf); - config = (PspellConfig *) zend_list_find((*conf)->value.lval, &type); + config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), &type); ret = new_pspell_manager(config); if(pspell_error_number(ret) != 0){ @@ -315,13 +315,13 @@ PHP_FUNCTION(pspell_check) convert_to_long_ex(scin); convert_to_string_ex(word); - manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type); + manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); if(!manager){ - php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin)); RETURN_FALSE; } - if(pspell_manager_check(manager, (*word)->value.str.val)){ + if(pspell_manager_check(manager, Z_STRVAL_PP(word))){ RETURN_TRUE; }else{ RETURN_FALSE; @@ -347,9 +347,9 @@ PHP_FUNCTION(pspell_suggest) convert_to_long_ex(scin); convert_to_string_ex(word); - manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type); + manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); if(!manager){ - php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin)); RETURN_FALSE; } @@ -357,7 +357,7 @@ PHP_FUNCTION(pspell_suggest) RETURN_FALSE; } - wl = pspell_manager_suggest(manager, (*word)->value.str.val); + wl = pspell_manager_suggest(manager, Z_STRVAL_PP(word)); if(wl){ PspellStringEmulation *els = pspell_word_list_elements(wl); while((sug = pspell_string_emulation_next(els)) != 0){ @@ -388,13 +388,13 @@ PHP_FUNCTION(pspell_store_replacement) convert_to_long_ex(scin); convert_to_string_ex(miss); convert_to_string_ex(corr); - manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type); + manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); if(!manager){ - php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin)); RETURN_FALSE; } - pspell_manager_store_replacement(manager, (*miss)->value.str.val, (*corr)->value.str.val); + pspell_manager_store_replacement(manager, Z_STRVAL_PP(miss), Z_STRVAL_PP(corr)); if(pspell_manager_error_number(manager) == 0){ RETURN_TRUE; }else{ @@ -420,18 +420,18 @@ PHP_FUNCTION(pspell_add_to_personal) convert_to_long_ex(scin); convert_to_string_ex(word); - manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type); + manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); if(!manager){ - php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin)); RETURN_FALSE; } /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/ - if((*word)->value.str.len == 0){ + if(Z_STRLEN_PP(word) == 0){ RETURN_FALSE; } - pspell_manager_add_to_personal(manager, (*word)->value.str.val); + pspell_manager_add_to_personal(manager, Z_STRVAL_PP(word)); if(pspell_manager_error_number(manager) == 0){ RETURN_TRUE; }else{ @@ -457,18 +457,18 @@ PHP_FUNCTION(pspell_add_to_session) convert_to_long_ex(scin); convert_to_string_ex(word); - manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type); + manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); if(!manager){ - php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin)); RETURN_FALSE; } /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/ - if((*word)->value.str.len == 0){ + if(Z_STRLEN_PP(word) == 0){ RETURN_FALSE; } - pspell_manager_add_to_session(manager, (*word)->value.str.val); + pspell_manager_add_to_session(manager, Z_STRVAL_PP(word)); if(pspell_manager_error_number(manager) == 0){ RETURN_TRUE; }else{ @@ -493,9 +493,9 @@ PHP_FUNCTION(pspell_clear_session) } convert_to_long_ex(scin); - manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type); + manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); if(!manager){ - php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin)); RETURN_FALSE; } @@ -524,9 +524,9 @@ PHP_FUNCTION(pspell_save_wordlist) } convert_to_long_ex(scin); - manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type); + manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); if(!manager){ - php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin)); RETURN_FALSE; } @@ -559,26 +559,26 @@ PHP_FUNCTION(pspell_config_create) config = new_pspell_config(); convert_to_string_ex(language); - pspell_config_replace(config, "language-tag", (*language)->value.str.val); + pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language)); if(argc > 1){ convert_to_string_ex(spelling); - if((*spelling)->value.str.len > 0){ - pspell_config_replace(config, "spelling", (*spelling)->value.str.val); + if(Z_STRLEN_PP(spelling) > 0){ + pspell_config_replace(config, "spelling", Z_STRVAL_PP(spelling)); } } if(argc > 2){ convert_to_string_ex(jargon); - if((*jargon)->value.str.len > 0){ - pspell_config_replace(config, "jargon", (*jargon)->value.str.val); + if(Z_STRLEN_PP(jargon) > 0){ + pspell_config_replace(config, "jargon", Z_STRVAL_PP(jargon)); } } if(argc > 3){ convert_to_string_ex(encoding); - if((*encoding)->value.str.len > 0){ - pspell_config_replace(config, "encoding", (*encoding)->value.str.val); + if(Z_STRLEN_PP(encoding) > 0){ + pspell_config_replace(config, "encoding", Z_STRVAL_PP(encoding)); } } @@ -607,14 +607,14 @@ PHP_FUNCTION(pspell_config_runtogether) } convert_to_long_ex(sccin); - config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type); + config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type); if(!config){ - php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin)); RETURN_FALSE; } convert_to_boolean_ex(runtogether); - pspell_config_replace(config, "run-together", (*runtogether)->value.lval ? "true" : "false"); + pspell_config_replace(config, "run-together", Z_LVAL_PP(runtogether) ? "true" : "false"); RETURN_TRUE; } @@ -636,20 +636,20 @@ PHP_FUNCTION(pspell_config_mode) } convert_to_long_ex(sccin); - config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type); + config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type); if(!config){ - php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin)); RETURN_FALSE; } convert_to_long_ex(mode); /* First check what mode we want (how many suggestions) */ - if((*mode)->value.lval == PSPELL_FAST){ + if(Z_LVAL_PP(mode) == PSPELL_FAST){ pspell_config_replace(config, "sug-mode", "fast"); - }else if((*mode)->value.lval == PSPELL_NORMAL){ + }else if(Z_LVAL_PP(mode) == PSPELL_NORMAL){ pspell_config_replace(config, "sug-mode", "normal"); - }else if((*mode)->value.lval == PSPELL_BAD_SPELLERS){ + }else if(Z_LVAL_PP(mode) == PSPELL_BAD_SPELLERS){ pspell_config_replace(config, "sug-mode", "bad-spellers"); } @@ -678,9 +678,9 @@ PHP_FUNCTION(pspell_config_ignore) } convert_to_long_ex(sccin); - config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type); + config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type); if(!config){ - php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin)); RETURN_FALSE; } @@ -724,14 +724,14 @@ PHP_FUNCTION(pspell_config_personal) } convert_to_long_ex(sccin); - config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type); + config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type); if(!config){ - php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin)); RETURN_FALSE; } convert_to_string_ex(personal); - pspell_config_replace(config, "personal", (*personal)->value.str.val); + pspell_config_replace(config, "personal", Z_STRVAL_PP(personal)); RETURN_TRUE; } @@ -753,16 +753,16 @@ PHP_FUNCTION(pspell_config_repl) } convert_to_long_ex(sccin); - config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type); + config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type); if(!config){ - php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin)); RETURN_FALSE; } pspell_config_replace(config, "save-repl", "true"); convert_to_string_ex(repl); - pspell_config_replace(config, "repl", (*repl)->value.str.val); + pspell_config_replace(config, "repl", Z_STRVAL_PP(repl)); RETURN_TRUE; } @@ -784,14 +784,14 @@ PHP_FUNCTION(pspell_config_save_repl) } convert_to_long_ex(sccin); - config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type); + config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type); if(!config){ - php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval); + php_error(E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin)); RETURN_FALSE; } convert_to_boolean_ex(save); - pspell_config_replace(config, "save-repl", (*save)->value.lval ? "true" : "false"); + pspell_config_replace(config, "save-repl", Z_LVAL_PP(save) ? "true" : "false"); RETURN_TRUE; } diff --git a/ext/qtdom/qtdom.c b/ext/qtdom/qtdom.c index fc1809e94c..ab5acba883 100644 --- a/ext/qtdom/qtdom.c +++ b/ext/qtdom/qtdom.c @@ -125,7 +125,7 @@ static int qdom_find_attributes( zval **children, struct qdom_attribute *attr TS MAKE_STD_ZVAL(child); object_init_ex(child, qdomnode_class_entry_ptr); - zend_hash_next_index_insert((*children)->value.ht, &child, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_PP(children), &child, sizeof(zval *), NULL); add_property_stringl(child, "name", (char *) node->Name, strlen(node->Name), 1); add_property_long(child, "type", node->Type); add_property_stringl(child, "content", (char *) node->Content, strlen(node->Content), 1); @@ -164,7 +164,7 @@ static int qdom_find_children( zval **children, struct qdom_node *orig_node TSRM MAKE_STD_ZVAL(child); object_init_ex(child, qdomnode_class_entry_ptr); - zend_hash_next_index_insert((*children)->value.ht, &child, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_PP(children), &child, sizeof(zval *), NULL); add_property_stringl(child, "name", (char *) node->Name, strlen(node->Name), 1); add_property_long(child, "type", node->Type); if ( node->Type == 2 || node->Type == 3 || node->Type == 4 ) @@ -228,7 +228,7 @@ PHP_FUNCTION(qdom_tree) object_init_ex(return_value, qdomdoc_class_entry_ptr); add_property_stringl(return_value, "version", (char *) qt_ver, strlen(qt_ver), 1); - doc = qdom_do_init( arg->value.str.val ); + doc = qdom_do_init( Z_STRVAL_P(arg) ); qdom_do_doc_type( doc, &qdom_type_name ); diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 0acd4139bb..f46e9acfee 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -114,7 +114,7 @@ PHP_FUNCTION(readline) convert_to_string_ex(arg); } - result = readline(ac?(*arg)->value.str.val:NULL); + result = readline(ac?Z_STRVAL_PP(arg):NULL); if (! result) { RETURN_FALSE; @@ -162,57 +162,57 @@ PHP_FUNCTION(readline_info) } else { convert_to_string_ex(what); - if (! strcasecmp((*what)->value.str.val,"line_buffer")) { + if (! strcasecmp(Z_STRVAL_PP(what),"line_buffer")) { oldstr = rl_line_buffer; if (ac == 2) { /* XXX if (rl_line_buffer) free(rl_line_buffer); */ convert_to_string_ex(value); - rl_line_buffer = strdup((*value)->value.str.val); + rl_line_buffer = strdup(Z_STRVAL_PP(value)); } RETVAL_STRING(SAFE_STRING(oldstr),1); - } else if (! strcasecmp((*what)->value.str.val,"point")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"point")) { RETVAL_LONG(rl_point); - } else if (! strcasecmp((*what)->value.str.val,"end")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"end")) { RETVAL_LONG(rl_end); #ifdef HAVE_LIBREADLINE - } else if (! strcasecmp((*what)->value.str.val,"mark")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"mark")) { RETVAL_LONG(rl_mark); - } else if (! strcasecmp((*what)->value.str.val,"done")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"done")) { oldval = rl_done; if (ac == 2) { convert_to_long_ex(value); - rl_done = (*value)->value.lval; + rl_done = Z_LVAL_PP(value); } RETVAL_LONG(oldval); - } else if (! strcasecmp((*what)->value.str.val,"pending_input")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"pending_input")) { oldval = rl_pending_input; if (ac == 2) { convert_to_string_ex(value); - rl_pending_input = (*value)->value.str.val[0]; + rl_pending_input = Z_STRVAL_PP(value)[0]; } RETVAL_LONG(oldval); - } else if (! strcasecmp((*what)->value.str.val,"prompt")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"prompt")) { RETVAL_STRING(SAFE_STRING(rl_prompt),1); - } else if (! strcasecmp((*what)->value.str.val,"terminal_name")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"terminal_name")) { RETVAL_STRING(SAFE_STRING(rl_terminal_name),1); #endif #if HAVE_ERASE_EMPTY_LINE - } else if (! strcasecmp((*what)->value.str.val,"erase_empty_line")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"erase_empty_line")) { oldval = rl_erase_empty_line; if (ac == 2) { convert_to_long_ex(value); - rl_erase_empty_line = (*value)->value.lval; + rl_erase_empty_line = Z_LVAL_PP(value); } RETVAL_LONG(oldval); #endif - } else if (! strcasecmp((*what)->value.str.val,"library_version")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"library_version")) { RETVAL_STRING(SAFE_STRING(rl_library_version),1); - } else if (! strcasecmp((*what)->value.str.val,"readline_name")) { + } else if (! strcasecmp(Z_STRVAL_PP(what),"readline_name")) { oldstr = rl_readline_name; if (ac == 2) { /* XXX if (rl_readline_name) free(rl_readline_name); */ convert_to_string_ex(value); - rl_readline_name = strdup((*value)->value.str.val);; + rl_readline_name = strdup(Z_STRVAL_PP(value));; } RETVAL_STRING(SAFE_STRING(oldstr),1); } @@ -232,7 +232,7 @@ PHP_FUNCTION(readline_add_history) } convert_to_string_ex(arg); - add_history((*arg)->value.str.val); + add_history(Z_STRVAL_PP(arg)); RETURN_TRUE; } @@ -295,7 +295,7 @@ PHP_FUNCTION(readline_read_history) if (ac == 1) { convert_to_string_ex(arg); - filename = (*arg)->value.str.val; + filename = Z_STRVAL_PP(arg); } if (read_history(filename)) { @@ -320,7 +320,7 @@ PHP_FUNCTION(readline_write_history) if (ac == 1) { convert_to_string_ex(arg); - filename = (*arg)->value.str.val; + filename = Z_STRVAL_PP(arg); } if (write_history(filename)) { @@ -337,7 +337,7 @@ char *test[] = { "bleibt", "da", "helfen", "keine", "pillen", "und" , "heissen", static char *_readline_command_generator(char *text,int state) { - HashTable *myht = _readline_array.value.ht; + HashTable *myht = Z_ARRVAL(_readline_array); zval **entry; /* @@ -352,8 +352,8 @@ static char *_readline_command_generator(char *text,int state) zend_hash_move_forward(myht); convert_to_string_ex(entry); - if (strncmp ((*entry)->value.str.val, text, strlen(text)) == 0) { - return (strdup((*entry)->value.str.val)); + if (strncmp (Z_STRVAL_PP(entry), text, strlen(text)) == 0) { + return (strdup(Z_STRVAL_PP(entry))); } } @@ -366,9 +366,9 @@ static zval *_readline_string_zval(const char *str) int len = strlen(str); MAKE_STD_ZVAL(ret); - ret->type = IS_STRING; - ret->value.str.len = len; - ret->value.str.val = estrndup(str, len); + Z_TYPE_P(ret) = IS_STRING; + Z_STRLEN_P(ret) = len; + Z_STRVAL_P(ret) = estrndup(str, len); return ret; } @@ -377,8 +377,8 @@ static zval *_readline_long_zval(long l) zval *ret; MAKE_STD_ZVAL(ret); - ret->type = IS_LONG; - ret->value.lval = l; + Z_TYPE_P(ret) = IS_LONG; + Z_LVAL_P(ret) = l; return ret; } @@ -395,7 +395,7 @@ static char **_readline_completion_cb(char *text, int start, int end) params[3]=_readline_long_zval(end); if (call_user_function(CG(function_table), NULL, params[0], &_readline_array, 3, params+1 TSRMLS_CC) == SUCCESS) { - if (_readline_array.type == IS_ARRAY) { + if (Z_TYPE(_readline_array) == IS_ARRAY) { matches = completion_matches(text,_readline_command_generator); } } @@ -423,7 +423,7 @@ PHP_FUNCTION(readline_completion_function) if (_readline_completion) efree(_readline_completion); - _readline_completion = estrdup((*arg)->value.str.val); + _readline_completion = estrdup(Z_STRVAL_PP(arg)); rl_attempted_completion_function = _readline_completion_cb; } diff --git a/ext/recode/recode.c b/ext/recode/recode.c index f9261c9d6e..77e9e8b7f6 100644 --- a/ext/recode/recode.c +++ b/ext/recode/recode.c @@ -125,9 +125,9 @@ PHP_FUNCTION(recode_string) RETURN_FALSE; } - success = recode_scan_request(request, (*req)->value.str.val); + success = recode_scan_request(request, Z_STRVAL_PP(req)); if (!success) { - php_error(E_WARNING, "Illegal recode request '%s'", (*req)->value.str.val); + php_error(E_WARNING, "Illegal recode request '%s'", Z_STRVAL_PP(req)); goto error_exit; } @@ -190,9 +190,9 @@ PHP_FUNCTION(recode_file) RETURN_FALSE; } - success = recode_scan_request(request, (*req)->value.str.val); + success = recode_scan_request(request, Z_STRVAL_PP(req)); if (!success) { - php_error(E_WARNING, "Illegal recode request '%s'", (*req)->value.str.val); + php_error(E_WARNING, "Illegal recode request '%s'", Z_STRVAL_PP(req)); goto error_exit; } diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c index e67084523b..93f296280d 100644 --- a/ext/rpc/com/com_wrapper.c +++ b/ext/rpc/com/com_wrapper.c @@ -433,7 +433,7 @@ PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_di PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) PHP_INI_ENTRY_EX("com.autoregister_verbose", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb) -PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange) +PHP_INI_ENTRY("Z_TYPE(com)lib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange) PHP_INI_END() @@ -467,7 +467,7 @@ PHP_FUNCTION(com_load) zend_get_parameters(ht, 3, &module_name, &server_name, &code_page); convert_to_long_ex(&code_page); - codepage = code_page->value.lval; + codepage = Z_LVAL_P(code_page); break; case 4: @@ -1123,7 +1123,7 @@ PHP_FUNCTION(com_load_typelib) case 2: zend_get_parameters(ht, 2, &arg_typelib, &arg_cis); convert_to_boolean_ex(&arg_cis); - if (arg_cis->value.lval) { + if (Z_LVAL_P(arg_cis)) { mode &= ~CONST_CS; } break; @@ -1171,7 +1171,7 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer 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: if (do_COM_offget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) { FREE_VARIANT(var_result); @@ -1261,7 +1261,7 @@ PHPAPI int php_COM_set_property_handler(zend_property_reference *property_refere for (element=property_reference->elements_list->head; element != property_reference->elements_list->tail; element=element->next) { overloaded_property = (zend_overloaded_element *) element->data; - switch (overloaded_property->type) { + switch (Z_TYPE_P(overloaded_property)) { case OE_IS_ARRAY: if (do_COM_offget(var_result, obj, &overloaded_property->element, FALSE TSRMLS_CC) == FAILURE) { FREE_VARIANT(var_result); @@ -1347,7 +1347,7 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro } property = php_COM_get_property_handler(property_reference); - if (property.type == IS_NULL) { + if (Z_TYPE(property) == IS_NULL) { if (property.refcount == 1) { pval_destructor(&property); } diff --git a/ext/rpc/com/conversion.c b/ext/rpc/com/conversion.c index ea5cde6188..8449e41461 100644 --- a/ext/rpc/com/conversion.c +++ b/ext/rpc/com/conversion.c @@ -199,7 +199,7 @@ PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, SYSTEMTIME wintime; struct tm *phptime; - phptime = gmtime(&(pval_arg->value.lval)); + phptime = gmtime(&(Z_LVAL_P(pval_arg))); memset(&wintime, 0, sizeof(wintime)); wintime.wYear = phptime->tm_year + 1900; @@ -288,14 +288,14 @@ PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, case VT_CY|VT_BYREF: convert_to_double_ex(&pval_arg); - VarCyFromR8(pval_arg->value.dval, var_arg->pcyVal); + VarCyFromR8(Z_DVAL_P(pval_arg), var_arg->pcyVal); break; case VT_DATE|VT_BYREF: { SYSTEMTIME wintime; struct tm *phptime; - phptime = gmtime(&(pval_arg->value.lval)); + phptime = gmtime(&(Z_LVAL_P(pval_arg))); memset(&wintime, 0, sizeof(wintime)); wintime.wYear = phptime->tm_year + 1900; diff --git a/ext/rpc/com/variant.c b/ext/rpc/com/variant.c index 4f521cdd4c..80b48550e6 100644 --- a/ext/rpc/com/variant.c +++ b/ext/rpc/com/variant.c @@ -133,7 +133,7 @@ static void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend zend_get_parameters(ht, 3, &data, &type, &code_page); php_pval_to_variant_ex(data, pVar, type, codepage TSRMLS_CC); convert_to_long(code_page); - codepage = code_page->value.lval; + codepage = Z_LVAL_P(code_page); break; default: ZEND_WRONG_PARAM_COUNT(); @@ -174,13 +174,13 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r ZVAL_FALSE(&result); } else { overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data; - switch (overloaded_property->type) { + switch (Z_TYPE_P(overloaded_property)) { case OE_IS_ARRAY: ZVAL_FALSE(&result); break; case OE_IS_OBJECT: - if (!strcmp(overloaded_property->element.value.str.val, "value")) { + if (!strcmp(overloaded_property->Z_STRVAL(element), "value")) { php_variant_to_pval(var_arg, &result, codepage TSRMLS_CC); } else if (!strcmp(Z_STRVAL(overloaded_property->element), "type")) { ZVAL_LONG(&result, V_VT(var_arg)) diff --git a/ext/rpc/java/java.c b/ext/rpc/java/java.c index 9d8a9ad2e9..0780c4b7b7 100644 --- a/ext/rpc/java/java.c +++ b/ext/rpc/java/java.c @@ -280,37 +280,37 @@ static jobject _java_makeObject(pval* arg TSRMLS_DC) jmethodID makeArg; jclass hashClass; - switch (arg->type) { + switch (Z_TYPE_P(arg)) { case IS_STRING: - result=(*jenv)->NewByteArray(jenv, arg->value.str.len); + result=(*jenv)->NewByteArray(jenv, Z_STRLEN_P(arg)); (*jenv)->SetByteArrayRegion(jenv, (jbyteArray)result, 0, - arg->value.str.len, arg->value.str.val); + Z_STRLEN_P(arg), Z_STRVAL_P(arg)); break; case IS_OBJECT: zend_hash_index_find(Z_OBJPROP_P(arg), 0, (void*)&handle); - result = zend_list_find((*handle)->value.lval, &type); + result = zend_list_find(Z_LVAL_PP(handle), &type); break; case IS_BOOL: makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg", "(Z)Ljava/lang/Object;"); result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg, - (jboolean)(arg->value.lval)); + (jboolean)(Z_LVAL_P(arg))); break; case IS_LONG: makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg", "(J)Ljava/lang/Object;"); result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg, - (jlong)(arg->value.lval)); + (jlong)(Z_LVAL_P(arg))); break; case IS_DOUBLE: makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg", "(D)Ljava/lang/Object;"); result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg, - (jdouble)(arg->value.dval)); + (jdouble)(Z_DVAL_P(arg))); break; case IS_ARRAY: @@ -331,28 +331,28 @@ static jobject _java_makeObject(pval* arg TSRMLS_DC) "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); /* Iterate through hash */ - zend_hash_internal_pointer_reset(arg->value.ht); - while(zend_hash_get_current_data(arg->value.ht, (void**)&value) == SUCCESS) { + zend_hash_internal_pointer_reset(Z_ARRVAL_P(arg)); + while(zend_hash_get_current_data(Z_ARRVAL_P(arg), (void**)&value) == SUCCESS) { jval = _java_makeObject(*value TSRMLS_CC); - switch (zend_hash_get_current_key(arg->value.ht, &string_key, &num_key, 0)) { + switch (zend_hash_get_current_key(Z_ARRVAL_P(arg), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - key.type = IS_STRING; - key.value.str.val = string_key; - key.value.str.len = strlen(string_key); + Z_TYPE(key) = IS_STRING; + Z_STRVAL(key) = string_key; + Z_STRLEN(key) = strlen(string_key); jkey = _java_makeObject(&key TSRMLS_CC); break; case HASH_KEY_IS_LONG: - key.type = IS_LONG; - key.value.lval = num_key; + Z_TYPE(key) = IS_LONG; + Z_LVAL(key) = num_key; jkey = _java_makeObject(&key TSRMLS_CC); break; default: /* HASH_KEY_NON_EXISTANT */ jkey = 0; } jold = (*jenv)->CallObjectMethod(jenv, result, put, jkey, jval); - if ((*value)->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, jval); - zend_hash_move_forward(arg->value.ht); + if (Z_TYPE_PP(value) != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, jval); + zend_hash_move_forward(Z_ARRVAL_P(arg)); } break; @@ -379,7 +379,7 @@ static jobjectArray _java_makeArray(int argc, pval** argv TSRMLS_DC) for (i=0; i<argc; i++) { arg = _java_makeObject(argv[i] TSRMLS_CC); (*jenv)->SetObjectArrayElement(jenv, result, i, arg); - if (argv[i]->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, arg); + if (Z_TYPE_P(argv[i]) != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, arg); } return result; } @@ -387,9 +387,9 @@ static jobjectArray _java_makeArray(int argc, pval** argv TSRMLS_DC) static int checkError(pval *value) { - if (value->type == IS_EXCEPTION) { - php_error(E_WARNING, "%s", value->value.str.val); - efree(value->value.str.val); + if (Z_TYPE_P(value) == IS_EXCEPTION) { + php_error(E_WARNING, "%s", Z_STRVAL_P(value)); + efree(Z_STRVAL_P(value)); ZVAL_FALSE(value); return 1; }; @@ -422,7 +422,7 @@ void java_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_refe if (!JG(jenv)) return; jenv = JG(jenv); - if (!strcmp("java", function_name->element.value.str.val)) { + if (!strcmp("java", function_name->Z_STRVAL(element))) { /* construct a Java object: First argument is the class name. Any additional arguments will @@ -456,8 +456,8 @@ void java_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_refe jmethodID invoke = (*jenv)->GetMethodID(jenv, JG(reflect_class), "Invoke", "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V"); zend_hash_index_find(Z_OBJPROP_P(object), 0, (void**) &handle); - obj = zend_list_find((*handle)->value.lval, &type); - method = (*jenv)->NewStringUTF(jenv, function_name->element.value.str.val); + obj = zend_list_find(Z_LVAL_PP(handle), &type); + method = (*jenv)->NewStringUTF(jenv, function_name->Z_STRVAL(element)); result = (jlong)(long)return_value; (*jenv)->CallVoidMethod(jenv, JG(php_reflect), invoke, @@ -526,14 +526,14 @@ static pval _java_getset_property JNIEnv *jenv; jenv = JG(jenv); - propName = (*jenv)->NewStringUTF(jenv, property->element.value.str.val); + propName = (*jenv)->NewStringUTF(jenv, property->Z_STRVAL(element)); /* get the object */ zend_hash_index_find(Z_OBJPROP_P(property_reference->object), 0, (void **) &pobject); - obj = zend_list_find((*pobject)->value.lval, &type); + obj = zend_list_find(Z_LVAL_PP(pobject), &type); result = (jlong)(long) &presult; - presult.type = IS_NULL; + Z_TYPE(presult) = IS_NULL; if (!obj || (type!=le_jobject)) { php_error(E_ERROR, @@ -651,11 +651,11 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromString jboolean isCopy; jbyte *value = (*jenv)->GetByteArrayElements(jenv, jvalue, &isCopy); pval *presult = (pval*)(long)result; - presult->type=IS_STRING; - presult->value.str.len=(*jenv)->GetArrayLength(jenv, jvalue); - presult->value.str.val=emalloc(presult->value.str.len+1); - memcpy(presult->value.str.val, value, presult->value.str.len); - presult->value.str.val[presult->value.str.len]=0; + Z_TYPE_P(presult)=IS_STRING; + Z_STRLEN_P(presult)=(*jenv)->GetArrayLength(jenv, jvalue); + Z_STRVAL_P(presult)=emalloc(Z_STRLEN_P(presult)+1); + memcpy(Z_STRVAL_P(presult), value, Z_STRLEN_P(presult)); + Z_STRVAL_P(presult)[Z_STRLEN_P(presult)]=0; if (isCopy) (*jenv)->ReleaseByteArrayElements(jenv, jvalue, value, 0); } @@ -663,24 +663,24 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromLong (JNIEnv *jenv, jclass self, jlong result, jlong value) { pval *presult = (pval*)(long)result; - presult->type=IS_LONG; - presult->value.lval=(long)value; + Z_TYPE_P(presult)=IS_LONG; + Z_LVAL_P(presult)=(long)value; } JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromDouble (JNIEnv *jenv, jclass self, jlong result, jdouble value) { pval *presult = (pval*)(long)result; - presult->type=IS_DOUBLE; - presult->value.dval=value; + Z_TYPE_P(presult)=IS_DOUBLE; + Z_DVAL_P(presult)=value; } JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromBoolean (JNIEnv *jenv, jclass self, jlong result, jboolean value) { pval *presult = (pval*)(long)result; - presult->type=IS_BOOL; - presult->value.lval=value; + Z_TYPE_P(presult)=IS_BOOL; + Z_LVAL_P(presult)=value; } JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject @@ -691,15 +691,15 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject pval *handle; TSRMLS_FETCH(); - if (presult->type != IS_OBJECT) { + if (Z_TYPE_P(presult) != IS_OBJECT) { object_init_ex(presult, &java_class_entry); presult->is_ref=1; presult->refcount=1; } ALLOC_ZVAL(handle); - handle->type = IS_LONG; - handle->value.lval = + Z_TYPE_P(handle) = IS_LONG; + Z_LVAL_P(handle) = zend_list_insert((*jenv)->NewGlobalRef(jenv, value), le_jobject); pval_copy_constructor(handle); INIT_PZVAL(handle); @@ -718,7 +718,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement pval *result; pval *handle = (pval*)(long)array; ALLOC_ZVAL(result); - zend_hash_next_index_insert(handle->value.ht, &result, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(handle), &result, sizeof(zval *), NULL); return (jlong)(long)result; } @@ -728,7 +728,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_hashIndexUpdate pval *result; pval *handle = (pval*)(long)array; ALLOC_ZVAL(result); - zend_hash_index_update(handle->value.ht, (unsigned long)key, + zend_hash_index_update(Z_ARRVAL_P(handle), (unsigned long)key, &result, sizeof(zval *), NULL); return (jlong)(long)result; } @@ -741,7 +741,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_hashUpdate pval *handle = (pval*)(long)array; ALLOC_ZVAL(result); Java_net_php_reflect_setResultFromString(jenv, self, (jlong)(long)&pkey, key); - zend_hash_update(handle->value.ht, pkey.value.str.val, pkey.value.str.len+1, + zend_hash_update(Z_ARRVAL_P(handle), Z_STRVAL(pkey), Z_STRLEN(pkey)+1, &result, sizeof(zval *), NULL); return (jlong)(long)result; } @@ -751,7 +751,7 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setException { pval *presult = (pval*)(long)result; Java_net_php_reflect_setResultFromString(jenv, self, result, value); - presult->type=IS_EXCEPTION; + Z_TYPE_P(presult)=IS_EXCEPTION; } JNIEXPORT void JNICALL Java_net_php_reflect_setEnv diff --git a/ext/rpc/xmlrpc/xmlrpc-epi-php.c b/ext/rpc/xmlrpc/xmlrpc-epi-php.c index 589adaad05..21d6c05e30 100644 --- a/ext/rpc/xmlrpc/xmlrpc-epi-php.c +++ b/ext/rpc/xmlrpc/xmlrpc-epi-php.c @@ -281,8 +281,8 @@ static int add_stringl(pval* list, char* id, char* string, uint length, int dupl static int add_pval(pval* list, const char* id, pval** val) { if(list && val) { - if(id) return zend_hash_update(list->value.ht, (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL); - else return zend_hash_next_index_insert(list->value.ht, (void *) val, sizeof(pval **), NULL); + if(id) return zend_hash_update(Z_ARRVAL_P(list), (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL); + else return zend_hash_next_index_insert(Z_ARRVAL_P(list), (void *) val, sizeof(pval **), NULL); } } @@ -311,85 +311,85 @@ static void set_output_options(php_output_options* options, pval* output_opts) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty; options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping | xml_elem_non_ascii_escaping | xml_elem_non_print_escaping; - if(output_opts && output_opts->type == IS_ARRAY) { + if(output_opts && Z_TYPE_P(output_opts) == IS_ARRAY) { pval** val; /* verbosity of generated xml */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), OUTPUT_TYPE_KEY, OUTPUT_TYPE_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, OUTPUT_TYPE_VALUE_PHP)) { + if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_PHP)) { options->b_php_out = 1; } - else if(!strcmp((*val)->value.str.val, OUTPUT_TYPE_VALUE_XML)) { + else if(!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_XML)) { options->b_php_out = 0; } } } /* verbosity of generated xml */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), VERBOSITY_KEY, VERBOSITY_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, VERBOSITY_VALUE_NO_WHITE_SPACE)) { + if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NO_WHITE_SPACE)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_no_white_space; } - else if(!strcmp((*val)->value.str.val, VERBOSITY_VALUE_NEWLINES_ONLY)) { + else if(!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NEWLINES_ONLY)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_newlines_only; } - else if(!strcmp((*val)->value.str.val, VERBOSITY_VALUE_PRETTY)) { + else if(!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_PRETTY)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty; } } } /* version of xml to output */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), VERSION_KEY, VERSION_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, VERSION_VALUE_XMLRPC)) { + if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_XMLRPC)) { options->xmlrpc_out.version = xmlrpc_version_1_0; } - else if(!strcmp((*val)->value.str.val, VERSION_VALUE_SIMPLE)) { + else if(!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_SIMPLE)) { options->xmlrpc_out.version = xmlrpc_version_simple; } } } /* encoding code set */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), ENCODING_KEY, ENCODING_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - options->xmlrpc_out.xml_elem_opts.encoding = estrdup((*val)->value.str.val); + if(Z_TYPE_PP(val) == IS_STRING) { + options->xmlrpc_out.xml_elem_opts.encoding = estrdup(Z_STRVAL_PP(val)); } } /* escaping options */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), ESCAPING_KEY, ESCAPING_KEY_LEN + 1, (void**)&val) == SUCCESS) { /* multiple values allowed. check if array */ - if((*val)->type == IS_ARRAY) { + if(Z_TYPE_PP(val) == IS_ARRAY) { pval** iter_val; - zend_hash_internal_pointer_reset((*val)->value.ht); + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(val)); options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_no_escaping; while(1) { - if(zend_hash_get_current_data((*val)->value.ht, (void**)&iter_val) == SUCCESS) { - if((*iter_val)->type == IS_STRING && (*iter_val)->value.str.val) { - if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_CDATA)) { + if(zend_hash_get_current_data(Z_ARRVAL_PP(val), (void**)&iter_val) == SUCCESS) { + if(Z_TYPE_PP(iter_val) == IS_STRING && Z_STRVAL_PP(iter_val)) { + if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_CDATA)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_cdata_escaping; } - else if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_NON_ASCII)) { + else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_ASCII)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_ascii_escaping; } - else if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_NON_PRINT)) { + else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_PRINT)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_print_escaping; } - else if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_MARKUP)) { + else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_MARKUP)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_markup_escaping; } } @@ -398,21 +398,21 @@ static void set_output_options(php_output_options* options, pval* output_opts) { break; } - zend_hash_move_forward((*val)->value.ht); + zend_hash_move_forward(Z_ARRVAL_PP(val)); } } /* else, check for single value */ - else if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_CDATA)) { + else if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_CDATA)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_cdata_escaping; } - else if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_NON_ASCII)) { + else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_ASCII)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_ascii_escaping; } - else if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_NON_PRINT)) { + else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_PRINT)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_print_escaping; } - else if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_MARKUP)) { + else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_MARKUP)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping; } } @@ -471,32 +471,32 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker(const char* key, pval* in_val, int dept if(val) { switch(type) { case xmlrpc_base64: - if(val->type == IS_NULL) { + if(Z_TYPE_P(val) == IS_NULL) { xReturn = XMLRPC_CreateValueBase64(key, "", 1); } else { - xReturn = XMLRPC_CreateValueBase64(key, val->value.str.val, val->value.str.len); + xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL_P(val), Z_STRLEN_P(val)); } break; case xmlrpc_datetime: convert_to_string(val); - xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, val->value.str.val); + xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, Z_STRVAL_P(val)); break; case xmlrpc_boolean: convert_to_boolean(val); - xReturn = XMLRPC_CreateValueBoolean(key, val->value.lval); + xReturn = XMLRPC_CreateValueBoolean(key, Z_LVAL_P(val)); break; case xmlrpc_int: convert_to_long(val); - xReturn = XMLRPC_CreateValueInt(key, val->value.lval); + xReturn = XMLRPC_CreateValueInt(key, Z_LVAL_P(val)); break; case xmlrpc_double: convert_to_double(val); - xReturn = XMLRPC_CreateValueDouble(key, val->value.dval); + xReturn = XMLRPC_CreateValueDouble(key, Z_DVAL_P(val)); break; case xmlrpc_string: convert_to_string(val); - xReturn = XMLRPC_CreateValueString(key, val->value.str.val, val->value.str.len); + xReturn = XMLRPC_CreateValueString(key, Z_STRVAL_P(val), Z_STRLEN_P(val)); break; case xmlrpc_vector: { @@ -506,13 +506,13 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker(const char* key, pval* in_val, int dept convert_to_array(val); - xReturn = XMLRPC_CreateVector(key, determine_vector_type(val->value.ht)); + xReturn = XMLRPC_CreateVector(key, determine_vector_type(Z_ARRVAL_P(val))); - zend_hash_internal_pointer_reset(val->value.ht); + zend_hash_internal_pointer_reset(Z_ARRVAL_P(val)); while(1) { - int res = my_zend_hash_get_current_key(val->value.ht, &my_key, &num_index); + int res = my_zend_hash_get_current_key(Z_ARRVAL_P(val), &my_key, &num_index); if(res == HASH_KEY_IS_LONG) { - if(zend_hash_get_current_data(val->value.ht, (void**)&pIter) == SUCCESS) { + if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) { XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(0, *pIter, depth++)); } } @@ -520,12 +520,12 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker(const char* key, pval* in_val, int dept break; } else if(res == HASH_KEY_IS_STRING) { - if(zend_hash_get_current_data(val->value.ht, (void**)&pIter) == SUCCESS) { + if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) { XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(my_key, *pIter, depth++)); } } - zend_hash_move_forward(val->value.ht); + zend_hash_move_forward(Z_ARRVAL_P(val)); } } break; @@ -554,39 +554,39 @@ static pval* XMLRPC_to_PHP(XMLRPC_VALUE el) { switch(type) { case xmlrpc_empty: - elem->type = IS_NULL; + Z_TYPE_P(elem) = IS_NULL; break; case xmlrpc_string: pStr = XMLRPC_GetValueString(el); if(pStr) { - elem->value.str.len = XMLRPC_GetValueStringLen(el); - elem->value.str.val = estrndup(pStr, elem->value.str.len); - elem->type = IS_STRING; + Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); + Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem)); + Z_TYPE_P(elem) = IS_STRING; } break; case xmlrpc_int: - elem->value.lval = XMLRPC_GetValueInt(el); - elem->type = IS_LONG; + Z_LVAL_P(elem) = XMLRPC_GetValueInt(el); + Z_TYPE_P(elem) = IS_LONG; break; case xmlrpc_boolean: - elem->value.lval = XMLRPC_GetValueBoolean(el); - elem->type = IS_BOOL; + Z_LVAL_P(elem) = XMLRPC_GetValueBoolean(el); + Z_TYPE_P(elem) = IS_BOOL; break; case xmlrpc_double: - elem->value.dval = XMLRPC_GetValueDouble(el); - elem->type = IS_DOUBLE; + Z_DVAL_P(elem) = XMLRPC_GetValueDouble(el); + Z_TYPE_P(elem) = IS_DOUBLE; break; case xmlrpc_datetime: - elem->value.str.len = XMLRPC_GetValueStringLen(el); - elem->value.str.val = estrndup(XMLRPC_GetValueDateTime_ISO8601(el), elem->value.str.len); - elem->type = IS_STRING; + Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); + Z_STRVAL_P(elem) = estrndup(XMLRPC_GetValueDateTime_ISO8601(el), Z_STRLEN_P(elem)); + Z_TYPE_P(elem) = IS_STRING; break; case xmlrpc_base64: pStr = XMLRPC_GetValueBase64(el); if(pStr) { - elem->value.str.len = XMLRPC_GetValueStringLen(el); - elem->value.str.val = estrndup(pStr, elem->value.str.len); - elem->type = IS_STRING; + Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); + Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem)); + Z_TYPE_P(elem) = IS_STRING; } break; case xmlrpc_vector: @@ -630,14 +630,14 @@ PHP_FUNCTION(xmlrpc_encode_request) { if(xRequest) { XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out); - if(method->type == IS_NULL) { + if(Z_TYPE_P(method) == IS_NULL) { XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response); } else { - XMLRPC_RequestSetMethodName(xRequest, method->value.str.val); + XMLRPC_RequestSetMethodName(xRequest, Z_STRVAL_P(method)); XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call); } - if(vals->type != IS_NULL) { + if(Z_TYPE_P(vals) != IS_NULL) { XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals)); } @@ -690,10 +690,10 @@ pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_o pval* retval = NULL; XMLRPC_REQUEST response; STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {0}; - opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(encoding_in->value.str.val) : ENCODING_DEFAULT; + opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT; /* generate XMLRPC_REQUEST from raw xml */ - response = XMLRPC_REQUEST_FromXML(xml_in->value.str.val, xml_in->value.str.len, &opts); + response = XMLRPC_REQUEST_FromXML(Z_STRVAL_P(xml_in), Z_STRLEN_P(xml_in), &opts); if(response) { /* convert xmlrpc data to native php types */ retval = XMLRPC_to_PHP(XMLRPC_RequestGetData(response)); @@ -701,9 +701,9 @@ pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_o if(XMLRPC_RequestGetRequestType(response) == xmlrpc_request_call) { if(method_name_out) { convert_to_string(method_name_out); - method_name_out->type = IS_STRING; - method_name_out->value.str.val = estrdup(XMLRPC_RequestGetMethodName(response)); - method_name_out->value.str.len = strlen(method_name_out->value.str.val); + Z_TYPE_P(method_name_out) = IS_STRING; + Z_STRVAL_P(method_name_out) = estrdup(XMLRPC_RequestGetMethodName(response)); + Z_STRLEN_P(method_name_out) = strlen(Z_STRVAL_P(method_name_out)); } } @@ -866,15 +866,15 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data; MAKE_STD_ZVAL(retval_ptr); - retval_ptr->type = IS_NULL; + Z_TYPE_P(retval_ptr) = IS_NULL; /* setup data hoojum */ callback_params[0] = pData->caller_params; /* loop through and call all registered callbacks */ - zend_hash_internal_pointer_reset(pData->server->introspection_map->value.ht); + zend_hash_internal_pointer_reset(pData->server->Z_ARRVAL_P(introspection_map)); while(1) { - if(zend_hash_get_current_data(pData->server->introspection_map->value.ht, + if(zend_hash_get_current_data(pData->server->Z_ARRVAL_P(introspection_map), (void**)&php_function) == SUCCESS) { /* php func prototype: function string user_func($user_params) */ @@ -886,11 +886,11 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) /* return value should be a string */ convert_to_string(retval_ptr); - xData = XMLRPC_IntrospectionCreateDescription(retval_ptr->value.str.val, &err); + xData = XMLRPC_IntrospectionCreateDescription(Z_STRVAL_P(retval_ptr), &err); if(xData) { if(!XMLRPC_ServerAddIntrospectionData(server, xData)) { - zend_error(E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", (*php_function)->value.str.val); + zend_error(E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", Z_STRVAL_PP(php_function)); } XMLRPC_CleanupValue(xData); } @@ -898,28 +898,28 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) /* could not create description */ if(err.xml_elem_error.parser_code) { zend_error(E_WARNING, "xml parse error: [line %i, column %i, message: %s] Unable to add introspection data returned from %s()", - err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, (*php_function)->value.str.val); + err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, Z_STRVAL_PP(php_function)); } else { zend_error(E_WARNING, "Unable to add introspection data returned from %s()", - (*php_function)->value.str.val); + Z_STRVAL_PP(php_function)); } } } else { /* user func failed */ - zend_error(E_WARNING, "Error calling user introspection callback: %s()", (*php_function)->value.str.val); + zend_error(E_WARNING, "Error calling user introspection callback: %s()", Z_STRVAL_PP(php_function)); } } else { break; } - zend_hash_move_forward(pData->server->introspection_map->value.ht); + zend_hash_move_forward(pData->server->Z_ARRVAL_P(introspection_map)); } /* so we don't call the same callbacks ever again */ - zend_hash_clean(pData->server->introspection_map->value.ht); + zend_hash_clean(pData->server->Z_ARRVAL_P(introspection_map)); } /* {{{ proto boolean xmlrpc_server_register_method(handle server, string method_name, string function) @@ -935,20 +935,20 @@ PHP_FUNCTION(xmlrpc_server_register_method) { WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if(type == XMLRPCG(le_xmlrpc_server)) { /* register with C engine. every method just calls our standard callback, * and it then dispatches to php as necessary */ - if(XMLRPC_ServerRegisterMethod(server->server_ptr, method_key->value.str.val, php_xmlrpc_callback)) { + if(XMLRPC_ServerRegisterMethod(server->server_ptr, Z_STRVAL_P(method_key), php_xmlrpc_callback)) { /* save for later use */ MAKE_STD_ZVAL(method_name_save); *method_name_save = *method_name; zval_copy_ctor(method_name_save); /* register our php method */ - add_pval(server->method_map, method_key->value.str.val, &method_name_save); + add_pval(server->method_map, Z_STRVAL_P(method_key), &method_name_save); RETURN_BOOL(1); } @@ -970,7 +970,7 @@ PHP_FUNCTION(xmlrpc_server_register_introspection_callback) { WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if(type == XMLRPCG(le_xmlrpc_server)) { { @@ -1022,14 +1022,14 @@ PHP_FUNCTION(xmlrpc_server_call_method) { WRONG_PARAM_COUNT; } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if(type == XMLRPCG(le_xmlrpc_server)) { /* HACK: use output encoding for now */ input_opts.xml_elem_opts.encoding = utf8_get_encoding_id_from_string(out.xmlrpc_out.xml_elem_opts.encoding); /* generate an XMLRPC_REQUEST from the raw xml input */ - xRequest = XMLRPC_REQUEST_FromXML(rawxml->value.str.val, rawxml->value.str.len, &input_opts); + xRequest = XMLRPC_REQUEST_FromXML(Z_STRVAL_P(rawxml), Z_STRLEN_P(rawxml), &input_opts); if(xRequest) { @@ -1039,21 +1039,21 @@ PHP_FUNCTION(xmlrpc_server_call_method) { XMLRPC_VALUE xAnswer = NULL; MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */ MAKE_STD_ZVAL(data.return_data); - data.return_data->type = IS_NULL; /* in case value is never init'd, we don't dtor to think it is a string or something */ - data.xmlrpc_method->type = IS_NULL; + data.Z_TYPE_P(return_data) = IS_NULL; /* in case value is never init'd, we don't dtor to think it is a string or something */ + data.Z_TYPE_P(xmlrpc_method) = IS_NULL; /* setup some data to pass to the callback function */ - data.xmlrpc_method->value.str.val = estrdup(XMLRPC_RequestGetMethodName(xRequest)); - data.xmlrpc_method->value.str.len = strlen(data.xmlrpc_method->value.str.val); - data.xmlrpc_method->type = IS_STRING; + data.Z_STRVAL_P(xmlrpc_method) = estrdup(XMLRPC_RequestGetMethodName(xRequest)); + data.Z_STRLEN_P(xmlrpc_method) = strlen(data.Z_STRVAL_P(xmlrpc_method)); + data.Z_TYPE_P(xmlrpc_method) = IS_STRING; data.caller_params = caller_params; data.php_executed = 0; data.server = server; /* check if the called method has been previous registered */ - if(zend_hash_find(server->method_map->value.ht, - data.xmlrpc_method->value.str.val, - data.xmlrpc_method->value.str.len + 1, + if(zend_hash_find(server->Z_ARRVAL_P(method_map), + data.Z_STRVAL_P(xmlrpc_method), + data.Z_STRLEN_P(xmlrpc_method) + 1, (void**)&php_function) == SUCCESS) { data.php_function = *php_function; @@ -1135,7 +1135,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) { WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if (type == XMLRPCG(le_xmlrpc_server)) { XMLRPC_VALUE xDesc = PHP_to_XMLRPC(desc); @@ -1274,19 +1274,19 @@ int set_pval_xmlrpc_type(pval* value, XMLRPC_VALUE_TYPE type) { /* we only really care about strings because they can represent * base64 and datetime. all other types have corresponding php types */ - if(value->type == IS_STRING) { + if(Z_TYPE_P(value) == IS_STRING) { if(type == xmlrpc_base64 || type == xmlrpc_datetime) { const char* typestr = xmlrpc_type_as_str(type, xmlrpc_vector_none); pval* type; MAKE_STD_ZVAL(type); - type->type = IS_STRING; - type->value.str.val = estrdup(typestr); - type->value.str.len = strlen(typestr); + Z_TYPE_P(type) = IS_STRING; + Z_STRVAL_P(type) = estrdup(typestr); + Z_STRLEN_P(type) = strlen(typestr); convert_to_object(value); - bSuccess = zend_hash_update(value->value.obj.properties, OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL); + bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL); } } @@ -1298,7 +1298,7 @@ XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue) { XMLRPC_VALUE_TYPE type = xmlrpc_none; if(value) { - switch(value->type) { + switch(Z_TYPE_P(value)) { case IS_NULL: type = xmlrpc_base64; break; @@ -1333,11 +1333,11 @@ XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue) { pval** attr; type = xmlrpc_vector; - if(zend_hash_find(value->value.obj.properties, + if(zend_hash_find(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void**)&attr) == SUCCESS) { - if((*attr)->type == IS_STRING) { - type = xmlrpc_str_as_type((*attr)->value.str.val); + if(Z_TYPE_PP(attr) == IS_STRING) { + type = xmlrpc_str_as_type(Z_STRVAL_PP(attr)); } } break; @@ -1347,8 +1347,8 @@ XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue) { /* if requested, return an unmolested (magic removed) copy of the value */ if(newvalue) { pval** val; - if( (type == xmlrpc_base64 && value->type != IS_NULL) || type == xmlrpc_datetime) { - if(zend_hash_find(value->value.obj.properties, + if( (type == xmlrpc_base64 && Z_TYPE_P(value) != IS_NULL) || type == xmlrpc_datetime) { + if(zend_hash_find(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR), (void**)&val) == SUCCESS) { *newvalue = *val; @@ -1380,14 +1380,14 @@ PHP_FUNCTION(xmlrpc_set_type) { #endif convert_to_string(type); - vtype = xmlrpc_str_as_type(type->value.str.val); + vtype = xmlrpc_str_as_type(Z_STRVAL_P(type)); if(vtype != xmlrpc_none) { if(set_pval_xmlrpc_type(arg, vtype) == SUCCESS) { RETURN_TRUE; } } else { - zend_error(E_WARNING,"invalid type '%s' passed to xmlrpc_set_type()", type->value.str.val); + zend_error(E_WARNING,"invalid type '%s' passed to xmlrpc_set_type()", Z_STRVAL_P(type)); } RETURN_FALSE; } @@ -1405,7 +1405,7 @@ PHP_FUNCTION(xmlrpc_get_type) { type = get_pval_xmlrpc_type(arg, 0); if(type == xmlrpc_vector) { - vtype = determine_vector_type(arg->value.ht); + vtype = determine_vector_type(Z_ARRVAL_P(arg)); } RETURN_STRING((char*)xmlrpc_type_as_str(type, vtype), 1); diff --git a/ext/sablot/sablot.c b/ext/sablot/sablot.c index bd681486f8..db07139f2f 100644 --- a/ext/sablot/sablot.c +++ b/ext/sablot/sablot.c @@ -829,7 +829,7 @@ PHP_FUNCTION(xslt_set_sax_handler) WRONG_PARAM_COUNT; } - if ((*handlers)->type != IS_ARRAY) { + if (Z_TYPE_PP(handlers) != IS_ARRAY) { php_error(E_ERROR, "The second parameter must be an array"); } @@ -894,7 +894,7 @@ PHP_FUNCTION(xslt_set_scheme_handler) WRONG_PARAM_COUNT; } - if ((*handlers)->type != IS_ARRAY) { + if (Z_TYPE_PP(handlers) != IS_ARRAY) { php_error(E_ERROR, "The second parameter must be an array"); } @@ -1520,7 +1520,7 @@ static int _php_sablot_sh_getAll(void *userData, SablotHandle p, const char *sch argc, argv TSRMLS_CC) == FAILURE) { php_error(E_WARNING, "Sorry couldn't call function, %s, with handler of type %s", - handle->getAllHandler->value.str.val, "Scheme GetALL"); + handle->getAllHZ_STRVAL_P(andler), "Scheme GetALL"); } zval_dtor(retval); diff --git a/ext/satellite/class.c b/ext/satellite/class.c index 959498e661..12845e11c1 100644 --- a/ext/satellite/class.c +++ b/ext/satellite/class.c @@ -61,7 +61,7 @@ void orbit_class_function_call( /* constructor or normal function? */ if (zend_llist_count(pPropertyReference->elements_list) == 1 - && !strcasecmp(function_name->element.value.str.val, pClass->name)) + && !strcasecmp(function_name->Z_STRVAL(element), pClass->name)) { /* constructor */ if (pConstructor) @@ -96,7 +96,7 @@ void orbit_class_function_call( } /* pval * return_value is a part of INTERNAL_FUNCTION_PARAMETERS */ - (*pCallFunction)(p_data, function_name->element.value.str.val, + (*pCallFunction)(p_data, function_name->Z_STRVAL(element), ZEND_NUM_ARGS(), arguments, return_value); } else @@ -130,8 +130,8 @@ void orbit_save_data(zval * php_object, int type, void * data) */ ALLOC_ZVAL(orbit_data_handle); /* allocate memory for value */ - orbit_data_handle->type = IS_LONG; - orbit_data_handle->value.lval = id; + Z_TYPE_P(orbit_data_handle) = IS_LONG; + Z_LVAL_P(orbit_data_handle) = id; pval_copy_constructor(orbit_data_handle); /* why? */ @@ -172,7 +172,7 @@ void * orbit_retrieve_data(const zval * php_object, int wanted_type) /* get corba data */ data = zend_list_find( - (*orbit_data_handle)->value.lval, /* id */ + Z_LVAL_PP(orbit_data_handle), /* id */ &type /* type */ ); diff --git a/ext/satellite/namedvalue_to_zval.c b/ext/satellite/namedvalue_to_zval.c index e024daf56a..6e55fd88c6 100644 --- a/ext/satellite/namedvalue_to_zval.c +++ b/ext/satellite/namedvalue_to_zval.c @@ -113,13 +113,13 @@ static zend_bool satellite_any_to_zval_sequence( /* set zval members */ #if 0 - pDestination->type = IS_ARRAY; + pDZ_TYPE_P(estination) = IS_ARRAY; pDestination->refcount = 1; - pDestination->value.ht = orbit_new(HashTable); + pDZ_ARRVAL_P(estination) = orbit_new(HashTable); zend_hash_init( - pDestination->value.ht, /* hash table */ + pDZ_ARRVAL_P(estination), /* hash table */ 0, /* size */ NULL, /* hash function */ ZVAL_PTR_DTOR, /* destructor */ @@ -153,7 +153,7 @@ static zend_bool satellite_any_to_zval_sequence( /* add to hashtable */ INIT_PZVAL(p_destination_item); /* testing! */ zend_hash_next_index_insert( - pDestination->value.ht, + pDZ_ARRVAL_P(estination), &p_destination_item, sizeof(zval *), NULL); diff --git a/ext/satellite/object.c b/ext/satellite/object.c index c0466a945e..45aac9ecaf 100644 --- a/ext/satellite/object.c +++ b/ext/satellite/object.c @@ -148,12 +148,12 @@ static zend_bool OrbitObject_InitializeData(OrbitObject * pObject, const char * /* find type info */ pObject->mpInterface = - TypeManager_FindInterface(pObject->mCorbaObject->type_id); + TypeManager_FindInterface(pObject->mCorbaOZ_TYPE_P(bject)_id); if (pObject->mpInterface == NULL) { zend_error(E_WARNING, "(Satellite) unknown interface '%s'", - pObject->mCorbaObject->type_id); + pObject->mCorbaOZ_TYPE_P(bject)_id); /* TODO: set exception */ goto error; } @@ -188,7 +188,7 @@ static void OrbitObject_Wakeup(INTERNAL_FUNCTION_PARAMETERS) goto error; } - if ((*pp_ior)->type != IS_STRING) + if (Z_TYPE_PP(pp_ior) != IS_STRING) { /* TODO: set exception */ goto error; @@ -197,7 +197,7 @@ static void OrbitObject_Wakeup(INTERNAL_FUNCTION_PARAMETERS) /* initialize data */ if (!OrbitObject_InitializeData( p_object, - (*pp_ior)->value.str.val)) + Z_STRVAL_PP(pp_ior))) { goto error; } @@ -233,12 +233,12 @@ zend_bool OrbitObject_Create(CORBA_Object source, zval * pDestination) /* find type info */ p_object->mpInterface = - TypeManager_FindInterface(p_object->mCorbaObject->type_id); + TypeManager_FindInterface(p_object->mCorbaOZ_TYPE_P(bject)_id); if (p_object->mpInterface == NULL) { zend_error(E_WARNING, "(Satellite) unknown interface '%s'", - p_object->mCorbaObject->type_id); + p_object->mCorbaOZ_TYPE_P(bject)_id); goto error; } @@ -511,7 +511,7 @@ zend_bool OrbitObject_CallFunction(OrbitObject * pObject, { /* no such operation */ zend_error(E_WARNING, "(Satellite) unknown operation name '%s' in interface '%s'", - pFunctionName, pObject->mCorbaObject->type_id); + pFunctionName, pObject->mCorbaOZ_TYPE_P(bject)_id); goto error; } @@ -660,7 +660,7 @@ zend_bool OrbitObject_PutProperty(OrbitObject * pObject, /*printf("InterfaceType_FindAttribute failed for property %s\n", pPropertyName);*/ /* no such atttribute */ zend_error(E_WARNING, "(Satellite) unknown attribute name '%s' in interface '%s'", - pPropertyName, pObject->mCorbaObject->type_id); + pPropertyName, pObject->mCorbaOZ_TYPE_P(bject)_id); goto OrbitObject_PutProperty_error; } @@ -776,7 +776,7 @@ zend_bool OrbitObject_GetProperty(OrbitObject * pObject, /*printf("InterfaceType_FindAttribute failed for property %s\n", pPropertyName);*/ /* no such atttribute */ zend_error(E_WARNING, "(Satellite) unknown attribute name '%s' in interface '%s'", - pPropertyName, pObject->mCorbaObject->type_id); + pPropertyName, pObject->mCorbaOZ_TYPE_P(bject)_id); goto OrbitObject_GetProperty_error; } diff --git a/ext/satellite/php_orbit.c b/ext/satellite/php_orbit.c index 7fa82a6aca..745160abb7 100644 --- a/ext/satellite/php_orbit.c +++ b/ext/satellite/php_orbit.c @@ -147,12 +147,12 @@ PHP_FUNCTION(satellite_load_idl) getParameters(ht, 1, &p_parameter); - if (p_parameter->type != IS_STRING) + if (Z_TYPE_P(p_parameter) != IS_STRING) { RETURN_NULL(); } - RETURN_BOOL(TypeManager_LoadFile(p_parameter->value.str.val)); + RETURN_BOOL(TypeManager_LoadFile(Z_STRVAL_P(p_parameter))); } /* diff --git a/ext/satellite/typecode.c b/ext/satellite/typecode.c index 7a3544e567..e8da2ff720 100644 --- a/ext/satellite/typecode.c +++ b/ext/satellite/typecode.c @@ -141,9 +141,9 @@ static CORBA_StructMemberSeq * orbit_create_member_sequence(IDL_tree member_list char * p_name = IDL_IDENT(IDL_LIST(declaration).data).str; p_members->_buffer[i].name = CORBA_string_dup(p_name); - p_members->_buffer[i].type = (CORBA_TypeCode) + p_members->Z_TYPE(_buffer[i]) = (CORBA_TypeCode) CORBA_Object_duplicate((CORBA_Object)type_code, orbit_get_environment()); - p_members->_buffer[i].type_def = NULL; /* XXX */ + p_members->Z_TYPE(_buffer[i])_def = NULL; /* XXX */ i++; } while ((declaration = IDL_LIST(declaration).next)); diff --git a/ext/satellite/zval_to_namedvalue.c b/ext/satellite/zval_to_namedvalue.c index bfd222c13f..887f4b0eac 100644 --- a/ext/satellite/zval_to_namedvalue.c +++ b/ext/satellite/zval_to_namedvalue.c @@ -49,10 +49,10 @@ static zend_bool satellite_zval_to_namedvalue_boolean(const zval * pSource, if (pSource == NULL) return TRUE; - if (pSource->type != IS_BOOL && pSource->type != IS_LONG) + if (pSZ_TYPE_P(ource) != IS_BOOL && pSZ_TYPE_P(ource) != IS_LONG) return FALSE; - *p_value = pSource->value.lval != 0; + *p_value = pSZ_LVAL_P(ource) != 0; return TRUE; } @@ -72,10 +72,10 @@ static zend_bool satellite_zval_to_namedvalue_double(const zval * pSource, return TRUE; /*convert_to_double(pSource);*/ - if (pSource->type != IS_DOUBLE) + if (pSZ_TYPE_P(ource) != IS_DOUBLE) return FALSE; - *p_value = pSource->value.dval; + *p_value = pSZ_DVAL_P(ource); return TRUE; } @@ -93,10 +93,10 @@ static zend_bool satellite_zval_to_namedvalue_long(const zval * pSource, return TRUE; convert_to_long((zval*)pSource); /* so long "const" */ - if (pSource->type != IS_LONG) + if (pSZ_TYPE_P(ource) != IS_LONG) return FALSE; - *p_value = pSource->value.lval; + *p_value = pSZ_LVAL_P(ource); return TRUE; } @@ -114,13 +114,13 @@ static zend_bool satellite_zval_to_namedvalue_short(const zval * pSource, return TRUE; /* convert_to_long((zval *)pSource);*/ /* discard const */; - if (pSource->type != IS_LONG) + if (pSZ_TYPE_P(ource) != IS_LONG) { -/* printf("source value type is %i in satellite_zval_to_namedvalue_short\n", pSource->type);*/ +/* printf("source value type is %i in satellite_zval_to_namedvalue_short\n", pSZ_TYPE_P(ource));*/ return FALSE; } - *p_value = pSource->value.lval; + *p_value = pSZ_LVAL_P(ource); return TRUE; } @@ -141,7 +141,7 @@ static zend_bool satellite_zval_to_namedvalue_objref(const zval * pSource, if (pSource == NULL) return TRUE; /* nothing else to do */ - if (pSource->type != IS_OBJECT) + if (pSZ_TYPE_P(ource) != IS_OBJECT) goto error; /* see that it's a corba object */ @@ -163,7 +163,7 @@ static zend_bool satellite_zval_to_namedvalue_objref(const zval * pSource, goto error; } -/* printf("satellite_zval_to_namedvalue_objref: %s\n", (*p_value)->type_id);*/ +/* printf("satellite_zval_to_namedvalue_objref: %s\n", Z_TYPE_PP(p_value)_id);*/ return TRUE; @@ -187,10 +187,10 @@ static zend_bool satellite_zval_to_namedvalue_sequence(const zval * pSource, if (pSource == NULL) return TRUE; /* nothing to do */ - if (pSource->type != IS_ARRAY) + if (pSZ_TYPE_P(ource) != IS_ARRAY) goto error; /* bad source type */ - p_hashtable = pSource->value.ht; + p_hashtable = pSZ_ARRVAL_P(ource); member_count = zend_hash_num_elements(p_hashtable); /* prepare sequence octet */ @@ -268,14 +268,14 @@ static zend_bool satellite_zval_to_namedvalue_string(const zval * pSource, #if 0 convert_to_string((zval *)pSource); /* discard const */ - if (pSource->type == IS_NULL) + if (pSZ_TYPE_P(ource) == IS_NULL) return TRUE; /* do nothing */ #endif - if (pSource->type != IS_STRING) + if (pSZ_TYPE_P(ource) != IS_STRING) goto error; - *p_value = CORBA_string_dup(pSource->value.str.val); + *p_value = CORBA_string_dup(pSZ_STRVAL_P(ource)); pDestination->len = strlen(*p_value); return TRUE; @@ -304,7 +304,7 @@ static zend_bool satellite_zval_to_namedvalue_struct(const zval * pSource, return TRUE; /* see that it's an object */ - if (pSource->type != IS_OBJECT) + if (pSZ_TYPE_P(ource) != IS_OBJECT) goto error; /* bad source type */ /* see that it's a structure object */ diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 33af3a43e6..f064fdc0c8 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -29,25 +29,25 @@ ps_module ps_mod_user = { #define SESS_ZVAL_LONG(val, a) \ { \ MAKE_STD_ZVAL(a); \ - a->type = IS_LONG; \ - a->value.lval = val; \ + Z_TYPE_P(a) = IS_LONG; \ + Z_LVAL_P(a) = val; \ } #define SESS_ZVAL_STRING(vl, a) \ { \ int len = strlen(vl); \ MAKE_STD_ZVAL(a); \ - a->type = IS_STRING; \ - a->value.str.len = len; \ - a->value.str.val = estrndup(vl, len); \ + Z_TYPE_P(a) = IS_STRING; \ + Z_STRLEN_P(a) = len; \ + Z_STRVAL_P(a) = estrndup(vl, len); \ } #define SESS_ZVAL_STRINGN(vl, ln, a) \ { \ MAKE_STD_ZVAL(a); \ - a->type = IS_STRING; \ - a->value.str.len = ln; \ - a->value.str.val = estrndup(vl, ln); \ + Z_TYPE_P(a) = IS_STRING; \ + Z_STRLEN_P(a) = ln; \ + Z_STRVAL_P(a) = estrndup(vl, ln); \ } @@ -83,7 +83,7 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv) #define FINISH \ if (retval) { \ convert_to_long(retval); \ - ret = retval->value.lval; \ + ret = Z_LVAL_P(retval); \ zval_ptr_dtor(&retval); \ } \ return ret @@ -127,9 +127,9 @@ PS_READ_FUNC(user) retval = ps_call_handler(PSF(read), 1, args); if (retval) { - if (retval->type == IS_STRING) { - *val = estrndup(retval->value.str.val, retval->value.str.len); - *vallen = retval->value.str.len; + if (Z_TYPE_P(retval) == IS_STRING) { + *val = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + *vallen = Z_STRLEN_P(retval); ret = SUCCESS; } zval_ptr_dtor(&retval); diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index fe480f2480..93efcd4d41 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -137,16 +137,16 @@ PHP_FUNCTION(shmop_open) shmop = emalloc(sizeof(struct php_shmop)); memset(shmop, 0, sizeof(struct php_shmop)); - shmop->key = (*key)->value.lval; - shmop->shmflg |= (*mode)->value.lval; + shmop->key = Z_LVAL_PP(key); + shmop->shmflg |= Z_LVAL_PP(mode); - if (memchr((*flags)->value.str.val, 'a', (*flags)->value.str.len)) { + if (memchr(Z_STRVAL_PP(flags), 'a', Z_STRLEN_PP(flags))) { shmflg = SHM_RDONLY; shmop->shmflg |= IPC_EXCL; } - else if (memchr((*flags)->value.str.val, 'c', (*flags)->value.str.len)) { + else if (memchr(Z_STRVAL_PP(flags), 'c', Z_STRLEN_PP(flags))) { shmop->shmflg |= IPC_CREAT; - shmop->size = (*size)->value.lval; + shmop->size = Z_LVAL_PP(size); } else { php_error(E_WARNING, "shmopen: access mode invalid"); @@ -200,30 +200,30 @@ PHP_FUNCTION(shmop_read) convert_to_long_ex(start); convert_to_long_ex(count); - shmop = zend_list_find((*shmid)->value.lval, &type); + shmop = zend_list_find(Z_LVAL_PP(shmid), &type); if (!shmop) { php_error(E_WARNING, "shmread: can't find this segment"); RETURN_FALSE; } - if ((*start)->value.lval < 0 || (*start)->value.lval > shmop->size) { + if (Z_LVAL_PP(start) < 0 || Z_LVAL_PP(start) > shmop->size) { php_error(E_WARNING, "shmread: start is out of range"); RETURN_FALSE; } - if (((*start)->value.lval+(*count)->value.lval) > shmop->size) { + if ((Z_LVAL_PP(start)+Z_LVAL_PP(count)) > shmop->size) { php_error(E_WARNING, "shmread: count is out of range"); RETURN_FALSE; } - if ((*count)->value.lval < 0 ){ + if (Z_LVAL_PP(count) < 0 ){ php_error(E_WARNING, "shmread: count is out of range"); RETURN_FALSE; } - startaddr = shmop->addr + (*start)->value.lval; - bytes = (*count)->value.lval ? (*count)->value.lval : shmop->size-(*start)->value.lval; + startaddr = shmop->addr + Z_LVAL_PP(start); + bytes = Z_LVAL_PP(count) ? Z_LVAL_PP(count) : shmop->size-Z_LVAL_PP(start); return_string = emalloc(bytes); memcpy(return_string, startaddr, bytes); @@ -244,13 +244,13 @@ PHP_FUNCTION(shmop_close) WRONG_PARAM_COUNT; } - shmop = zend_list_find((*shmid)->value.lval, &type); + shmop = zend_list_find(Z_LVAL_PP(shmid), &type); if (!shmop) { php_error(E_WARNING, "shmclose: no such shmid"); RETURN_FALSE; } - zend_list_delete((*shmid)->value.lval); + zend_list_delete(Z_LVAL_PP(shmid)); } /* }}} */ @@ -268,7 +268,7 @@ PHP_FUNCTION(shmop_size) convert_to_long_ex(shmid); - shmop = zend_list_find((*shmid)->value.lval, &type); + shmop = zend_list_find(Z_LVAL_PP(shmid), &type); if (!shmop) { php_error(E_WARNING, "shmsize: no such segment"); @@ -296,20 +296,20 @@ PHP_FUNCTION(shmop_write) convert_to_string_ex(data); convert_to_long_ex(offset); - shmop = zend_list_find((*shmid)->value.lval, &type); + shmop = zend_list_find(Z_LVAL_PP(shmid), &type); if (!shmop) { php_error(E_WARNING, "shmwrite: error no such segment"); RETURN_FALSE; } - if ( (*offset)->value.lval > shmop->size ) { + if ( Z_LVAL_PP(offset) > shmop->size ) { php_error(E_WARNING, "shmwrite: offset out of range"); RETURN_FALSE; } - writesize = ((*data)->value.str.len<shmop->size-(*offset)->value.lval) ? (*data)->value.str.len : shmop->size-(*offset)->value.lval; - memcpy(shmop->addr+(*offset)->value.lval, (*data)->value.str.val, writesize); + writesize = (Z_STRLEN_PP(data)<shmop->size-Z_LVAL_PP(offset)) ? Z_STRLEN_PP(data) : shmop->size-Z_LVAL_PP(offset); + memcpy(shmop->addr+Z_LVAL_PP(offset), Z_STRVAL_PP(data), writesize); RETURN_LONG(writesize); } @@ -329,7 +329,7 @@ PHP_FUNCTION(shmop_delete) convert_to_long_ex(shmid); - shmop = zend_list_find((*shmid)->value.lval, &type); + shmop = zend_list_find(Z_LVAL_PP(shmid), &type); if (!shmop) { php_error(E_WARNING, "shmdelete: error no such segment"); diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index da578055e9..7154f5253c 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -324,8 +324,8 @@ retry: add_assoc_string(return_value,buf2,buf,1); } if (st >= 2 && st != 11) { - if (vars->type != SNMP_ENDOFMIBVIEW && - vars->type != SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) { + if (Z_TYPE_P(vars) != SNMP_ENDOFMIBVIEW && + Z_TYPE_P(vars) != SNMP_NOSUCHOBJECT && Z_TYPE_P(vars) != SNMP_NOSUCHINSTANCE) { memmove((char *)name, (char *)vars->name,vars->name_length * sizeof(oid)); name_length = vars->name_length; keepwalking = 1; diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 68bcd01afe..8510d99c03 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -222,7 +222,7 @@ static php_socket *open_listen_sock(int port, int backlog) la.sin_port = htons((unsigned short) port); php_sock->bsd_socket = socket(PF_INET, SOCK_STREAM, 0); - php_sock->type = PF_INET; + Z_TYPE_P(php_sock) = PF_INET; if (IS_INVALID_SOCKET(php_sock)) { php_error(E_WARNING, "Couldn't allocate a new socket from open_listen_sock()"); efree(php_sock); @@ -948,7 +948,7 @@ PHP_FUNCTION(socket_create) } php_sock->bsd_socket = socket(Z_LVAL_PP(arg1), Z_LVAL_PP(arg2), Z_LVAL_PP(arg3)); - php_sock->type = Z_LVAL_PP(arg1); + Z_TYPE_P(php_sock) = Z_LVAL_PP(arg1); if (IS_INVALID_SOCKET(php_sock)) { RETURN_FALSE; } @@ -982,7 +982,7 @@ PHP_FUNCTION(socket_connect) } - switch(php_sock->type) { + switch(Z_TYPE_P(php_sock)) { case AF_INET: if (argc != 3) { WRONG_PARAM_COUNT; @@ -1093,13 +1093,13 @@ PHP_FUNCTION(socket_bind) } - if (php_sock->type == AF_UNIX) { + if (Z_TYPE_P(php_sock) == AF_UNIX) { struct sockaddr_un *sa = (struct sockaddr_un *) sock_type; memset(sa, 0, sizeof(sa_storage)); sa->sun_family = AF_UNIX; snprintf(sa->sun_path, 108, "%s", Z_STRVAL_PP(arg2)); retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, SUN_LEN(sa)); - } else if (php_sock->type == AF_INET) { + } else if (Z_TYPE_P(php_sock) == AF_INET) { struct sockaddr_in sa; struct hostent *hp; @@ -1441,7 +1441,7 @@ PHP_FUNCTION(socket_recvfrom) recv_buf = emalloc(Z_LVAL_PP(arg3) + 2); memset(recv_buf, 0, Z_LVAL_PP(arg3) + 2); - switch (php_sock->type) { + switch (Z_TYPE_P(php_sock)) { case AF_UNIX: slen = sizeof(s_un); s_un.sun_family = AF_UNIX; diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 44545e181a..a7d3ac98a6 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -143,7 +143,7 @@ PHP_FUNCTION(assert) WRONG_PARAM_COUNT; } - if ((*assertion)->type == IS_STRING) { + if (Z_TYPE_PP(assertion) == IS_STRING) { zval retval; int old_error_reporting = 0; /* shut up gcc! */ @@ -233,7 +233,7 @@ PHP_FUNCTION(assert_options) convert_to_long_ex(what); - switch ((*what)->value.lval) { + switch (Z_LVAL_PP(what)) { case ASSERT_ACTIVE: oldint = ASSERTG(active); if (ac == 2) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index ef2fc7ca07..285a447938 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1413,9 +1413,9 @@ PHP_FUNCTION(gettype) char *result; int res_len; - res_len = sizeof("object of type ")-1 + arg->value.obj.ce->name_length; + res_len = sizeof("object of type ")-1 + Z_OBJCE_P(arg)->name_length; result = (char *) emalloc(res_len+1); - sprintf(result, "object of type %s", arg->value.obj.ce->name); + sprintf(result, "object of type %s", Z_OBJCE_P(arg)->name); RETVAL_STRINGL(result, res_len, 0); } */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 0e7e6813c1..fbd38f39f6 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -34,7 +34,7 @@ static zval *current_section; static void browscap_entry_dtor(zval *pvalue) { - if (pvalue->type == IS_OBJECT) { + if (Z_TYPE_P(pvalue) == IS_OBJECT) { zend_hash_destroy(Z_OBJPROP_P(pvalue)); free(Z_OBJPROP_P(pvalue)); } @@ -47,21 +47,21 @@ static void convert_browscap_pattern(zval *pattern) register int i, j; char *t; - for (i=0; i<pattern->value.str.len; i++) { - if (pattern->value.str.val[i]=='*' || pattern->value.str.val[i]=='?' || pattern->value.str.val[i]=='.') { + for (i=0; i<Z_STRLEN_P(pattern); i++) { + if (Z_STRVAL_P(pattern)[i]=='*' || Z_STRVAL_P(pattern)[i]=='?' || Z_STRVAL_P(pattern)[i]=='.') { break; } } - if (i==pattern->value.str.len) { /* no wildcards */ - pattern->value.str.val = zend_strndup(pattern->value.str.val, pattern->value.str.len); + if (i==Z_STRLEN_P(pattern)) { /* no wildcards */ + Z_STRVAL_P(pattern) = zend_strndup(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); return; } - t = (char *) malloc(pattern->value.str.len*2); + t = (char *) malloc(Z_STRLEN_P(pattern)*2); - for (i=0, j=0; i<pattern->value.str.len; i++, j++) { - switch (pattern->value.str.val[i]) { + for (i=0, j=0; i<Z_STRLEN_P(pattern); i++, j++) { + switch (Z_STRVAL_P(pattern)[i]) { case '?': t[j] = '.'; break; @@ -74,13 +74,13 @@ static void convert_browscap_pattern(zval *pattern) t[j] = '.'; break; default: - t[j] = pattern->value.str.val[i]; + t[j] = Z_STRVAL_P(pattern)[i]; break; } } t[j]=0; - pattern->value.str.val = t; - pattern->value.str.len = j; + Z_STRVAL_P(pattern) = t; + Z_STRLEN_P(pattern) = j; } /* }}} */ @@ -96,9 +96,9 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, int callback_type, vo new_property = (zval *) malloc(sizeof(zval)); INIT_PZVAL(new_property); - new_property->value.str.val = Z_STRLEN_P(arg2)?zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)):""; - new_property->value.str.len = Z_STRLEN_P(arg2); - new_property->type = IS_STRING; + Z_STRVAL_P(new_property) = Z_STRLEN_P(arg2)?zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)):""; + Z_STRLEN_P(new_property) = Z_STRLEN_P(arg2); + Z_TYPE_P(new_property) = IS_STRING; new_key = zend_strndup(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); zend_str_tolower(new_key, Z_STRLEN_P(arg1)); @@ -118,13 +118,13 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, int callback_type, vo /* OBJECTS_FIXME */ Z_OBJCE_P(current_section) = &zend_standard_class_def; Z_OBJPROP_P(current_section) = (HashTable *) malloc(sizeof(HashTable)); - current_section->type = IS_OBJECT; + Z_TYPE_P(current_section) = IS_OBJECT; zend_hash_init(Z_OBJPROP_P(current_section), 0, NULL, (dtor_func_t) browscap_entry_dtor, 1); zend_hash_update(&browser_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void *) ¤t_section, sizeof(zval *), NULL); - processed->value.str.val = Z_STRVAL_P(arg1); - processed->value.str.len = Z_STRLEN_P(arg1); - processed->type = IS_STRING; + Z_STRVAL_P(processed) = Z_STRVAL_P(arg1); + Z_STRLEN_P(processed) = Z_STRLEN_P(arg1); + Z_TYPE_P(processed) = IS_STRING; convert_browscap_pattern(processed); zend_hash_update(Z_OBJPROP_P(current_section), "browser_name_pattern", sizeof("browser_name_pattern"), (void *) &processed, sizeof(zval *), NULL); } @@ -152,7 +152,7 @@ PHP_MINIT_FUNCTION(browscap) return FAILURE; } fh.filename = browscap; - fh.type = ZEND_HANDLE_FP; + Z_TYPE(fh) = ZEND_HANDLE_FP; zend_parse_ini_file(&fh, 1, (zend_ini_parser_cb_t) php_browscap_parser_cb, &browser_hash); } @@ -187,10 +187,10 @@ static int browser_reg_compare(zval **browser, int num_args, va_list args, zend_ return 0; } - if (!strchr((*browser_name)->value.str.val,'*')) { + if (!strchr(Z_STRVAL_PP(browser_name),'*')) { return 0; } - if (regcomp(&r, (*browser_name)->value.str.val, REG_NOSUB)!=0) { + if (regcomp(&r, Z_STRVAL_PP(browser_name), REG_NOSUB)!=0) { return 0; } if (regexec(&r, lookup_browser_name, 0, NULL, 0)==0) { @@ -233,8 +233,8 @@ PHP_FUNCTION(get_browser) convert_to_string_ex(agent_name); - if (zend_hash_find(&browser_hash, (*agent_name)->value.str.val, (*agent_name)->value.str.len+1, (void **) &agent)==FAILURE) { - lookup_browser_name = (*agent_name)->value.str.val; + if (zend_hash_find(&browser_hash, Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name)+1, (void **) &agent)==FAILURE) { + lookup_browser_name = Z_STRVAL_PP(agent_name); found_browser_entry = NULL; zend_hash_apply_with_arguments(&browser_hash, (apply_func_args_t) browser_reg_compare, 2, lookup_browser_name, &found_browser_entry); @@ -250,7 +250,7 @@ PHP_FUNCTION(get_browser) while (zend_hash_find(Z_OBJPROP_PP(agent), "parent", sizeof("parent"), (void **) &agent_name)==SUCCESS) { - if (zend_hash_find(&browser_hash, (*agent_name)->value.str.val, (*agent_name)->value.str.len+1, (void **)&agent)==FAILURE) { + if (zend_hash_find(&browser_hash, Z_STRVAL_PP(agent_name), Z_STRLEN_PP(agent_name)+1, (void **)&agent)==FAILURE) { break; } diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index 0c7a06b6dd..e14c872cbf 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -117,8 +117,8 @@ PHP_NAMED_FUNCTION(php_if_crc32) convert_to_string_ex(arg); len = 0 ; - nr=(*arg)->value.str.len; - p = (*arg)->value.str.val; + nr=Z_STRLEN_PP(arg); + p = Z_STRVAL_PP(arg); for (len += nr; nr--; ++p) { CRC32(crc, *p); } diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c index 72acec7185..fd330dc5b9 100644 --- a/ext/standard/cyr_convert.c +++ b/ext/standard/cyr_convert.c @@ -282,9 +282,9 @@ PHP_FUNCTION(convert_cyr_string) convert_to_string_ex(fr_cs); convert_to_string_ex(to_cs); - str = (unsigned char*) estrndup((*str_arg)->value.str.val, (*str_arg)->value.str.len); + str = (unsigned char*) estrndup(Z_STRVAL_PP(str_arg), Z_STRLEN_PP(str_arg)); - php_convert_cyr_string(str, (*str_arg)->value.str.len, (*fr_cs)->value.str.val[0], (*to_cs)->value.str.val[0]); + php_convert_cyr_string(str, Z_STRLEN_PP(str_arg), Z_STRVAL_PP(fr_cs)[0], Z_STRVAL_PP(to_cs)[0]); RETVAL_STRING((char *)str, 0) } /* }}} */ diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index a6348fe74e..71eb7740d9 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -233,7 +233,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) WRONG_PARAM_COUNT; } convert_to_long_ex(timestamp); - the_time = (*timestamp)->value.lval; + the_time = Z_LVAL_PP(timestamp); break; default: WRONG_PARAM_COUNT; @@ -250,8 +250,8 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) php_error(E_WARNING, "unexpected error in date()"); RETURN_FALSE; } - for (i = 0; i < (*format)->value.str.len; i++) { - switch ((*format)->value.str.val[i]) { + for (i = 0; i < Z_STRLEN_PP(format); i++) { + switch (Z_STRVAL_PP(format)[i]) { case 'r': /* rfc822 format */ size += 31; break; @@ -303,7 +303,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) size += 2; break; case '\\': - if(i < (*format)->value.str.len-1) { + if(i < Z_STRLEN_PP(format)-1) { i++; } size ++; @@ -317,123 +317,123 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) } } - return_value->value.str.val = (char *) emalloc(size + 1); - return_value->value.str.val[0] = '\0'; + Z_STRVAL_P(return_value) = (char *) emalloc(size + 1); + Z_STRVAL_P(return_value)[0] = '\0'; - for (i = 0; i < (*format)->value.str.len; i++) { - switch ((*format)->value.str.val[i]) { + for (i = 0; i < Z_STRLEN_PP(format); i++) { + switch (Z_STRVAL_PP(format)[i]) { case '\\': - if(i < (*format)->value.str.len-1) { + if(i < Z_STRLEN_PP(format)-1) { char ch[2]; - ch[0]=(*format)->value.str.val[i+1]; + ch[0]=Z_STRVAL_PP(format)[i+1]; ch[1]='\0'; - strcat(return_value->value.str.val, ch); + strcat(Z_STRVAL_P(return_value), ch); i++; } break; case 'U': /* seconds since the epoch */ sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'F': /* month, textual, full */ - strcat(return_value->value.str.val, mon_full_names[ta->tm_mon]); + strcat(Z_STRVAL_P(return_value), mon_full_names[ta->tm_mon]); break; case 'l': /* day (of the week), textual, full */ - strcat(return_value->value.str.val, day_full_names[ta->tm_wday]); + strcat(Z_STRVAL_P(return_value), day_full_names[ta->tm_wday]); break; case 'Y': /* year, numeric, 4 digits */ sprintf(tmp_buff, "%d", ta->tm_year + 1900); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'M': /* month, textual, 3 letters */ - strcat(return_value->value.str.val, mon_short_names[ta->tm_mon]); + strcat(Z_STRVAL_P(return_value), mon_short_names[ta->tm_mon]); break; case 'D': /* day (of the week), textual, 3 letters */ - strcat(return_value->value.str.val, day_short_names[ta->tm_wday]); + strcat(Z_STRVAL_P(return_value), day_short_names[ta->tm_wday]); break; case 'z': /* day (of the year) */ sprintf(tmp_buff, "%d", ta->tm_yday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'y': /* year, numeric, 2 digits */ sprintf(tmp_buff, "%02d", ((ta->tm_year)%100)); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'm': /* month, numeric */ sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'n': /* month, numeric, no leading zeros */ sprintf(tmp_buff, "%d", ta->tm_mon + 1); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'd': /* day of the month, numeric */ sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'j': sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'H': /* hour, numeric, 24 hour format */ sprintf(tmp_buff, "%02d", ta->tm_hour); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'h': /* hour, numeric, 12 hour format */ h = ta->tm_hour % 12; if (h==0) h = 12; sprintf(tmp_buff, "%02d", h); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'G': /* hour, numeric, 24 hour format, no leading zeros */ sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'g': /* hour, numeric, 12 hour format, no leading zeros */ h = ta->tm_hour % 12; if (h==0) h = 12; sprintf(tmp_buff, "%d", h); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'i': /* minutes, numeric */ sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 's': /* seconds, numeric */ sprintf(tmp_buff, "%02d", ta->tm_sec); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'A': /* AM/PM */ - strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "PM" : "AM")); + strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "PM" : "AM")); break; case 'a': /* am/pm */ - strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "pm" : "am")); + strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "pm" : "am")); break; case 'S': /* standard english suffix, e.g. 2nd/3rd for the day of the month */ if (ta->tm_mday >= 10 && ta->tm_mday <= 19) { - strcat(return_value->value.str.val, "th"); + strcat(Z_STRVAL_P(return_value), "th"); } else { switch (ta->tm_mday % 10) { case 1: - strcat(return_value->value.str.val, "st"); + strcat(Z_STRVAL_P(return_value), "st"); break; case 2: - strcat(return_value->value.str.val, "nd"); + strcat(Z_STRVAL_P(return_value), "nd"); break; case 3: - strcat(return_value->value.str.val, "rd"); + strcat(Z_STRVAL_P(return_value), "rd"); break; default: - strcat(return_value->value.str.val, "th"); + strcat(Z_STRVAL_P(return_value), "th"); break; } } break; case 't': /* days in current month */ sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+1900))][ta->tm_mon] ); - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'w': /* day of the week, numeric EXTENSION */ sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'O': /* GMT offset in [+-]HHMM format */ #if HAVE_TM_GMTOFF @@ -441,7 +441,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) #else sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600)); #endif - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'Z': /* timezone offset in seconds */ #if HAVE_TM_GMTOFF @@ -449,17 +449,17 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) #else sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(timezone - 3600) : -timezone); #endif - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'L': /* boolean for leapyear */ sprintf(tmp_buff, "%d", (isleap((ta->tm_year+1900)) ? 1 : 0 ) ); - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'T': /* timezone name */ #if HAVE_TM_ZONE - strcat(return_value->value.str.val, ta->tm_zone); + strcat(Z_STRVAL_P(return_value), ta->tm_zone); #elif HAVE_TZNAME - strcat(return_value->value.str.val, tzname[0]); + strcat(Z_STRVAL_P(return_value), tzname[0]); #endif break; case 'B': /* Swatch Beat a.k.a. Internet Time */ @@ -470,11 +470,11 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) } beat = beat % 1000; sprintf(tmp_buff, "%03d", beat); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'I': sprintf(tmp_buff, "%d", ta->tm_isdst); - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'r': #if HAVE_TM_GMTOFF @@ -504,7 +504,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) ); #endif - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; case 'W': /* ISO-8601 week number of year, weeks starting on Monday */ wd = ta->tm_wday==0 ? 7 : ta->tm_wday; @@ -515,18 +515,18 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) wk--; } sprintf(tmp_buff, "%d", wk); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); + strcat(Z_STRVAL_P(return_value), tmp_buff); break; default: - length = strlen(return_value->value.str.val); - return_value->value.str.val[length] = (*format)->value.str.val[i]; - return_value->value.str.val[length + 1] = '\0'; + length = strlen(Z_STRVAL_P(return_value)); + Z_STRVAL_P(return_value)[length] = Z_STRVAL_PP(format)[i]; + Z_STRVAL_P(return_value)[length + 1] = '\0'; break; } } - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -567,13 +567,13 @@ PHP_FUNCTION(localtime) break; case 1: convert_to_long_ex(timestamp_arg); - timestamp = (*timestamp_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); break; case 2: convert_to_long_ex(timestamp_arg); convert_to_long_ex(assoc_array_arg); - timestamp = (*timestamp_arg)->value.lval; - assoc_array = (*assoc_array_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); + assoc_array = Z_LVAL_PP(assoc_array_arg); break; } ta = php_localtime_r(×tamp, &tmbuf); @@ -620,7 +620,7 @@ PHP_FUNCTION(getdate) WRONG_PARAM_COUNT; } else { convert_to_long_ex(timestamp_arg); - timestamp = (*timestamp_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); } ta = php_localtime_r(×tamp, &tmbuf); @@ -689,8 +689,8 @@ PHP_FUNCTION(checkdate) WRONG_PARAM_COUNT; } - if((*year)->type == IS_STRING) { - res = is_numeric_string((*year)->value.str.val, (*year)->value.str.len, NULL, NULL, 0); + if(Z_TYPE_PP(year) == IS_STRING) { + res = is_numeric_string(Z_STRVAL_PP(year), Z_STRLEN_PP(year), NULL, NULL, 0); if(res!=IS_LONG && res !=IS_DOUBLE) { RETURN_FALSE; } @@ -698,9 +698,9 @@ PHP_FUNCTION(checkdate) convert_to_long_ex(day); convert_to_long_ex(month); convert_to_long_ex(year); - y = (*year)->value.lval; - m = (*month)->value.lval; - d = (*day)->value.lval; + y = Z_LVAL_PP(year); + m = Z_LVAL_PP(month); + d = Z_LVAL_PP(day); if (y < 1 || y > 32767) { RETURN_FALSE; @@ -739,7 +739,7 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm) RETURN_FALSE; } convert_to_long_ex(timestamp_arg); - timestamp = (*timestamp_arg)->value.lval; + timestamp = Z_LVAL_PP(timestamp_arg); break; default: WRONG_PARAM_COUNT; @@ -747,13 +747,13 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm) } convert_to_string_ex(format_arg); - if ((*format_arg)->value.str.len==0) { + if (Z_STRLEN_PP(format_arg)==0) { RETURN_FALSE; } if (timestamp < 0) { RETURN_FALSE; } - format = (*format_arg)->value.str.val; + format = Z_STRVAL_PP(format_arg); if (gm) { ta = php_gmtime_r(×tamp, &tmbuf); } else { diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 186318a6bf..cb36184926 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -148,13 +148,13 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) } convert_to_string_ex(arg); - if (php_check_open_basedir((*arg)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(arg) TSRMLS_CC)) { RETURN_FALSE; } dirp = emalloc(sizeof(php_dir)); - dirp->dir = VCWD_OPENDIR((*arg)->value.str.val); + dirp->dir = VCWD_OPENDIR(Z_STRVAL_PP(arg)); #ifdef PHP_WIN32 if (!dirp->dir || dirp->dir->finished) { @@ -175,7 +175,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) if (createobject) { object_init_ex(return_value, dir_class_entry_ptr); - add_property_stringl(return_value, "path", (*arg)->value.str.val, (*arg)->value.str.len, 1); + add_property_stringl(return_value, "path", Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), 1); add_property_resource(return_value, "handle", dirp->id); zend_list_addref(dirp->id); } else { @@ -235,7 +235,7 @@ PHP_FUNCTION(chroot) } convert_to_string_ex(arg); - ret = chroot((*arg)->value.str.val); + ret = chroot(Z_STRVAL_PP(arg)); if (ret != 0) { php_error(E_WARNING, "chroot: %s (errno %d)", strerror(errno), errno); @@ -268,10 +268,10 @@ PHP_FUNCTION(chdir) } convert_to_string_ex(arg); - if (PG(safe_mode) && !php_checkuid((*arg)->value.str.val, NULL, CHECKUID_ALLOW_ONLY_FILE)) { + if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(arg), NULL, CHECKUID_ALLOW_ONLY_FILE)) { RETURN_FALSE; } - ret = VCWD_CHDIR((*arg)->value.str.val); + ret = VCWD_CHDIR(Z_STRVAL_PP(arg)); if (ret != 0) { php_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno); diff --git a/ext/standard/dl.c b/ext/standard/dl.c index d482677b99..d033dce989 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -119,15 +119,15 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC) if (extension_dir && extension_dir[0]){ int extension_dir_len = strlen(extension_dir); - libpath = emalloc(extension_dir_len+file->value.str.len+2); + libpath = emalloc(extension_dir_len+Z_STRLEN_P(file)+2); if (IS_SLASH(extension_dir[extension_dir_len-1])) { - sprintf(libpath, "%s%s", extension_dir, file->value.str.val); /* SAFE */ + sprintf(libpath, "%s%s", extension_dir, Z_STRVAL_P(file)); /* SAFE */ } else { - sprintf(libpath, "%s/%s", extension_dir, file->value.str.val); /* SAFE */ + sprintf(libpath, "%s/%s", extension_dir, Z_STRVAL_P(file)); /* SAFE */ } } else { - libpath = estrndup(file->value.str.val, file->value.str.len); + libpath = estrndup(Z_STRVAL_P(file), Z_STRLEN_P(file)); } /* load dynamic symbol */ @@ -154,7 +154,7 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC) if (!get_module) { DL_UNLOAD(handle); - php_error(error_type, "Invalid library (maybe not a PHP library) '%s' ", file->value.str.val); + php_error(error_type, "Invalid library (maybe not a PHP library) '%s' ", Z_STRVAL_P(file)); RETURN_FALSE; } module_entry = get_module(); @@ -170,7 +170,7 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC) DL_UNLOAD(handle); RETURN_FALSE; } - module_entry->type = type; + Z_TYPE_P(module_entry) = type; module_entry->module_number = zend_next_free_module(); if (module_entry->module_startup_func) { if (module_entry->module_startup_func(type, module_entry->module_number TSRMLS_CC)==FAILURE) { @@ -209,7 +209,7 @@ PHP_MINFO_FUNCTION(dl) void php_dl(pval *file, int type, pval *return_value) { - php_error(E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", file->value.str.val); + php_error(E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", Z_STRVAL_P(file)); RETURN_FALSE; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 6f7042ecc5..970a8309ae 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2041,7 +2041,7 @@ PHP_FUNCTION(fgetcsv) } convert_to_string_ex(p_delim); /* Make sure that there is at least one character in string */ - if ((*p_delim)->value.str.len < 1) { + if (Z_STRLEN_PP(p_delim) < 1) { WRONG_PARAM_COUNT; } /* use first character from string */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 4f2921f755..d2a130ea27 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -164,7 +164,7 @@ PHP_FUNCTION(disk_total_space) convert_to_string_ex(path); - if (php_check_open_basedir((*path)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) { RETURN_FALSE; } @@ -178,7 +178,7 @@ PHP_FUNCTION(disk_total_space) /* It's available, so we can call it. */ if (gdfse) { func = (gdfse_func)gdfse; - if (func((*path)->value.str.val, + if (func(Z_STRVAL_PP(path), &FreeBytesAvailableToCaller, &TotalNumberOfBytes, &TotalNumberOfFreeBytes) == 0) RETURN_FALSE; @@ -190,7 +190,7 @@ PHP_FUNCTION(disk_total_space) } /* If it's not available, we just use GetDiskFreeSpace */ else { - if (GetDiskFreeSpace((*path)->value.str.val, + if (GetDiskFreeSpace(Z_STRVAL_PP(path), &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE; bytestotal = (double)TotalNumberOfClusters * (double)SectorsPerCluster * (double)BytesPerSector; @@ -204,14 +204,14 @@ PHP_FUNCTION(disk_total_space) #elif defined(OS2) { FSALLOCATE fsinfo; - char drive = (*path)->value.str.val[0] & 95; + char drive = Z_STRVAL_PP(path)[0] & 95; if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0) bytestotal = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnit; } #else /* WINDOWS, OS/2 */ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) - if (statvfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; if (buf.f_frsize) { bytestotal = (((double)buf.f_blocks) * ((double)buf.f_frsize)); } else { @@ -219,7 +219,7 @@ PHP_FUNCTION(disk_total_space) } #elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) - if (statfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; bytestotal = (((double)buf.f_bsize) * ((double)buf.f_blocks)); #endif #endif /* WINDOWS */ @@ -267,7 +267,7 @@ PHP_FUNCTION(disk_free_space) convert_to_string_ex(path); - if (php_check_open_basedir((*path)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(path) TSRMLS_CC)) { RETURN_FALSE; } @@ -281,7 +281,7 @@ PHP_FUNCTION(disk_free_space) /* It's available, so we can call it. */ if (gdfse) { func = (gdfse_func)gdfse; - if (func((*path)->value.str.val, + if (func(Z_STRVAL_PP(path), &FreeBytesAvailableToCaller, &TotalNumberOfBytes, &TotalNumberOfFreeBytes) == 0) RETURN_FALSE; @@ -293,7 +293,7 @@ PHP_FUNCTION(disk_free_space) } /* If it's not available, we just use GetDiskFreeSpace */ else { - if (GetDiskFreeSpace((*path)->value.str.val, + if (GetDiskFreeSpace(Z_STRVAL_PP(path), &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE; bytesfree = (double)NumberOfFreeClusters * (double)SectorsPerCluster * (double)BytesPerSector; @@ -307,21 +307,21 @@ PHP_FUNCTION(disk_free_space) #elif defined(OS2) { FSALLOCATE fsinfo; - char drive = (*path)->value.str.val[0] & 95; + char drive = Z_STRVAL_PP(path)[0] & 95; if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0) bytesfree = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnitAvail; } #else /* WINDOWS, OS/2 */ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) - if (statvfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statvfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; if (buf.f_frsize) { bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize)); } else { bytesfree = (((double)buf.f_bavail) * ((double)buf.f_bsize)); } #elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS) - if (statfs((*path)->value.str.val, &buf)) RETURN_FALSE; + if (statfs(Z_STRVAL_PP(path), &buf)) RETURN_FALSE; bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail)); #endif #endif /* WINDOWS */ @@ -344,29 +344,29 @@ PHP_FUNCTION(chgrp) WRONG_PARAM_COUNT; } convert_to_string_ex(filename); - if ((*group)->type == IS_STRING) { - gr = getgrnam((*group)->value.str.val); + if (Z_TYPE_PP(group) == IS_STRING) { + gr = getgrnam(Z_STRVAL_PP(group)); if (!gr) { php_error(E_WARNING, "unable to find gid for %s", - (*group)->value.str.val); + Z_STRVAL_PP(group)); RETURN_FALSE; } gid = gr->gr_gid; } else { convert_to_long_ex(group); - gid = (*group)->value.lval; + gid = Z_LVAL_PP(group); } - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { RETURN_FALSE; } - ret = VCWD_CHOWN((*filename)->value.str.val, -1, gid); + ret = VCWD_CHOWN(Z_STRVAL_PP(filename), -1, gid); if (ret == -1) { php_error(E_WARNING, "chgrp failed: %s", strerror(errno)); RETURN_FALSE; @@ -392,29 +392,29 @@ PHP_FUNCTION(chown) WRONG_PARAM_COUNT; } convert_to_string_ex(filename); - if ((*user)->type == IS_STRING) { - pw = getpwnam((*user)->value.str.val); + if (Z_TYPE_PP(user) == IS_STRING) { + pw = getpwnam(Z_STRVAL_PP(user)); if (!pw) { php_error(E_WARNING, "unable to find uid for %s", - (*user)->value.str.val); + Z_STRVAL_PP(user)); RETURN_FALSE; } uid = pw->pw_uid; } else { convert_to_long_ex(user); - uid = (*user)->value.lval; + uid = Z_LVAL_PP(user); } - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { RETURN_FALSE; } - ret = VCWD_CHOWN((*filename)->value.str.val, uid, -1); + ret = VCWD_CHOWN(Z_STRVAL_PP(filename), uid, -1); if (ret == -1) { php_error(E_WARNING, "chown failed: %s", strerror(errno)); RETURN_FALSE; @@ -438,16 +438,16 @@ PHP_FUNCTION(chmod) convert_to_string_ex(filename); convert_to_long_ex(mode); - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { RETURN_FALSE; } - imode = (mode_t) (*mode)->value.lval; + imode = (mode_t) Z_LVAL_PP(mode); /* in safe mode, do not allow to setuid files. Setuiding files could allow users to gain privileges that safe mode doesn't give them. @@ -455,7 +455,7 @@ PHP_FUNCTION(chmod) if(PG(safe_mode)) imode &= 0777; - ret = VCWD_CHMOD((*filename)->value.str.val, imode); + ret = VCWD_CHMOD(Z_STRVAL_PP(filename), imode); if (ret == -1) { php_error(E_WARNING, "chmod failed: %s", strerror(errno)); RETURN_FALSE; @@ -493,20 +493,20 @@ PHP_FUNCTION(touch) return; } convert_to_long_ex(filetime); - newtime->actime = (*filetime)->value.lval; - newtime->modtime = (*filetime)->value.lval; + newtime->actime = Z_LVAL_PP(filetime); + newtime->modtime = Z_LVAL_PP(filetime); } else { WRONG_PARAM_COUNT; } convert_to_string_ex(filename); - if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { + if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { if (newtime) efree(newtime); RETURN_FALSE; } /* Check the basedir */ - if (php_check_open_basedir((*filename)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) { if (newtime) { efree(newtime); } @@ -514,18 +514,18 @@ PHP_FUNCTION(touch) } /* create the file if it doesn't exist already */ - ret = VCWD_STAT((*filename)->value.str.val, &sb); + ret = VCWD_STAT(Z_STRVAL_PP(filename), &sb); if (ret == -1) { - file = VCWD_FOPEN((*filename)->value.str.val, "w"); + file = VCWD_FOPEN(Z_STRVAL_PP(filename), "w"); if (file == NULL) { - php_error(E_WARNING, "unable to create file %s because %s", (*filename)->value.str.val, strerror(errno)); + php_error(E_WARNING, "unable to create file %s because %s", Z_STRVAL_PP(filename), strerror(errno)); if (newtime) efree(newtime); RETURN_FALSE; } fclose(file); } - ret = VCWD_UTIME((*filename)->value.str.val, newtime); + ret = VCWD_UTIME(Z_STRVAL_PP(filename), newtime); if (newtime) efree(newtime); if (ret == -1) { php_error(E_WARNING, "utime failed: %s", strerror(errno)); diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index fa18a56f7f..d10de4d6f8 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -552,24 +552,24 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 's': convert_to_string_ex(args[argnum]); php_sprintf_appendstring(&result, &outpos, &size, - (*args[argnum])->value.str.val, + Z_STRVAL_PP(args[argnum]), width, precision, padding, alignment, - (*args[argnum])->value.str.len, + Z_STRLEN_PP(args[argnum]), 0, expprec); break; case 'd': convert_to_long_ex(args[argnum]); php_sprintf_appendint(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment); break; case 'u': convert_to_long_ex(args[argnum]); php_sprintf_appenduint(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment); break; @@ -578,7 +578,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) /* XXX not done */ convert_to_double_ex(args[argnum]); php_sprintf_appenddouble(&result, &outpos, &size, - (*args[argnum])->value.dval, + Z_DVAL_PP(args[argnum]), width, padding, alignment, precision, adjusting, format[inpos]); @@ -587,13 +587,13 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'c': convert_to_long_ex(args[argnum]); php_sprintf_appendchar(&result, &outpos, &size, - (char) (*args[argnum])->value.lval TSRMLS_CC); + (char) Z_LVAL_PP(args[argnum]) TSRMLS_CC); break; case 'o': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 3, hexchars, expprec); break; @@ -601,7 +601,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'x': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 4, hexchars, expprec); break; @@ -609,7 +609,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'X': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 4, HEXCHARS, expprec); break; @@ -617,7 +617,7 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC) case 'b': convert_to_long_ex(args[argnum]); php_sprintf_append2n(&result, &outpos, &size, - (*args[argnum])->value.lval, + Z_LVAL_PP(args[argnum]), width, padding, alignment, 1, hexchars, expprec); break; diff --git a/ext/standard/html.c b/ext/standard/html.c index 092949c031..eb6512c18d 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -492,7 +492,7 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) convert_to_string_ex(arg); if(ac==2) { convert_to_long_ex(quotes); - quote_style = (*quotes)->value.lval; + quote_style = Z_LVAL_PP(quotes); } if (ac == 3) { convert_to_string_ex(charset); @@ -500,7 +500,7 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) } - new = php_escape_html_entities((*arg)->value.str.val, (*arg)->value.str.len, &len, all, quote_style, hint_charset); + new = php_escape_html_entities(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &len, all, quote_style, hint_charset); RETVAL_STRINGL(new, len, 0); } /* }}} */ @@ -553,11 +553,11 @@ PHP_FUNCTION(get_html_translation_table) if (ac > 0) { convert_to_long_ex(whichone); - which = (*whichone)->value.lval; + which = Z_LVAL_PP(whichone); } if (ac == 2) { convert_to_long_ex(quotes); - quote_style = (*quotes)->value.lval; + quote_style = Z_LVAL_PP(quotes); } array_init(return_value); diff --git a/ext/standard/image.c b/ext/standard/image.c index 087b4e9a6e..7b6fded134 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -306,7 +306,7 @@ static void php_read_APP(int socketd, FILE *fp, int issock, unsigned int marker, sprintf(markername, "APP%d", marker - M_APP0); - if (zend_hash_find(info->value.ht, markername, strlen(markername)+1, (void **) &tmp) == FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(info), markername, strlen(markername)+1, (void **) &tmp) == FAILURE) { /* XXX we onyl catch the 1st tag of it's kind! */ add_assoc_stringl(info, markername, buffer, length, 1); } diff --git a/ext/standard/info.c b/ext/standard/info.c index 0f01eff45e..c314531171 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -65,14 +65,14 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) ulong num_key; if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE - && ((*data)->type==IS_ARRAY)) { - zend_hash_internal_pointer_reset((*data)->value.ht); - while (zend_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) { + && (Z_TYPE_PP(data)==IS_ARRAY)) { + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); + while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) { PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">"); PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>"); PUTS(name); PUTS("[\""); - switch (zend_hash_get_current_key((*data)->value.ht, &string_key, &num_key, 0)) { + switch (zend_hash_get_current_key(Z_ARRVAL_PP(data), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: zend_html_puts(string_key, strlen(string_key)); break; @@ -81,21 +81,21 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) break; } PUTS("\"]</b></td><td>"); - if ((*tmp)->type == IS_ARRAY) { + if (Z_TYPE_PP(tmp) == IS_ARRAY) { PUTS("<pre>"); zend_print_zval_r(*tmp, 0); PUTS("</pre>"); - } else if ((*tmp)->type != IS_STRING) { + } else if (Z_TYPE_PP(tmp) != IS_STRING) { tmp2 = **tmp; zval_copy_ctor(&tmp2); convert_to_string(&tmp2); zend_html_puts(tmp2.value.str.val, tmp2.value.str.len); zval_dtor(&tmp2); } else { - zend_html_puts((*tmp)->value.str.val, (*tmp)->value.str.len); + zend_html_puts(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } PUTS(" </td></tr>\n"); - zend_hash_move_forward((*data)->value.ht); + zend_hash_move_forward(Z_ARRVAL_PP(data)); } } } @@ -290,16 +290,16 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_table_start(); php_info_print_table_header(2, "Variable", "Value"); if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_SELF", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_AUTH_TYPE", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_AUTH_USER", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data)); } if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) { - php_info_print_table_row(2, "PHP_AUTH_PW", (*data)->value.str.val); + php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data)); } php_print_gpcse_array("_FORM", sizeof("_FORM")-1 TSRMLS_CC); php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC); diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 19bec00289..9641ca408e 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -194,7 +194,7 @@ PHP_FUNCTION(iptcembed) convert_to_string_ex(iptcdata); convert_to_string_ex(jpeg_file); convert_to_long_ex(spool_flag); - spool = (*spool_flag)->value.lval; + spool = Z_LVAL_PP(spool_flag); break; case 2: @@ -210,16 +210,16 @@ PHP_FUNCTION(iptcembed) break; } - if (php_check_open_basedir((*jpeg_file)->value.str.val TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(jpeg_file) TSRMLS_CC)) { RETURN_FALSE; } - if ((fp = VCWD_FOPEN((*jpeg_file)->value.str.val, "rb")) == 0) { - php_error(E_WARNING, "Unable to open %s", (*jpeg_file)->value.str.val); + if ((fp = VCWD_FOPEN(Z_STRVAL_PP(jpeg_file), "rb")) == 0) { + php_error(E_WARNING, "Unable to open %s", Z_STRVAL_PP(jpeg_file)); RETURN_FALSE; } - len = (*iptcdata)->value.str.len; + len = Z_STRLEN_PP(iptcdata); if (spool < 2) { fstat(fileno(fp), &sb); @@ -275,7 +275,7 @@ PHP_FUNCTION(iptcembed) php_iptc_put1(fp, spool, (unsigned char)(len&0xff), poi?&poi:0 TSRMLS_CC); for (inx = 0; inx < len; inx++) - php_iptc_put1(fp, spool, (*iptcdata)->value.str.val[inx], poi?&poi:0 TSRMLS_CC); + php_iptc_put1(fp, spool, Z_STRVAL_PP(iptcdata)[inx], poi?&poi:0 TSRMLS_CC); break; case M_SOS: @@ -316,8 +316,8 @@ PHP_FUNCTION(iptcparse) convert_to_string_ex(str); inx = 0; - length = (*str)->value.str.len; - buffer = (*str)->value.str.val; + length = Z_STRLEN_PP(str); + buffer = Z_STRVAL_PP(str); inheader = 0; /* have we already found the IPTC-Header??? */ tagsfound = 0; /* number of tags already found */ @@ -362,7 +362,7 @@ PHP_FUNCTION(iptcparse) } } - if (zend_hash_find(return_value->value.ht, key, strlen(key) + 1, (void **) &element) == FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void **) &element) == FAILURE) { ALLOC_ZVAL(values); INIT_PZVAL(values); if (array_init(values) == FAILURE) { @@ -370,7 +370,7 @@ PHP_FUNCTION(iptcparse) RETURN_FALSE; } - zend_hash_update(return_value->value.ht, key, strlen(key)+1, (void *) &values, sizeof(pval*), (void **) &element); + zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key)+1, (void *) &values, sizeof(pval*), (void **) &element); } add_next_index_stringl(*element, buffer+inx, len, 1); diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c index 7a0fe01730..7ce5f79764 100644 --- a/ext/standard/levenshtein.c +++ b/ext/standard/levenshtein.c @@ -119,9 +119,9 @@ PHP_FUNCTION(levenshtein) distance = reference_levdist((*str1)->value.str.val, (*str1)->value.str.len, (*str2)->value.str.val, (*str2)->value.str.len, - (*cost_ins)->value.lval, - (*cost_rep)->value.lval, - (*cost_del)->value.lval + Z_LVAL_PP(cost_ins), + Z_LVAL_PP(cost_rep), + Z_LVAL_PP(cost_del) ); break; @@ -136,7 +136,7 @@ PHP_FUNCTION(levenshtein) distance = custom_levdist((*str1)->value.str.val , (*str2)->value.str.val - , (*callback_name)->value.str.val + , Z_STRVAL_PP(callback_name) ); break; diff --git a/ext/standard/link.c b/ext/standard/link.c index 377322dac5..463ab6c04e 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -146,7 +146,7 @@ PHP_FUNCTION(link) RETURN_FALSE; } - if (!strncasecmp((*topath)->value.str.val, "http://", 7) || !strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) { + if (!strncasecmp(Z_STRVAL_PP(topath), "http://", 7) || !strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) { php_error(E_WARNING, "Unable to link to a URL"); RETURN_FALSE; } diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 5e53ab0fe0..d045fa4690 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -56,8 +56,8 @@ PHP_FUNCTION(ezmlm_hash) } convert_to_string_ex(pstr); - if ((*pstr)->value.str.val) { - str = (*pstr)->value.str.val; + if (Z_STRVAL_PP(pstr)) { + str = Z_STRVAL_PP(pstr); } else { php_error(E_WARNING, "Must give string parameter to ezmlm_hash()"); RETURN_FALSE; diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 00444db734..634814a74f 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -45,7 +45,7 @@ PHP_NAMED_FUNCTION(php_if_md5) md5str[0] = '\0'; PHP_MD5Init(&context); - PHP_MD5Update(&context, (*arg)->value.str.val, (*arg)->value.str.len); + PHP_MD5Update(&context, Z_STRVAL_PP(arg), Z_STRLEN_PP(arg)); PHP_MD5Final(digest, &context); for (i = 0, r = md5str; i < 16; i++, r += 2) { sprintf(r, "%02x", digest[i]); diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index f249c249b0..5d1648dfd2 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -39,14 +39,14 @@ PHP_FUNCTION(metaphone) if (zend_get_parameters_ex(2, &pstr, &pphones) == SUCCESS) { convert_to_long_ex(pphones); - phones = (*pphones)->value.lval; + phones = Z_LVAL_PP(pphones); } else if (zend_get_parameters_ex(1, &pstr) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(pstr); - if (metaphone((*pstr)->value.str.val, phones, &result, 1) == 0) { + if (metaphone(Z_STRVAL_PP(pstr), phones, &result, 1) == 0) { RETVAL_STRING(result, 0); } else { if (result) { diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index e9e6b2dcf0..b8e527d2a1 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -103,7 +103,7 @@ PHP_FUNCTION(getrusage) if(ac == 1 && zend_get_parameters_ex(ac, &pwho) != FAILURE) { convert_to_long_ex(pwho); - if((*pwho)->value.lval == 1) + if(Z_LVAL_PP(pwho) == 1) who = RUSAGE_CHILDREN; } diff --git a/ext/standard/pack.c b/ext/standard/pack.c index ef7becfac2..60cdfc4db0 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -858,8 +858,8 @@ PHP_MINIT_FUNCTION(pack) } else { zval val; - int size = sizeof(val.value.lval); - val.value.lval=0; /*silence a warning*/ + int size = sizeof(Z_LVAL(val)); + Z_LVAL(val)=0; /*silence a warning*/ /* Where to get hi to lo bytes from */ byte_map[0] = size - 1; diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index c7f5a56282..46107f12b3 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -1219,7 +1219,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, result = SCAN_ERROR_EOF; } else if (numVars) { convert_to_long( *return_value ); - (*return_value)->value.lval = nconversions; + Z_LVAL_PP(return_value) = nconversions; } else if (nconversions < totalVars) { /* to do : not all elements converted. we need to prune the list - cc */ @@ -1233,8 +1233,8 @@ PHPAPI int php_sscanf_internal( char *string, char *format, static inline void scan_set_error_return(int numVars, pval **return_value) { if (numVars) { - (*return_value)->type = IS_LONG; - (*return_value)->value.lval = SCAN_ERROR_EOF; /* EOF marker */ + Z_TYPE_PP(return_value) = IS_LONG; + Z_LVAL_PP(return_value) = SCAN_ERROR_EOF; /* EOF marker */ } else { /* pval_destructor( *return_value ); */ /* convert_to_null calls destructor */ diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c index e52f1be5c1..bea945117b 100644 --- a/ext/standard/soundex.c +++ b/ext/standard/soundex.c @@ -66,11 +66,11 @@ PHP_FUNCTION(soundex) } convert_to_string_ex(parg); arg = *parg; - if (arg->value.str.len==0) { + if (Z_STRLEN_P(arg)==0) { RETURN_FALSE; } - somestring = arg->value.str.val; - len = arg->value.str.len; + somestring = Z_STRVAL_P(arg); + len = Z_STRLEN_P(arg); /* build soundex string */ last = -1; @@ -106,9 +106,9 @@ PHP_FUNCTION(soundex) } soundex[_small] = '\0'; - return_value->value.str.val = estrndup(soundex, _small); - return_value->value.str.len = _small; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = estrndup(soundex, _small); + Z_STRLEN_P(return_value) = _small; + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ diff --git a/ext/standard/string.c b/ext/standard/string.c index c8088dabc6..7b81d3245e 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -865,7 +865,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value) tmp_str[0] = 0; zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos); - while (zend_hash_get_current_data_ex(arr->value.ht, (void **) &tmp, &pos) == SUCCESS) { + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) == SUCCESS) { count--; memcpy(tmp_str + target, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); target += Z_STRLEN_PP(tmp); @@ -1768,7 +1768,7 @@ PHP_FUNCTION(quotemeta) RETURN_FALSE; } - str = emalloc(2 * (*arg)->value.str.len + 1); + str = emalloc(2 * Z_STRLEN_PP(arg) + 1); for(p = old, q = str; p != old_end; p++) { c = *p; @@ -1932,8 +1932,8 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable * break; case HASH_KEY_IS_LONG: - ctmp.type = IS_LONG; - ctmp.value.lval = num_key; + Z_TYPE(ctmp) = IS_LONG; + Z_LVAL(ctmp) = num_key; convert_to_string(&ctmp); len = Z_STRLEN(ctmp); @@ -2009,7 +2009,7 @@ PHP_FUNCTION(strtr) WRONG_PARAM_COUNT; } - if (ac == 2 && (*from)->type != IS_ARRAY) { + if (ac == 2 && Z_TYPE_PP(from) != IS_ARRAY) { php_error(E_WARNING, "arg2 must be passed an array"); RETURN_FALSE; } @@ -2817,7 +2817,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) RETURN_FALSE; } convert_to_long_ex(max_chars_per_line); - max_chars = (*max_chars_per_line)->value.lval; + max_chars = Z_LVAL_PP(max_chars_per_line); break; default: WRONG_PARAM_COUNT; @@ -2826,16 +2826,16 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) convert_to_string_ex(str); - if ((*str)->value.str.len==0) { + if (Z_STRLEN_PP(str)==0) { RETURN_FALSE; } - tmp = (*str)->value.str.val; + tmp = Z_STRVAL_PP(str); block_start=block_end=0; block_ended=0; - heb_str = (char *) emalloc((*str)->value.str.len+1); - target = heb_str+(*str)->value.str.len; + heb_str = (char *) emalloc(Z_STRLEN_PP(str)+1); + target = heb_str+Z_STRLEN_PP(str); opposite_target = heb_str; *target = 0; target--; @@ -2850,13 +2850,13 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) do { if (block_type==_HEB_BLOCK_TYPE_HEB) { - while((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<(*str)->value.str.len-1) { + while((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<Z_STRLEN_PP(str)-1) { tmp++; block_end++; block_length++; } for (i=block_start; i<=block_end; i++) { - *target = (*str)->value.str.val[i]; + *target = Z_STRVAL_PP(str)[i]; switch (*target) { case '(': *target = ')'; @@ -2871,7 +2871,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) } block_type = _HEB_BLOCK_TYPE_ENG; } else { - while(!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end<(*str)->value.str.len-1) { + while(!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end<Z_STRLEN_PP(str)-1) { tmp++; block_end++; block_length++; @@ -2881,17 +2881,17 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) block_end--; } for (i=block_end; i>=block_start; i--) { - *target = (*str)->value.str.val[i]; + *target = Z_STRVAL_PP(str)[i]; target--; } block_type = _HEB_BLOCK_TYPE_HEB; } block_start=block_end+1; - } while(block_end<(*str)->value.str.len-1); + } while(block_end<Z_STRLEN_PP(str)-1); - broken_str = (char *) emalloc((*str)->value.str.len+1); - begin=end=(*str)->value.str.len-1; + broken_str = (char *) emalloc(Z_STRLEN_PP(str)+1); + begin=end=Z_STRLEN_PP(str)-1; target = broken_str; while (1) { @@ -2950,12 +2950,12 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) efree(heb_str); if (convert_newlines) { - php_char_to_str(broken_str, (*str)->value.str.len,'\n', "<br>\n", 5, return_value); + php_char_to_str(broken_str, Z_STRLEN_PP(str),'\n', "<br>\n", 5, return_value); efree(broken_str); } else { - return_value->value.str.val = broken_str; - return_value->value.str.len = (*str)->value.str.len; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = broken_str; + Z_STRLEN_P(return_value) = Z_STRLEN_PP(str); + Z_TYPE_P(return_value) = IS_STRING; } } /* }}} */ @@ -2996,16 +2996,16 @@ PHP_FUNCTION(nl2br) } /* Windows style line-endings */ - tmp = php_str_to_str((*str)->value.str.val, (*str)->value.str.len, "\r\n", 2, "<br />\r\n", 8, &new_length); - if (new_length != (*str)->value.str.len) + tmp = php_str_to_str(Z_STRVAL_PP(str), Z_STRLEN_PP(str), "\r\n", 2, "<br />\r\n", 8, &new_length); + if (new_length != Z_STRLEN_PP(str)) RETURN_STRINGL (tmp, new_length, 0); efree (tmp); /* Mac / Unix style line-endings */ - if (php_char_to_str((*str)->value.str.val,(*str)->value.str.len, '\n',"<br />\n", 7, return_value)) + if (php_char_to_str(Z_STRVAL_PP(str),Z_STRLEN_PP(str), '\n',"<br />\n", 7, return_value)) return; efree (Z_STRVAL_P(return_value)); - php_char_to_str((*str)->value.str.val,(*str)->value.str.len, '\r',"<br />\r", 7, return_value); + php_char_to_str(Z_STRVAL_PP(str),Z_STRLEN_PP(str), '\r',"<br />\r", 7, return_value); } /* }}} */ @@ -3029,16 +3029,16 @@ PHP_FUNCTION(strip_tags) RETURN_FALSE; } convert_to_string_ex(allow); - allowed_tags = (*allow)->value.str.val; - allowed_tags_len = (*allow)->value.str.len; + allowed_tags = Z_STRVAL_PP(allow); + allowed_tags_len = Z_STRLEN_PP(allow); break; default: WRONG_PARAM_COUNT; break; } convert_to_string_ex(str); - buf = estrndup((*str)->value.str.val, (*str)->value.str.len); - php_strip_tags(buf, (*str)->value.str.len, 0, allowed_tags, allowed_tags_len); + buf = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str)); + php_strip_tags(buf, Z_STRLEN_PP(str), 0, allowed_tags, allowed_tags_len); RETURN_STRING(buf, 0); } /* }}} */ @@ -3066,31 +3066,31 @@ PHP_FUNCTION(setlocale) convert_to_string_ex(pcategory); category = *pcategory; - if (!strcasecmp ("LC_ALL", category->value.str.val)) + if (!strcasecmp ("LC_ALL", Z_STRVAL_P(category))) cat = LC_ALL; - else if (!strcasecmp ("LC_COLLATE", category->value.str.val)) + else if (!strcasecmp ("LC_COLLATE", Z_STRVAL_P(category))) cat = LC_COLLATE; - else if (!strcasecmp ("LC_CTYPE", category->value.str.val)) + else if (!strcasecmp ("LC_CTYPE", Z_STRVAL_P(category))) cat = LC_CTYPE; #ifdef LC_MESSAGES - else if (!strcasecmp ("LC_MESSAGES", category->value.str.val)) + else if (!strcasecmp ("LC_MESSAGES", Z_STRVAL_P(category))) cat = LC_MESSAGES; #endif - else if (!strcasecmp ("LC_MONETARY", category->value.str.val)) + else if (!strcasecmp ("LC_MONETARY", Z_STRVAL_P(category))) cat = LC_MONETARY; - else if (!strcasecmp ("LC_NUMERIC", category->value.str.val)) + else if (!strcasecmp ("LC_NUMERIC", Z_STRVAL_P(category))) cat = LC_NUMERIC; - else if (!strcasecmp ("LC_TIME", category->value.str.val)) + else if (!strcasecmp ("LC_TIME", Z_STRVAL_P(category))) cat = LC_TIME; else { - php_error(E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC or LC_TIME", category->value.str.val); + php_error(E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC or LC_TIME", Z_STRVAL_P(category)); RETURN_FALSE; } } - if (!strcmp ("0", locale->value.str.val)) { + if (!strcmp ("0", Z_STRVAL_P(locale))) { loc = NULL; } else { - loc = locale->value.str.val; + loc = Z_STRVAL_P(locale); } retval = setlocale (cat, loc); @@ -3127,8 +3127,8 @@ PHP_FUNCTION(parse_str) convert_to_string_ex(arg); sarg = *arg; - if (sarg->value.str.val && *sarg->value.str.val) { - res = estrndup(sarg->value.str.val, sarg->value.str.len); + if (Z_STRVAL_P(sarg) && *Z_STRVAL_P(sarg)) { + res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg)); } old_rg = PG(register_globals); @@ -3381,29 +3381,29 @@ PHP_FUNCTION(str_repeat) convert_to_string_ex(input_str); convert_to_long_ex(mult); - if ((*mult)->value.lval < 0) { + if (Z_LVAL_PP(mult) < 0) { php_error(E_WARNING, "Second argument to %s() has to be greater than or equal to 0", get_active_function_name(TSRMLS_C)); return; } /* Don't waste our time if it's empty */ - if ((*input_str)->value.str.len == 0) + if (Z_STRLEN_PP(input_str) == 0) RETURN_STRINGL(empty_string, 0, 1); /* ... or if the multiplier is zero */ - if ((*mult)->value.lval == 0) + if (Z_LVAL_PP(mult) == 0) RETURN_STRINGL(empty_string, 0, 1); /* Initialize the result string */ - result_len = (*input_str)->value.str.len * (*mult)->value.lval; + result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult); result = (char *)emalloc(result_len + 1); /* Copy the input string into the result as many times as necessary */ - for (i=0; i<(*mult)->value.lval; i++) { - memcpy(result + (*input_str)->value.str.len * i, - (*input_str)->value.str.val, - (*input_str)->value.str.len); + for (i=0; i<Z_LVAL_PP(mult); i++) { + memcpy(result + Z_STRLEN_PP(input_str) * i, + Z_STRVAL_PP(input_str), + Z_STRLEN_PP(input_str)); } result[result_len] = '\0'; @@ -3432,7 +3432,7 @@ PHP_FUNCTION(count_chars) if (ac == 2) { convert_to_long_ex(mode); - mymode = (*mode)->value.lval; + mymode = Z_LVAL_PP(mode); if (mymode < 0 || mymode > 4) { php_error(E_WARNING, "unknown mode"); @@ -3440,8 +3440,8 @@ PHP_FUNCTION(count_chars) } } - len = (*input)->value.str.len; - buf = (unsigned char *) (*input)->value.str.val; + len = Z_STRLEN_PP(input); + buf = (unsigned char *) Z_STRVAL_PP(input); memset((void*) chars, 0, sizeof(chars)); while (len > 0) { @@ -3600,8 +3600,8 @@ PHP_FUNCTION(localeconv) add_assoc_long( return_value, "n_sign_posn", CHAR_MAX ); #endif - zend_hash_update(return_value->value.ht, "grouping", 9, &grouping, sizeof(zval *), NULL); - zend_hash_update(return_value->value.ht, "mon_grouping", 13, &mon_grouping, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "grouping", 9, &grouping, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "mon_grouping", 13, &mon_grouping, sizeof(zval *), NULL); } /* }}} */ @@ -3628,24 +3628,24 @@ PHP_FUNCTION(substr_count) convert_to_string_ex(haystack); convert_to_string_ex(needle); - if ((*needle)->value.str.len == 0) { + if (Z_STRLEN_PP(needle) == 0) { php_error(E_WARNING, "Empty substring"); RETURN_FALSE; - } else if ((*needle)->value.str.len == 1) { + } else if (Z_STRLEN_PP(needle) == 1) { /* Special optimized case to avoid calls to php_memnstr(). */ - for (i = 0, p = (*haystack)->value.str.val, - length = (*haystack)->value.str.len, cmp = (*needle)->value.str.val[0]; + for (i = 0, p = Z_STRVAL_PP(haystack), + length = Z_STRLEN_PP(haystack), cmp = Z_STRVAL_PP(needle)[0]; i < length; i++) { if (p[i] == cmp) { count++; } } } else { - p = (*haystack)->value.str.val; - endp = p + (*haystack)->value.str.len; + p = Z_STRVAL_PP(haystack); + endp = p + Z_STRLEN_PP(haystack); while (p <= endp) { - if( (p = php_memnstr(p, (*needle)->value.str.val, (*needle)->value.str.len, endp)) != NULL ) { - p += (*needle)->value.str.len; + if( (p = php_memnstr(p, Z_STRVAL_PP(needle), Z_STRLEN_PP(needle), endp)) != NULL ) { + p += Z_STRLEN_PP(needle); count++; } else { break; diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index 74d99abace..d3e05fa5e9 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -217,8 +217,8 @@ PHP_FUNCTION(openlog) if (BG(syslog_device)) { efree(BG(syslog_device)); } - BG(syslog_device) = estrndup((*ident)->value.str.val, (*ident)->value.str.len); - openlog(BG(syslog_device), (*option)->value.lval, (*facility)->value.lval); + BG(syslog_device) = estrndup(Z_STRVAL_PP(ident), Z_STRLEN_PP(ident)); + openlog(BG(syslog_device), Z_LVAL_PP(option), Z_LVAL_PP(facility)); RETURN_TRUE; } /* }}} */ @@ -253,7 +253,7 @@ PHP_FUNCTION(syslog) * this will cause problems. */ - php_syslog((*priority)->value.lval, "%.500s", (*message)->value.str.val); + php_syslog(Z_LVAL_PP(priority), "%.500s", Z_STRVAL_PP(message)); RETURN_TRUE; } /* }}} */ diff --git a/ext/standard/var.c b/ext/standard/var.c index 0f07f035fc..5b11a5247f 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -491,9 +491,9 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has INIT_PZVAL(*rval); if (cur == 'a') { - (*rval)->type = IS_ARRAY; - ALLOC_HASHTABLE((*rval)->value.ht); - myht = (*rval)->value.ht; + Z_TYPE_PP(rval) = IS_ARRAY; + ALLOC_HASHTABLE(Z_ARRVAL_PP(rval)); + myht = Z_ARRVAL_PP(rval); } else { zend_class_entry *ce; @@ -573,7 +573,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has FREE_ZVAL(data); return 0; } - switch (key->type) { + switch (Z_TYPE_P(key)) { case IS_LONG: zend_hash_index_update(myht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; @@ -585,7 +585,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has FREE_ZVAL(key); } - if ((*rval)->type == IS_OBJECT) { + if (Z_TYPE_PP(rval) == IS_OBJECT) { zval *retval_ptr = NULL; zval fname; @@ -617,9 +617,9 @@ PHP_FUNCTION(serialize) WRONG_PARAM_COUNT; } - return_value->type = IS_STRING; - return_value->value.str.val = NULL; - return_value->value.str.len = 0; + Z_TYPE_P(return_value) = IS_STRING; + Z_STRVAL_P(return_value) = NULL; + Z_STRLEN_P(return_value) = 0; PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); @@ -641,8 +641,8 @@ PHP_FUNCTION(unserialize) WRONG_PARAM_COUNT; } - if ((*buf)->type == IS_STRING) { - const char *p = (*buf)->value.str.val; + if (Z_TYPE_PP(buf) == IS_STRING) { + const char *p = Z_STRVAL_PP(buf); if (Z_STRLEN_PP(buf) == 0) { RETURN_FALSE; diff --git a/ext/swf/swf.c b/ext/swf/swf.c index e4c192fb20..de7eb545b0 100644 --- a/ext/swf/swf.c +++ b/ext/swf/swf.c @@ -591,7 +591,7 @@ PHP_FUNCTION(swf_definepoly) convert_to_long_ex(NumPoints); convert_to_double_ex(width); - if ((*coordinates)->type != IS_ARRAY) { + if (Z_TYPE_PP(coordinates) != IS_ARRAY) { return; php_error(E_WARNING, "Wrong datatype of second argument to swf_definepoly"); } diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c index ef4c5c196b..6bd9ac2f80 100644 --- a/ext/sybase/php_sybase_db.c +++ b/ext/sybase/php_sybase_db.c @@ -164,7 +164,7 @@ static int php_sybase_message_handler(DBPROCESS *dbproc,DBINT msgno,int msgstate static int _clean_invalid_results(list_entry *le TSRMLS_DC) { - if (le->type == php_sybase_module.le_result) { + if (Z_TYPE_P(le) == php_sybase_module.le_result) { sybase_link *sybase_ptr = ((sybase_result *) le->ptr)->sybase_ptr; if (!sybase_ptr->valid) { @@ -318,10 +318,10 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) RETURN_FALSE; } convert_to_string(yyhost); - host = yyhost->value.str.val; - hashed_details_length = yyhost->value.str.len+6+4; + host = Z_STRVAL_P(yyhost); + hashed_details_length = Z_STRLEN_P(yyhost)+6+4; hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s___",yyhost->value.str.val); + sprintf(hashed_details,"sybase_%s___",Z_STRVAL_P(yyhost)); } break; case 2: { @@ -332,11 +332,11 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) } convert_to_string(yyhost); convert_to_string(yyuser); - host = yyhost->value.str.val; - user = yyuser->value.str.val; - hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+6+4; + host = Z_STRVAL_P(yyhost); + user = Z_STRVAL_P(yyuser); + hashed_details_length = Z_STRLEN_P(yyhost)+Z_STRLEN_P(yyuser)+6+4; hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s_%s__",yyhost->value.str.val,yyuser->value.str.val); + sprintf(hashed_details,"sybase_%s_%s__",Z_STRVAL_P(yyhost),Z_STRVAL_P(yyuser)); } break; case 3: { @@ -348,12 +348,12 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) convert_to_string(yyhost); convert_to_string(yyuser); convert_to_string(yypasswd); - host = yyhost->value.str.val; - user = yyuser->value.str.val; - passwd = yypasswd->value.str.val; - hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+yypasswd->value.str.len+6+4; + host = Z_STRVAL_P(yyhost); + user = Z_STRVAL_P(yyuser); + passwd = Z_STRVAL_P(yypasswd); + hashed_details_length = Z_STRLEN_P(yyhost)+Z_STRLEN_P(yyuser)+Z_STRLEN_P(yypasswd)+6+4; hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s_%s_%s_",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val); /* SAFE */ + sprintf(hashed_details,"sybase_%s_%s_%s_",Z_STRVAL_P(yyhost),Z_STRVAL_P(yyuser),Z_STRVAL_P(yypasswd)); /* SAFE */ } break; case 4: { @@ -366,13 +366,13 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) convert_to_string(yyuser); convert_to_string(yypasswd); convert_to_string(yycharset); - host = yyhost->value.str.val; - user = yyuser->value.str.val; - passwd = yypasswd->value.str.val; - charset = yycharset->value.str.val; - hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+yypasswd->value.str.len+yycharset->value.str.len+6+4; + host = Z_STRVAL_P(yyhost); + user = Z_STRVAL_P(yyuser); + passwd = Z_STRVAL_P(yypasswd); + charset = Z_STRVAL_P(yycharset); + hashed_details_length = Z_STRLEN_P(yyhost)+Z_STRLEN_P(yyuser)+Z_STRLEN_P(yypasswd)+Z_STRLEN_P(yycharset)+6+4; hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s_%s_%s_%s",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val,yycharset->value.str.val); /* SAFE */ + sprintf(hashed_details,"sybase_%s_%s_%s_%s",Z_STRVAL_P(yyhost),Z_STRVAL_P(yyuser),Z_STRVAL_P(yypasswd),Z_STRVAL_P(yycharset)); /* SAFE */ } break; default: @@ -439,7 +439,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) /* hash it up */ sybase_ptr = (sybase_link *) malloc(sizeof(sybase_link)); memcpy(sybase_ptr,&sybase,sizeof(sybase_link)); - new_le.type = php_sybase_module.le_plink; + Z_TYPE(new_le) = php_sybase_module.le_plink; new_le.ptr = sybase_ptr; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) { free(sybase_ptr); @@ -450,7 +450,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) php_sybase_module.num_persistent++; php_sybase_module.num_links++; } else { /* we do */ - if (le->type != php_sybase_module.le_plink) { + if (Z_TYPE_P(le) != php_sybase_module.le_plink) { php_error(E_WARNING,"Sybase: Hashed persistent link is not a Sybase link!"); RETURN_FALSE; } @@ -471,8 +471,8 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) } } } - return_value->value.lval = zend_list_insert(sybase_ptr,php_sybase_module.le_plink); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(sybase_ptr,php_sybase_module.le_plink); + Z_TYPE_P(return_value) = IS_LONG; } else { /* non persistent */ list_entry *index_ptr,new_index_ptr; @@ -485,14 +485,14 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) int type,link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (int) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==php_sybase_module.le_link || type==php_sybase_module.le_plink)) { - return_value->value.lval = php_sybase_module.default_link = link; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = php_sybase_module.default_link = link; + Z_TYPE_P(return_value) = IS_LONG; efree(hashed_details); return; } else { @@ -521,12 +521,12 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) /* add it to the list */ sybase_ptr = (sybase_link *) emalloc(sizeof(sybase_link)); memcpy(sybase_ptr,&sybase,sizeof(sybase_link)); - return_value->value.lval = zend_list_insert(sybase_ptr,php_sybase_module.le_link); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(sybase_ptr,php_sybase_module.le_link); + Z_TYPE_P(return_value) = IS_LONG; /* add it to the hash */ - new_index_ptr.ptr = (void *) return_value->value.lval; - new_index_ptr.type = le_index_ptr; + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) { efree(hashed_details); RETURN_FALSE; @@ -534,7 +534,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) php_sybase_module.num_links++; } efree(hashed_details); - php_sybase_module.default_link=return_value->value.lval; + php_sybase_module.default_link=Z_LVAL_P(return_value); } @@ -580,7 +580,7 @@ PHP_FUNCTION(sybase_close) RETURN_FALSE; } convert_to_long(sybase_link_index); - id = sybase_link_index->value.lval; + id = Z_LVAL_P(sybase_link_index); break; default: WRONG_PARAM_COUNT; @@ -619,7 +619,7 @@ PHP_FUNCTION(sybase_select_db) RETURN_FALSE; } convert_to_long(sybase_link_index); - id = sybase_link_index->value.lval; + id = Z_LVAL_P(sybase_link_index); break; default: WRONG_PARAM_COUNT; @@ -636,7 +636,7 @@ PHP_FUNCTION(sybase_select_db) convert_to_string(db); - if (dbuse(sybase_ptr->link,db->value.str.val)==FAIL) { + if (dbuse(sybase_ptr->link,Z_STRVAL_P(db))==FAIL) { /*php_error(E_WARNING,"Sybase: Unable to select database: %s",sybase_error(sybase));*/ RETURN_FALSE; } else { @@ -662,8 +662,8 @@ static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pva { case SYBINT2: case SYBINT4: { - result->value.lval = (long) anyintcol(offset); - result->type = IS_LONG; + Z_LVAL_P(result) = (long) anyintcol(offset); + Z_TYPE_P(result) = IS_LONG; break; } case SYBCHAR: @@ -675,15 +675,15 @@ static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pva while (length>0 && charcol(offset)[length-1] == ' ') { /* nuke trailing whitespace */ length--; } - result->value.str.val = estrndup(data,length); - result->value.str.len = length; - result->type = IS_STRING; + Z_STRVAL_P(result) = estrndup(data,length); + Z_STRLEN_P(result) = length; + Z_TYPE_P(result) = IS_STRING; break; } /*case SYBFLT8:*/ case SYBREAL: { - result->value.dval = (double) floatcol(offset); - result->type = IS_DOUBLE; + Z_DVAL_P(result) = (double) floatcol(offset); + Z_TYPE_P(result) = IS_DOUBLE; break; } default: { @@ -720,9 +720,9 @@ static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pva } *(++p) = 0; /* put a trailing NULL */ - result->value.str.len = res_length; - result->value.str.val = res_buf; - result->type = IS_STRING; + Z_STRLEN_P(result) = res_length; + Z_STRVAL_P(result) = res_buf; + Z_TYPE_P(result) = IS_STRING; } else { php_error(E_WARNING,"Sybase: column %d has unknown data type (%d)", offset, coltype(offset)); ZVAL_FALSE(result); @@ -757,7 +757,7 @@ PHP_FUNCTION(sybase_query) RETURN_FALSE; } convert_to_long(sybase_link_index); - id = sybase_link_index->value.lval; + id = Z_LVAL_P(sybase_link_index); break; default: WRONG_PARAM_COUNT; @@ -771,7 +771,7 @@ PHP_FUNCTION(sybase_query) } convert_to_string(query); - if (dbcmd(sybase_ptr->link,query->value.str.val)==FAIL) { + if (dbcmd(sybase_ptr->link,Z_STRVAL_P(query))==FAIL) { /*php_error(E_WARNING,"Sybase: Unable to set query");*/ RETURN_FALSE; } @@ -822,7 +822,7 @@ PHP_FUNCTION(sybase_query) convert_to_string(cur_value); if (PG(magic_quotes_runtime)) { - cur_value->value.str.val = php_addslashes(cur_value->value.str.val, cur_value->value.str.len, &cur_value->value.str.len,0 TSRMLS_CC); + Z_STRVAL_P(cur_value) = php_addslashes(Z_STRVAL_P(cur_value), Z_STRLEN_P(cur_value), &Z_STRLEN_P(cur_value),0 TSRMLS_CC); } } } @@ -854,7 +854,7 @@ PHP_FUNCTION(sybase_query) if (!result->fields[i].column_source) { result->fields[i].column_source = empty_string; } - result->fields[i].type = column_types[i]; + result->Z_TYPE(fields[i]) = column_types[i]; /* set numeric flag */ switch (column_types[i]) { case SYBINT2: @@ -871,8 +871,8 @@ PHP_FUNCTION(sybase_query) } } efree(column_types); - return_value->value.lval = zend_list_insert(result,php_sybase_module.le_result); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(result,php_sybase_module.le_result); + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -890,16 +890,16 @@ PHP_FUNCTION(sybase_free_result) } convert_to_long(sybase_result_index); - if (sybase_result_index->value.lval==0) { + if (Z_LVAL_P(sybase_result_index)==0) { RETURN_FALSE; } - result = (sybase_result *) zend_list_find(sybase_result_index->value.lval,&type); + result = (sybase_result *) zend_list_find(Z_LVAL_P(sybase_result_index),&type); if (type!=php_sybase_module.le_result) { - php_error(E_WARNING,"%d is not a Sybase result index",sybase_result_index->value.lval); + php_error(E_WARNING,"%d is not a Sybase result index",Z_LVAL_P(sybase_result_index)); RETURN_FALSE; } - zend_list_delete(sybase_result_index->value.lval); + zend_list_delete(Z_LVAL_P(sybase_result_index)); RETURN_TRUE; } /* }}} */ @@ -927,7 +927,7 @@ PHP_FUNCTION(sybase_num_rows) } convert_to_long(result_index); - id = result_index->value.lval; + id = Z_LVAL_P(result_index); result = (sybase_result *) zend_list_find(id,&type); if (type!=php_sybase_module.le_result) { @@ -935,8 +935,8 @@ PHP_FUNCTION(sybase_num_rows) RETURN_FALSE; } - return_value->value.lval = result->num_rows; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = result->num_rows; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -953,7 +953,7 @@ PHP_FUNCTION(sybase_num_fields) } convert_to_long(result_index); - id = result_index->value.lval; + id = Z_LVAL_P(result_index); result = (sybase_result *) zend_list_find(id,&type); if (type!=php_sybase_module.le_result) { @@ -961,8 +961,8 @@ PHP_FUNCTION(sybase_num_fields) RETURN_FALSE; } - return_value->value.lval = result->num_fields; - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = result->num_fields; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -980,7 +980,7 @@ PHP_FUNCTION(sybase_fetch_row) } convert_to_long(sybase_result_index); - id = sybase_result_index->value.lval; + id = Z_LVAL_P(sybase_result_index); result = (sybase_result *) zend_list_find(id,&type); if (type!=php_sybase_module.le_result) { @@ -995,7 +995,7 @@ PHP_FUNCTION(sybase_fetch_row) array_init(return_value); for (i=0; i<result->num_fields; i++) { ZVAL_ADDREF(result->data[result->cur_row][i]); - zend_hash_index_update(return_value->value.ht, i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL); } result->cur_row++; } @@ -1014,10 +1014,10 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS) } convert_to_long(sybase_result_index); - result = (sybase_result *) zend_list_find(sybase_result_index->value.lval,&type); + result = (sybase_result *) zend_list_find(Z_LVAL_P(sybase_result_index),&type); if (type!=php_sybase_module.le_result) { - php_error(E_WARNING,"%d is not a Sybase result index",sybase_result_index->value.lval); + php_error(E_WARNING,"%d is not a Sybase result index",Z_LVAL_P(sybase_result_index)); RETURN_FALSE; } @@ -1031,9 +1031,9 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS) for (i=0; i<result->num_fields; i++) { ZVAL_ADDREF(result->data[result->cur_row][i]); - zend_hash_index_update(return_value->value.ht, i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL); ZVAL_ADDREF(result->data[result->cur_row][i]); - zend_hash_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL); } result->cur_row++; } @@ -1044,9 +1044,9 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS) PHP_FUNCTION(sybase_fetch_object) { php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU); - if (return_value->type==IS_ARRAY) { - return_value->type=IS_OBJECT; - Z_OBJPROP_P(return_value) = return_value->value.ht; + if (Z_TYPE_P(return_value)==IS_ARRAY) { + Z_TYPE_P(return_value)=IS_OBJECT; + Z_OBJPROP_P(return_value) = Z_ARRVAL_P(return_value); Z_OBJCE_P(return_value) = &zend_standard_class_def; } } @@ -1073,7 +1073,7 @@ PHP_FUNCTION(sybase_data_seek) } convert_to_long(sybase_result_index); - id = sybase_result_index->value.lval; + id = Z_LVAL_P(sybase_result_index); result = (sybase_result *) zend_list_find(id,&type); if (type!=php_sybase_module.le_result) { @@ -1082,12 +1082,12 @@ PHP_FUNCTION(sybase_data_seek) } convert_to_long(offset); - if (offset->value.lval<0 || offset->value.lval>=result->num_rows) { + if (Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)>=result->num_rows) { php_error(E_WARNING,"Sybase: Bad row offset"); RETURN_FALSE; } - result->cur_row = offset->value.lval; + result->cur_row = Z_LVAL_P(offset); RETURN_TRUE; } /* }}} */ @@ -1159,7 +1159,7 @@ PHP_FUNCTION(sybase_fetch_field) RETURN_FALSE; } convert_to_long(offset); - field_offset = offset->value.lval; + field_offset = Z_LVAL_P(offset); break; default: WRONG_PARAM_COUNT; @@ -1167,7 +1167,7 @@ PHP_FUNCTION(sybase_fetch_field) } convert_to_long(sybase_result_index); - id = sybase_result_index->value.lval; + id = Z_LVAL_P(sybase_result_index); result = (sybase_result *) zend_list_find(id,&type); if (type!=php_sybase_module.le_result) { @@ -1194,7 +1194,7 @@ PHP_FUNCTION(sybase_fetch_field) add_property_long(return_value, "max_length",result->fields[field_offset].max_length); add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1); add_property_long(return_value, "numeric", result->fields[field_offset].numeric); - add_property_string(return_value, "type", php_sybase_get_field_name(result->fields[field_offset].type), 1); + add_property_string(return_value, "type", php_sybase_get_field_name(result->Z_TYPE(fields[field_offset])), 1); } /* }}} */ @@ -1211,7 +1211,7 @@ PHP_FUNCTION(sybase_field_seek) } convert_to_long(sybase_result_index); - id = sybase_result_index->value.lval; + id = Z_LVAL_P(sybase_result_index); result = (sybase_result *) zend_list_find(id,&type); if (type!=php_sybase_module.le_result) { @@ -1220,7 +1220,7 @@ PHP_FUNCTION(sybase_field_seek) } convert_to_long(offset); - field_offset = offset->value.lval; + field_offset = Z_LVAL_P(offset); if (field_offset<0 || field_offset >= result->num_fields) { php_error(E_WARNING,"Sybase: Bad column offset"); @@ -1246,7 +1246,7 @@ PHP_FUNCTION(sybase_result) } convert_to_long(sybase_result_index); - id = sybase_result_index->value.lval; + id = Z_LVAL_P(sybase_result_index); result = (sybase_result *) zend_list_find(id,&type); if (type!=php_sybase_module.le_result) { @@ -1255,30 +1255,30 @@ PHP_FUNCTION(sybase_result) } convert_to_long(row); - if (row->value.lval<0 || row->value.lval>=result->num_rows) { - php_error(E_WARNING,"Sybase: Bad row offset (%d)",row->value.lval); + if (Z_LVAL_P(row)<0 || Z_LVAL_P(row)>=result->num_rows) { + php_error(E_WARNING,"Sybase: Bad row offset (%d)",Z_LVAL_P(row)); RETURN_FALSE; } - switch(field->type) { + switch(Z_TYPE_P(field)) { case IS_STRING: { int i; for (i=0; i<result->num_fields; i++) { - if (!strcasecmp(result->fields[i].name,field->value.str.val)) { + if (!strcasecmp(result->fields[i].name,Z_STRVAL_P(field))) { field_offset = i; break; } } if (i>=result->num_fields) { /* no match found */ - php_error(E_WARNING,"Sybase: %s field not found in result",field->value.str.val); + php_error(E_WARNING,"Sybase: %s field not found in result",Z_STRVAL_P(field)); RETURN_FALSE; } break; } default: convert_to_long(field); - field_offset = field->value.lval; + field_offset = Z_LVAL_P(field); if (field_offset<0 || field_offset>=result->num_fields) { php_error(E_WARNING,"Sybase: Bad column offset specified"); RETURN_FALSE; @@ -1286,7 +1286,7 @@ PHP_FUNCTION(sybase_result) break; } - *return_value = *result->data[row->value.lval][field_offset]; + *return_value = *result->Z_LVAL_P(data[row)][field_offset]; pval_copy_constructor(return_value); } /* }}} */ @@ -1317,7 +1317,7 @@ PHP_FUNCTION(sybase_affected_rows) } convert_to_long(sybase_link_index); - id = sybase_link_index->value.lval; + id = Z_LVAL_P(sybase_link_index); } break; @@ -1336,8 +1336,8 @@ PHP_FUNCTION(sybase_affected_rows) RETURN_FALSE; } - return_value->value.lval = DBCOUNT(sybase_ptr->link); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = DBCOUNT(sybase_ptr->link); + Z_TYPE_P(return_value) = IS_LONG; } @@ -1381,7 +1381,7 @@ PHP_FUNCTION(sybase_min_error_severity) WRONG_PARAM_COUNT; } convert_to_long(severity); - php_sybase_module.min_error_severity = severity->value.lval; + php_sybase_module.min_error_severity = Z_LVAL_P(severity); } /* }}} */ @@ -1395,7 +1395,7 @@ PHP_FUNCTION(sybase_min_message_severity) WRONG_PARAM_COUNT; } convert_to_long(severity); - php_sybase_module.min_message_severity = severity->value.lval; + php_sybase_module.min_message_severity = Z_LVAL_P(severity); } /* }}} */ diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index 66b6ed29d4..47670e921e 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -97,7 +97,7 @@ ZEND_DECLARE_MODULE_GLOBALS(sybase) static int _clean_invalid_results(list_entry *le TSRMLS_DC) { - if (le->type == le_result) { + if (Z_TYPE_P(le) == le_result) { sybase_link *sybase_ptr = ((sybase_result *) le->ptr)->sybase_ptr; if (!sybase_ptr->valid) { @@ -555,7 +555,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } /* hash it up */ - new_le.type = le_plink; + Z_TYPE(new_le) = le_plink; new_le.ptr = sybase_ptr; if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { ct_close(sybase_ptr->connection, CS_UNUSED); @@ -569,7 +569,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } else { /* we do */ CS_INT con_status; - if (le->type != le_plink) { + if (Z_TYPE_P(le) != le_plink) { efree(hashed_details); RETURN_FALSE; } @@ -623,7 +623,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) int type, link; void *ptr; - if (index_ptr->type != le_index_ptr) { + if (Z_TYPE_P(index_ptr) != le_index_ptr) { efree(hashed_details); RETURN_FALSE; } @@ -632,7 +632,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); Z_LVAL_P(return_value) = SybCtG(default_link) = link; - return_value->type = IS_RESOURCE; + Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; } else { @@ -657,7 +657,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* add it to the hash */ new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); - new_index_ptr.type = le_index_ptr; + Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) { ct_close(sybase_ptr->connection, CS_UNUSED); ct_con_drop(sybase_ptr->connection); @@ -979,9 +979,9 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr) if (indicators[j] == -1) { /* null value */ ZVAL_FALSE(&result->data[i][j]); } else { - result->data[i][j].value.str.len = lengths[j]-1; /* we don't need the NULL in the length */ - result->data[i][j].value.str.val = estrndup(tmp_buffer[j], lengths[j]); - result->data[i][j].type = IS_STRING; + result->Z_STRLEN(data[i][j]) = lengths[j]-1; /* we don't need the NULL in the length */ + result->Z_STRVAL(data[i][j]) = estrndup(tmp_buffer[j], lengths[j]); + result->Z_TYPE(data[i][j]) = IS_STRING; } } } @@ -1009,7 +1009,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr) result->fields[i].column_source = empty_string; result->fields[i].max_length = datafmt[i].maxlength-1; result->fields[i].numeric = numerics[i]; - result->fields[i].type = types[i]; + result->Z_TYPE(fields[i]) = types[i]; } } @@ -1081,7 +1081,7 @@ PHP_FUNCTION(sybase_query) /* On Solaris 11.5, ct_command() can be moved outside the * loop, but not on Linux 11.0. */ - if (ct_command(sybase_ptr->cmd, CS_LANG_CMD, (*query)->value.str.val, CS_NULLTERM, CS_UNUSED)!=CS_SUCCEED) { + if (ct_command(sybase_ptr->cmd, CS_LANG_CMD, Z_STRVAL_PP(query), CS_NULLTERM, CS_UNUSED)!=CS_SUCCEED) { /* If this didn't work, the connection is screwed but * ct-lib might not set CS_CONSTAT_DEAD. So set our own * flag. This happens sometimes when the database is restarted @@ -1249,7 +1249,7 @@ PHP_FUNCTION(sybase_free_result) WRONG_PARAM_COUNT; } - if (sybase_result_index->type==IS_RESOURCE + if (Z_TYPE_P(sybase_result_index)==IS_RESOURCE && Z_LVAL_P(sybase_result_index)==0) { RETURN_FALSE; } @@ -1284,7 +1284,7 @@ PHP_FUNCTION(sybase_num_rows) ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); Z_LVAL_P(return_value) = result->num_rows; - return_value->type = IS_LONG; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1303,7 +1303,7 @@ PHP_FUNCTION(sybase_num_fields) ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); Z_LVAL_P(return_value) = result->num_fields; - return_value->type = IS_LONG; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1365,7 +1365,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS) ALLOC_ZVAL(tmp); *tmp = result->data[result->cur_row][i]; INIT_PZVAL(tmp); - if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) { + if (PG(magic_quotes_runtime) && Z_TYPE_P(tmp) == IS_STRING) { Z_STRVAL_P(tmp) = php_addslashes(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &Z_STRLEN_P(tmp), 0 TSRMLS_CC); } else { pval_copy_constructor(tmp); @@ -1383,7 +1383,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS) PHP_FUNCTION(sybase_fetch_object) { php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU); - if (return_value->type==IS_ARRAY) { + if (Z_TYPE_P(return_value)==IS_ARRAY) { object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value)); } } @@ -1514,7 +1514,7 @@ PHP_FUNCTION(sybase_fetch_field) add_property_long(return_value, "max_length", result->fields[field_offset].max_length); add_property_string(return_value, "column_source", result->fields[field_offset].column_source, 1); add_property_long(return_value, "numeric", result->fields[field_offset].numeric); - add_property_string(return_value, "type", php_sybase_get_field_name(result->fields[field_offset].type), 1); + add_property_string(return_value, "type", php_sybase_get_field_name(result->Z_TYPE(fields[field_offset])), 1); } /* }}} */ @@ -1568,7 +1568,7 @@ PHP_FUNCTION(sybase_result) RETURN_FALSE; } - switch(field->type) { + switch(Z_TYPE_P(field)) { case IS_STRING: { int i; @@ -1626,7 +1626,7 @@ PHP_FUNCTION(sybase_affected_rows) ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink); Z_LVAL_P(return_value) = sybase_ptr->affected_rows; - return_value->type = IS_LONG; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c index 879c58db52..5f9a2d8d65 100644 --- a/ext/sysvsem/sysvsem.c +++ b/ext/sysvsem/sysvsem.c @@ -176,16 +176,16 @@ PHP_FUNCTION(sem_get) RETURN_FALSE; } convert_to_long_ex(arg_key); - key = (int)(*arg_key)->value.lval; + key = (int)Z_LVAL_PP(arg_key); break; case 2: if (zend_get_parameters_ex(2, &arg_key, &arg_max_acquire)==FAILURE) { RETURN_FALSE; } convert_to_long_ex(arg_key); - key = (int)(*arg_key)->value.lval; + key = (int)Z_LVAL_PP(arg_key); convert_to_long_ex(arg_max_acquire); - max_acquire = (int)(*arg_max_acquire)->value.lval; + max_acquire = (int)Z_LVAL_PP(arg_max_acquire); break; case 3: if (zend_get_parameters_ex(3, &arg_key, &arg_max_acquire, &arg_perm)==FAILURE) { @@ -194,9 +194,9 @@ PHP_FUNCTION(sem_get) convert_to_long_ex(arg_key); convert_to_long_ex(arg_max_acquire); convert_to_long_ex(arg_perm); - key = (int)(*arg_key)->value.lval; - max_acquire = (int)(*arg_max_acquire)->value.lval; - perm = (int)(*arg_perm)->value.lval; + key = (int)Z_LVAL_PP(arg_key); + max_acquire = (int)Z_LVAL_PP(arg_max_acquire); + perm = (int)Z_LVAL_PP(arg_perm); break; default: WRONG_PARAM_COUNT; @@ -298,10 +298,10 @@ PHP_FUNCTION(sem_get) sem_ptr->semid = semid; sem_ptr->count = 0; - return_value->value.lval = zend_list_insert(sem_ptr, php_sysvsem_module.le_sem); - return_value->type = IS_LONG; + Z_LVAL_P(return_value) = zend_list_insert(sem_ptr, php_sysvsem_module.le_sem); + Z_TYPE_P(return_value) = IS_LONG; - sem_ptr->id = (int)return_value->value.lval; + sem_ptr->id = (int)Z_LVAL_P(return_value); } /* }}} */ @@ -320,7 +320,7 @@ static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire) RETURN_FALSE; } convert_to_long_ex(arg_id); - id = (int)(*arg_id)->value.lval; + id = (int)Z_LVAL_PP(arg_id); break; default: WRONG_PARAM_COUNT; @@ -392,7 +392,7 @@ PHP_FUNCTION(sem_remove) } convert_to_long_ex(arg_id); - id = (*arg_id)->value.lval; + id = Z_LVAL_PP(arg_id); sem_ptr = (sysvsem_sem *) zend_list_find(id, &type); diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index e2067ea084..6e80e3268a 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -116,13 +116,13 @@ PHP_FUNCTION(shm_attach) switch (ac) { case 3: convert_to_long_ex(arg_flag); - shm_flag = (*arg_flag)->value.lval; + shm_flag = Z_LVAL_PP(arg_flag); case 2: convert_to_long_ex(arg_size); - shm_size= (*arg_size)->value.lval; + shm_size= Z_LVAL_PP(arg_size); case 1: convert_to_long_ex(arg_key); - shm_key = (*arg_key)->value.lval; + shm_key = Z_LVAL_PP(arg_key); } if((shm_list_ptr = (sysvshm_shm *) emalloc(sizeof(sysvshm_shm)))==NULL) { @@ -179,7 +179,7 @@ PHP_FUNCTION(shm_detach) convert_to_long_ex(arg_id); - id = (*arg_id)->value.lval; + id = Z_LVAL_PP(arg_id); zend_list_delete(id); @@ -203,7 +203,7 @@ PHP_FUNCTION(shm_remove) convert_to_long_ex(arg_id); - id = (*arg_id)->value.lval; + id = Z_LVAL_PP(arg_id); shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); if(shmctl(shm_list_ptr->id,IPC_RMID,NULL)<0) { @@ -232,9 +232,9 @@ PHP_FUNCTION(shm_put_var) } convert_to_long_ex(arg_id); - id = (*arg_id)->value.lval; + id = Z_LVAL_PP(arg_id); convert_to_long_ex(arg_key); - key = (*arg_key)->value.lval; + key = Z_LVAL_PP(arg_key); shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); if (type!=php_sysvshm.le_shm) { @@ -279,9 +279,9 @@ PHP_FUNCTION(shm_get_var) } convert_to_long_ex(arg_id); - id = (*arg_id)->value.lval; + id = Z_LVAL_PP(arg_id); convert_to_long_ex(arg_key); - key = (*arg_key)->value.lval; + key = Z_LVAL_PP(arg_key); shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); if (type!=php_sysvshm.le_shm) { @@ -325,9 +325,9 @@ PHP_FUNCTION(shm_remove_var) } convert_to_long_ex(arg_id); - id = (*arg_id)->value.lval; + id = Z_LVAL_PP(arg_id); convert_to_long_ex(arg_key); - key = (*arg_key)->value.lval; + key = Z_LVAL_PP(arg_key); shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); if (type!=php_sysvshm.le_shm) { diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 290673e4cc..80242507f9 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -681,7 +681,7 @@ static void php_wddx_push_element(void *user_data, const char *name, const char } } } else if (!strcmp(name, EL_STRING)) { - ent.type = ST_STRING; + Z_TYPE(ent) = ST_STRING; SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); @@ -691,7 +691,7 @@ static void php_wddx_push_element(void *user_data, const char *name, const char Z_STRLEN_P(ent.data) = 0; wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_BINARY)) { - ent.type = ST_BINARY; + Z_TYPE(ent) = ST_BINARY; SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); @@ -711,7 +711,7 @@ static void php_wddx_push_element(void *user_data, const char *name, const char } } } else if (!strcmp(name, EL_NUMBER)) { - ent.type = ST_NUMBER; + Z_TYPE(ent) = ST_NUMBER; SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); @@ -723,7 +723,7 @@ static void php_wddx_push_element(void *user_data, const char *name, const char for (i=0; atts[i]; i++) { if (!strcmp(atts[i], EL_VALUE) && atts[i+1]) { - ent.type = ST_BOOLEAN; + Z_TYPE(ent) = ST_BOOLEAN; SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); @@ -734,7 +734,7 @@ static void php_wddx_push_element(void *user_data, const char *name, const char } } } else if (!strcmp(name, EL_NULL)) { - ent.type = ST_NULL; + Z_TYPE(ent) = ST_NULL; SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); @@ -743,7 +743,7 @@ static void php_wddx_push_element(void *user_data, const char *name, const char wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_ARRAY)) { - ent.type = ST_ARRAY; + Z_TYPE(ent) = ST_ARRAY; SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); @@ -751,7 +751,7 @@ static void php_wddx_push_element(void *user_data, const char *name, const char INIT_PZVAL(ent.data); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_STRUCT)) { - ent.type = ST_STRUCT; + Z_TYPE(ent) = ST_STRUCT; SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); diff --git a/ext/xml/xml.c b/ext/xml/xml.c index b8f190ceca..abc3b2ccb7 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -241,8 +241,8 @@ static zval *_xml_resource_zval(long value) MAKE_STD_ZVAL(ret); - ret->type = IS_RESOURCE; - ret->value.lval = value; + Z_TYPE_P(ret) = IS_RESOURCE; + Z_LVAL_P(ret) = value; zend_list_addref(value); @@ -255,9 +255,9 @@ static zval *_xml_string_zval(const char *str) int len = strlen(str); MAKE_STD_ZVAL(ret); - ret->type = IS_STRING; - ret->value.str.len = len; - ret->value.str.val = estrndup(str, len); + Z_TYPE_P(ret) = IS_STRING; + Z_STRLEN_P(ret) = len; + Z_STRVAL_P(ret) = estrndup(str, len); return ret; } @@ -273,8 +273,8 @@ static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encod if (len == 0) { len = _xml_xmlcharlen(s); } - ret->type = IS_STRING; - ret->value.str.val = xml_utf8_decode(s, len, &ret->value.str.len, encoding); + Z_TYPE_P(ret) = IS_STRING; + Z_STRVAL_P(ret) = xml_utf8_decode(s, len, &Z_STRLEN_P(ret), encoding); return ret; } /* }}} */ @@ -374,8 +374,8 @@ static zval *xml_call_handler(xml_parser *parser, zval *handler, int argc, zval if (Z_TYPE_P(handler) == IS_STRING) { php_error(E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(handler)); - } else if (zend_hash_index_find(handler->value.ht, 0, (void **) &obj) == SUCCESS && - zend_hash_index_find(handler->value.ht, 1, (void **) &method) == SUCCESS && + } else if (zend_hash_index_find(Z_ARRVAL_P(handler), 0, (void **) &obj) == SUCCESS && + zend_hash_index_find(Z_ARRVAL_P(handler), 1, (void **) &method) == SUCCESS && Z_TYPE_PP(obj) == IS_OBJECT && Z_TYPE_PP(method) == IS_STRING) { php_error(E_WARNING, "Unable to call handler %s::%s()", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method)); @@ -564,10 +564,10 @@ static int _xml_xmlcharlen(const XML_Char *s) /* {{{ _xml_zval_strdup() */ PHPAPI char *_xml_zval_strdup(zval *val) { - if (val->type == IS_STRING) { - char *buf = emalloc(val->value.str.len + 1); - memcpy(buf, val->value.str.val, val->value.str.len); - buf[val->value.str.len] = '\0'; + if (Z_TYPE_P(val) == IS_STRING) { + char *buf = emalloc(Z_STRLEN_P(val) + 1); + memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)); + buf[Z_STRLEN_P(val)] = '\0'; return buf; } return NULL; @@ -583,7 +583,7 @@ static void _xml_add_to_info(xml_parser *parser,char *name) return; } - if (zend_hash_find(parser->info->value.ht,name,strlen(name) + 1,(void **) &element) == FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(parser->info),name,strlen(name) + 1,(void **) &element) == FAILURE) { MAKE_STD_ZVAL(values); if (array_init(values) == FAILURE) { @@ -591,7 +591,7 @@ static void _xml_add_to_info(xml_parser *parser,char *name) return; } - zend_hash_update(parser->info->value.ht, name, strlen(name)+1, (void *) &values, sizeof(zval*), (void **) &element); + zend_hash_update(Z_ARRVAL_P(parser->info), name, strlen(name)+1, (void *) &values, sizeof(zval*), (void **) &element); } add_next_index_long(*element,parser->curtag); @@ -688,13 +688,13 @@ void _xml_startElementHandler(void *userData, const char *name, const char **att } if (atcnt) { - zend_hash_add(tag->value.ht,"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL); + zend_hash_add(Z_ARRVAL_P(tag),"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL); } else { zval_dtor(atr); efree(atr); } - zend_hash_next_index_insert(parser->data->value.ht,&tag,sizeof(zval*),(void *) &parser->ctag); + zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),(void *) &parser->ctag); } efree(tag_name); @@ -739,7 +739,7 @@ void _xml_endElementHandler(void *userData, const char *name) add_assoc_string(tag,"type","close",1); add_assoc_long(tag,"level",parser->level); - zend_hash_next_index_insert(parser->data->value.ht,&tag,sizeof(zval*),NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); } parser->lastwasopen = 0; @@ -801,10 +801,10 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) /* check if the current tag already has a value - if yes append to that! */ if (zend_hash_find((*parser->ctag)->value.ht,"value",sizeof("value"),(void **) &myval) == SUCCESS) { - int newlen = (*myval)->value.str.len + decoded_len; - (*myval)->value.str.val = erealloc((*myval)->value.str.val,newlen+1); - strcpy((*myval)->value.str.val + (*myval)->value.str.len,decoded_value); - (*myval)->value.str.len += decoded_len; + int newlen = Z_STRLEN_PP(myval) + decoded_len; + Z_STRVAL_PP(myval) = erealloc(Z_STRVAL_PP(myval),newlen+1); + strcpy(Z_STRVAL_PP(myval) + Z_STRLEN_PP(myval),decoded_value); + Z_STRLEN_PP(myval) += decoded_len; efree(decoded_value); } else { add_assoc_string(*(parser->ctag),"value",decoded_value,0); @@ -824,7 +824,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) add_assoc_string(tag,"type","cdata",1); add_assoc_long(tag,"level",parser->level); - zend_hash_next_index_insert(parser->data->value.ht,&tag,sizeof(zval*),NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); } } else { efree(decoded_value); @@ -943,7 +943,7 @@ int _xml_externalEntityRefHandler(XML_Parser parserPtr, args[4] = _xml_xmlchar_zval(publicId, 0, parser->target_encoding); if ((retval = xml_call_handler(parser, parser->externalEntityRefHandler, 5, args))) { convert_to_long(retval); - ret = retval->value.lval; + ret = Z_LVAL_P(retval); efree(retval); } else { ret = 0; @@ -1040,7 +1040,7 @@ PHP_FUNCTION(xml_parser_create) XML_SetUserData(parser->parser, parser); ZEND_REGISTER_RESOURCE(return_value,parser,le_xml_parser); - parser->index = return_value->value.lval; + parser->index = Z_LVAL_P(return_value); } /* }}} */ @@ -1098,7 +1098,7 @@ PHP_FUNCTION(xml_parser_create_ns) XML_SetUserData(parser->parser, parser); ZEND_REGISTER_RESOURCE(return_value,parser,le_xml_parser); - parser->index = return_value->value.lval; + parser->index = Z_LVAL_P(return_value); } /* }}} */ @@ -1114,7 +1114,7 @@ PHP_FUNCTION(xml_set_object) WRONG_PARAM_COUNT; } - if ((*mythis)->type != IS_OBJECT) { + if (Z_TYPE_PP(mythis) != IS_OBJECT) { php_error(E_WARNING,"arg 2 has wrong type"); RETURN_FALSE; } @@ -1325,12 +1325,12 @@ PHP_FUNCTION(xml_parse) if (argc == 3) { convert_to_long_ex(final); - isFinal = (*final)->value.lval; + isFinal = Z_LVAL_PP(final); } else { isFinal = 0; } - ret = XML_Parse(parser->parser, (*data)->value.str.val, (*data)->value.str.len, isFinal); + ret = XML_Parse(parser->parser, Z_STRVAL_PP(data), Z_STRLEN_PP(data), isFinal); RETVAL_LONG(ret); } @@ -1369,7 +1369,7 @@ PHP_FUNCTION(xml_parse_into_struct) XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler); XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler); - ret = XML_Parse(parser->parser, (*data)->value.str.val, (*data)->value.str.len, 1); + ret = XML_Parse(parser->parser, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1); RETVAL_LONG(ret); } @@ -1402,7 +1402,7 @@ PHP_FUNCTION(xml_error_string) WRONG_PARAM_COUNT; } convert_to_long_ex(code); - str = (char *)XML_ErrorString((int)(*code)->value.lval); + str = (char *)XML_ErrorString((int)Z_LVAL_PP(code)); if (str) { RETVAL_STRING(str, 1); } @@ -1493,26 +1493,26 @@ PHP_FUNCTION(xml_parser_set_option) convert_to_long_ex(opt); - switch ((*opt)->value.lval) { + switch (Z_LVAL_PP(opt)) { case PHP_XML_OPTION_CASE_FOLDING: convert_to_long_ex(val); - parser->case_folding = (*val)->value.lval; + parser->case_folding = Z_LVAL_PP(val); break; case PHP_XML_OPTION_SKIP_TAGSTART: convert_to_long_ex(val); - parser->toffset = (*val)->value.lval; + parser->toffset = Z_LVAL_PP(val); break; case PHP_XML_OPTION_SKIP_WHITE: convert_to_long_ex(val); - parser->skipwhite = (*val)->value.lval; + parser->skipwhite = Z_LVAL_PP(val); break; case PHP_XML_OPTION_TARGET_ENCODING: { xml_encoding *enc; convert_to_string_ex(val); - enc = xml_get_encoding((*val)->value.str.val); + enc = xml_get_encoding(Z_STRVAL_PP(val)); if (enc == NULL) { php_error(E_WARNING, "%s: unsupported target encoding \"%s\"", - thisfunc, (*val)->value.str.val); + thisfunc, Z_STRVAL_PP(val)); RETURN_FALSE; } parser->target_encoding = enc->name; @@ -1542,7 +1542,7 @@ PHP_FUNCTION(xml_parser_get_option) convert_to_long_ex(opt); - switch ((*opt)->value.lval) { + switch (Z_LVAL_PP(opt)) { case PHP_XML_OPTION_CASE_FOLDING: RETURN_LONG(parser->case_folding); break; @@ -1570,7 +1570,7 @@ PHP_FUNCTION(utf8_encode) WRONG_PARAM_COUNT; } convert_to_string_ex(arg); - encoded = xml_utf8_encode((*arg)->value.str.val, (*arg)->value.str.len, &len, "ISO-8859-1"); + encoded = xml_utf8_encode(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &len, "ISO-8859-1"); if (encoded == NULL) { RETURN_FALSE; } @@ -1590,7 +1590,7 @@ PHP_FUNCTION(utf8_decode) WRONG_PARAM_COUNT; } convert_to_string_ex(arg); - decoded = xml_utf8_decode((*arg)->value.str.val, (*arg)->value.str.len, &len, "ISO-8859-1"); + decoded = xml_utf8_decode(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &len, "ISO-8859-1"); if (decoded == NULL) { RETURN_FALSE; } diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 589adaad05..21d6c05e30 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -281,8 +281,8 @@ static int add_stringl(pval* list, char* id, char* string, uint length, int dupl static int add_pval(pval* list, const char* id, pval** val) { if(list && val) { - if(id) return zend_hash_update(list->value.ht, (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL); - else return zend_hash_next_index_insert(list->value.ht, (void *) val, sizeof(pval **), NULL); + if(id) return zend_hash_update(Z_ARRVAL_P(list), (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL); + else return zend_hash_next_index_insert(Z_ARRVAL_P(list), (void *) val, sizeof(pval **), NULL); } } @@ -311,85 +311,85 @@ static void set_output_options(php_output_options* options, pval* output_opts) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty; options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping | xml_elem_non_ascii_escaping | xml_elem_non_print_escaping; - if(output_opts && output_opts->type == IS_ARRAY) { + if(output_opts && Z_TYPE_P(output_opts) == IS_ARRAY) { pval** val; /* verbosity of generated xml */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), OUTPUT_TYPE_KEY, OUTPUT_TYPE_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, OUTPUT_TYPE_VALUE_PHP)) { + if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_PHP)) { options->b_php_out = 1; } - else if(!strcmp((*val)->value.str.val, OUTPUT_TYPE_VALUE_XML)) { + else if(!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_XML)) { options->b_php_out = 0; } } } /* verbosity of generated xml */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), VERBOSITY_KEY, VERBOSITY_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, VERBOSITY_VALUE_NO_WHITE_SPACE)) { + if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NO_WHITE_SPACE)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_no_white_space; } - else if(!strcmp((*val)->value.str.val, VERBOSITY_VALUE_NEWLINES_ONLY)) { + else if(!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NEWLINES_ONLY)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_newlines_only; } - else if(!strcmp((*val)->value.str.val, VERBOSITY_VALUE_PRETTY)) { + else if(!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_PRETTY)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty; } } } /* version of xml to output */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), VERSION_KEY, VERSION_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, VERSION_VALUE_XMLRPC)) { + if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_XMLRPC)) { options->xmlrpc_out.version = xmlrpc_version_1_0; } - else if(!strcmp((*val)->value.str.val, VERSION_VALUE_SIMPLE)) { + else if(!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_SIMPLE)) { options->xmlrpc_out.version = xmlrpc_version_simple; } } } /* encoding code set */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), ENCODING_KEY, ENCODING_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if((*val)->type == IS_STRING) { - options->xmlrpc_out.xml_elem_opts.encoding = estrdup((*val)->value.str.val); + if(Z_TYPE_PP(val) == IS_STRING) { + options->xmlrpc_out.xml_elem_opts.encoding = estrdup(Z_STRVAL_PP(val)); } } /* escaping options */ - if(zend_hash_find(output_opts->value.ht, + if(zend_hash_find(Z_ARRVAL_P(output_opts), ESCAPING_KEY, ESCAPING_KEY_LEN + 1, (void**)&val) == SUCCESS) { /* multiple values allowed. check if array */ - if((*val)->type == IS_ARRAY) { + if(Z_TYPE_PP(val) == IS_ARRAY) { pval** iter_val; - zend_hash_internal_pointer_reset((*val)->value.ht); + zend_hash_internal_pointer_reset(Z_ARRVAL_PP(val)); options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_no_escaping; while(1) { - if(zend_hash_get_current_data((*val)->value.ht, (void**)&iter_val) == SUCCESS) { - if((*iter_val)->type == IS_STRING && (*iter_val)->value.str.val) { - if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_CDATA)) { + if(zend_hash_get_current_data(Z_ARRVAL_PP(val), (void**)&iter_val) == SUCCESS) { + if(Z_TYPE_PP(iter_val) == IS_STRING && Z_STRVAL_PP(iter_val)) { + if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_CDATA)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_cdata_escaping; } - else if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_NON_ASCII)) { + else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_ASCII)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_ascii_escaping; } - else if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_NON_PRINT)) { + else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_PRINT)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_print_escaping; } - else if(!strcmp((*iter_val)->value.str.val, ESCAPING_VALUE_MARKUP)) { + else if(!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_MARKUP)) { options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_markup_escaping; } } @@ -398,21 +398,21 @@ static void set_output_options(php_output_options* options, pval* output_opts) { break; } - zend_hash_move_forward((*val)->value.ht); + zend_hash_move_forward(Z_ARRVAL_PP(val)); } } /* else, check for single value */ - else if((*val)->type == IS_STRING) { - if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_CDATA)) { + else if(Z_TYPE_PP(val) == IS_STRING) { + if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_CDATA)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_cdata_escaping; } - else if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_NON_ASCII)) { + else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_ASCII)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_ascii_escaping; } - else if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_NON_PRINT)) { + else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_PRINT)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_print_escaping; } - else if(!strcmp((*val)->value.str.val, ESCAPING_VALUE_MARKUP)) { + else if(!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_MARKUP)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping; } } @@ -471,32 +471,32 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker(const char* key, pval* in_val, int dept if(val) { switch(type) { case xmlrpc_base64: - if(val->type == IS_NULL) { + if(Z_TYPE_P(val) == IS_NULL) { xReturn = XMLRPC_CreateValueBase64(key, "", 1); } else { - xReturn = XMLRPC_CreateValueBase64(key, val->value.str.val, val->value.str.len); + xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL_P(val), Z_STRLEN_P(val)); } break; case xmlrpc_datetime: convert_to_string(val); - xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, val->value.str.val); + xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, Z_STRVAL_P(val)); break; case xmlrpc_boolean: convert_to_boolean(val); - xReturn = XMLRPC_CreateValueBoolean(key, val->value.lval); + xReturn = XMLRPC_CreateValueBoolean(key, Z_LVAL_P(val)); break; case xmlrpc_int: convert_to_long(val); - xReturn = XMLRPC_CreateValueInt(key, val->value.lval); + xReturn = XMLRPC_CreateValueInt(key, Z_LVAL_P(val)); break; case xmlrpc_double: convert_to_double(val); - xReturn = XMLRPC_CreateValueDouble(key, val->value.dval); + xReturn = XMLRPC_CreateValueDouble(key, Z_DVAL_P(val)); break; case xmlrpc_string: convert_to_string(val); - xReturn = XMLRPC_CreateValueString(key, val->value.str.val, val->value.str.len); + xReturn = XMLRPC_CreateValueString(key, Z_STRVAL_P(val), Z_STRLEN_P(val)); break; case xmlrpc_vector: { @@ -506,13 +506,13 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker(const char* key, pval* in_val, int dept convert_to_array(val); - xReturn = XMLRPC_CreateVector(key, determine_vector_type(val->value.ht)); + xReturn = XMLRPC_CreateVector(key, determine_vector_type(Z_ARRVAL_P(val))); - zend_hash_internal_pointer_reset(val->value.ht); + zend_hash_internal_pointer_reset(Z_ARRVAL_P(val)); while(1) { - int res = my_zend_hash_get_current_key(val->value.ht, &my_key, &num_index); + int res = my_zend_hash_get_current_key(Z_ARRVAL_P(val), &my_key, &num_index); if(res == HASH_KEY_IS_LONG) { - if(zend_hash_get_current_data(val->value.ht, (void**)&pIter) == SUCCESS) { + if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) { XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(0, *pIter, depth++)); } } @@ -520,12 +520,12 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker(const char* key, pval* in_val, int dept break; } else if(res == HASH_KEY_IS_STRING) { - if(zend_hash_get_current_data(val->value.ht, (void**)&pIter) == SUCCESS) { + if(zend_hash_get_current_data(Z_ARRVAL_P(val), (void**)&pIter) == SUCCESS) { XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(my_key, *pIter, depth++)); } } - zend_hash_move_forward(val->value.ht); + zend_hash_move_forward(Z_ARRVAL_P(val)); } } break; @@ -554,39 +554,39 @@ static pval* XMLRPC_to_PHP(XMLRPC_VALUE el) { switch(type) { case xmlrpc_empty: - elem->type = IS_NULL; + Z_TYPE_P(elem) = IS_NULL; break; case xmlrpc_string: pStr = XMLRPC_GetValueString(el); if(pStr) { - elem->value.str.len = XMLRPC_GetValueStringLen(el); - elem->value.str.val = estrndup(pStr, elem->value.str.len); - elem->type = IS_STRING; + Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); + Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem)); + Z_TYPE_P(elem) = IS_STRING; } break; case xmlrpc_int: - elem->value.lval = XMLRPC_GetValueInt(el); - elem->type = IS_LONG; + Z_LVAL_P(elem) = XMLRPC_GetValueInt(el); + Z_TYPE_P(elem) = IS_LONG; break; case xmlrpc_boolean: - elem->value.lval = XMLRPC_GetValueBoolean(el); - elem->type = IS_BOOL; + Z_LVAL_P(elem) = XMLRPC_GetValueBoolean(el); + Z_TYPE_P(elem) = IS_BOOL; break; case xmlrpc_double: - elem->value.dval = XMLRPC_GetValueDouble(el); - elem->type = IS_DOUBLE; + Z_DVAL_P(elem) = XMLRPC_GetValueDouble(el); + Z_TYPE_P(elem) = IS_DOUBLE; break; case xmlrpc_datetime: - elem->value.str.len = XMLRPC_GetValueStringLen(el); - elem->value.str.val = estrndup(XMLRPC_GetValueDateTime_ISO8601(el), elem->value.str.len); - elem->type = IS_STRING; + Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); + Z_STRVAL_P(elem) = estrndup(XMLRPC_GetValueDateTime_ISO8601(el), Z_STRLEN_P(elem)); + Z_TYPE_P(elem) = IS_STRING; break; case xmlrpc_base64: pStr = XMLRPC_GetValueBase64(el); if(pStr) { - elem->value.str.len = XMLRPC_GetValueStringLen(el); - elem->value.str.val = estrndup(pStr, elem->value.str.len); - elem->type = IS_STRING; + Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); + Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem)); + Z_TYPE_P(elem) = IS_STRING; } break; case xmlrpc_vector: @@ -630,14 +630,14 @@ PHP_FUNCTION(xmlrpc_encode_request) { if(xRequest) { XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out); - if(method->type == IS_NULL) { + if(Z_TYPE_P(method) == IS_NULL) { XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response); } else { - XMLRPC_RequestSetMethodName(xRequest, method->value.str.val); + XMLRPC_RequestSetMethodName(xRequest, Z_STRVAL_P(method)); XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call); } - if(vals->type != IS_NULL) { + if(Z_TYPE_P(vals) != IS_NULL) { XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals)); } @@ -690,10 +690,10 @@ pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_o pval* retval = NULL; XMLRPC_REQUEST response; STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {0}; - opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(encoding_in->value.str.val) : ENCODING_DEFAULT; + opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT; /* generate XMLRPC_REQUEST from raw xml */ - response = XMLRPC_REQUEST_FromXML(xml_in->value.str.val, xml_in->value.str.len, &opts); + response = XMLRPC_REQUEST_FromXML(Z_STRVAL_P(xml_in), Z_STRLEN_P(xml_in), &opts); if(response) { /* convert xmlrpc data to native php types */ retval = XMLRPC_to_PHP(XMLRPC_RequestGetData(response)); @@ -701,9 +701,9 @@ pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_o if(XMLRPC_RequestGetRequestType(response) == xmlrpc_request_call) { if(method_name_out) { convert_to_string(method_name_out); - method_name_out->type = IS_STRING; - method_name_out->value.str.val = estrdup(XMLRPC_RequestGetMethodName(response)); - method_name_out->value.str.len = strlen(method_name_out->value.str.val); + Z_TYPE_P(method_name_out) = IS_STRING; + Z_STRVAL_P(method_name_out) = estrdup(XMLRPC_RequestGetMethodName(response)); + Z_STRLEN_P(method_name_out) = strlen(Z_STRVAL_P(method_name_out)); } } @@ -866,15 +866,15 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data; MAKE_STD_ZVAL(retval_ptr); - retval_ptr->type = IS_NULL; + Z_TYPE_P(retval_ptr) = IS_NULL; /* setup data hoojum */ callback_params[0] = pData->caller_params; /* loop through and call all registered callbacks */ - zend_hash_internal_pointer_reset(pData->server->introspection_map->value.ht); + zend_hash_internal_pointer_reset(pData->server->Z_ARRVAL_P(introspection_map)); while(1) { - if(zend_hash_get_current_data(pData->server->introspection_map->value.ht, + if(zend_hash_get_current_data(pData->server->Z_ARRVAL_P(introspection_map), (void**)&php_function) == SUCCESS) { /* php func prototype: function string user_func($user_params) */ @@ -886,11 +886,11 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) /* return value should be a string */ convert_to_string(retval_ptr); - xData = XMLRPC_IntrospectionCreateDescription(retval_ptr->value.str.val, &err); + xData = XMLRPC_IntrospectionCreateDescription(Z_STRVAL_P(retval_ptr), &err); if(xData) { if(!XMLRPC_ServerAddIntrospectionData(server, xData)) { - zend_error(E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", (*php_function)->value.str.val); + zend_error(E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", Z_STRVAL_PP(php_function)); } XMLRPC_CleanupValue(xData); } @@ -898,28 +898,28 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) /* could not create description */ if(err.xml_elem_error.parser_code) { zend_error(E_WARNING, "xml parse error: [line %i, column %i, message: %s] Unable to add introspection data returned from %s()", - err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, (*php_function)->value.str.val); + err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, Z_STRVAL_PP(php_function)); } else { zend_error(E_WARNING, "Unable to add introspection data returned from %s()", - (*php_function)->value.str.val); + Z_STRVAL_PP(php_function)); } } } else { /* user func failed */ - zend_error(E_WARNING, "Error calling user introspection callback: %s()", (*php_function)->value.str.val); + zend_error(E_WARNING, "Error calling user introspection callback: %s()", Z_STRVAL_PP(php_function)); } } else { break; } - zend_hash_move_forward(pData->server->introspection_map->value.ht); + zend_hash_move_forward(pData->server->Z_ARRVAL_P(introspection_map)); } /* so we don't call the same callbacks ever again */ - zend_hash_clean(pData->server->introspection_map->value.ht); + zend_hash_clean(pData->server->Z_ARRVAL_P(introspection_map)); } /* {{{ proto boolean xmlrpc_server_register_method(handle server, string method_name, string function) @@ -935,20 +935,20 @@ PHP_FUNCTION(xmlrpc_server_register_method) { WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if(type == XMLRPCG(le_xmlrpc_server)) { /* register with C engine. every method just calls our standard callback, * and it then dispatches to php as necessary */ - if(XMLRPC_ServerRegisterMethod(server->server_ptr, method_key->value.str.val, php_xmlrpc_callback)) { + if(XMLRPC_ServerRegisterMethod(server->server_ptr, Z_STRVAL_P(method_key), php_xmlrpc_callback)) { /* save for later use */ MAKE_STD_ZVAL(method_name_save); *method_name_save = *method_name; zval_copy_ctor(method_name_save); /* register our php method */ - add_pval(server->method_map, method_key->value.str.val, &method_name_save); + add_pval(server->method_map, Z_STRVAL_P(method_key), &method_name_save); RETURN_BOOL(1); } @@ -970,7 +970,7 @@ PHP_FUNCTION(xmlrpc_server_register_introspection_callback) { WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if(type == XMLRPCG(le_xmlrpc_server)) { { @@ -1022,14 +1022,14 @@ PHP_FUNCTION(xmlrpc_server_call_method) { WRONG_PARAM_COUNT; } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if(type == XMLRPCG(le_xmlrpc_server)) { /* HACK: use output encoding for now */ input_opts.xml_elem_opts.encoding = utf8_get_encoding_id_from_string(out.xmlrpc_out.xml_elem_opts.encoding); /* generate an XMLRPC_REQUEST from the raw xml input */ - xRequest = XMLRPC_REQUEST_FromXML(rawxml->value.str.val, rawxml->value.str.len, &input_opts); + xRequest = XMLRPC_REQUEST_FromXML(Z_STRVAL_P(rawxml), Z_STRLEN_P(rawxml), &input_opts); if(xRequest) { @@ -1039,21 +1039,21 @@ PHP_FUNCTION(xmlrpc_server_call_method) { XMLRPC_VALUE xAnswer = NULL; MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */ MAKE_STD_ZVAL(data.return_data); - data.return_data->type = IS_NULL; /* in case value is never init'd, we don't dtor to think it is a string or something */ - data.xmlrpc_method->type = IS_NULL; + data.Z_TYPE_P(return_data) = IS_NULL; /* in case value is never init'd, we don't dtor to think it is a string or something */ + data.Z_TYPE_P(xmlrpc_method) = IS_NULL; /* setup some data to pass to the callback function */ - data.xmlrpc_method->value.str.val = estrdup(XMLRPC_RequestGetMethodName(xRequest)); - data.xmlrpc_method->value.str.len = strlen(data.xmlrpc_method->value.str.val); - data.xmlrpc_method->type = IS_STRING; + data.Z_STRVAL_P(xmlrpc_method) = estrdup(XMLRPC_RequestGetMethodName(xRequest)); + data.Z_STRLEN_P(xmlrpc_method) = strlen(data.Z_STRVAL_P(xmlrpc_method)); + data.Z_TYPE_P(xmlrpc_method) = IS_STRING; data.caller_params = caller_params; data.php_executed = 0; data.server = server; /* check if the called method has been previous registered */ - if(zend_hash_find(server->method_map->value.ht, - data.xmlrpc_method->value.str.val, - data.xmlrpc_method->value.str.len + 1, + if(zend_hash_find(server->Z_ARRVAL_P(method_map), + data.Z_STRVAL_P(xmlrpc_method), + data.Z_STRLEN_P(xmlrpc_method) + 1, (void**)&php_function) == SUCCESS) { data.php_function = *php_function; @@ -1135,7 +1135,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) { WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ } - server = zend_list_find(handle->value.lval, &type); + server = zend_list_find(Z_LVAL_P(handle), &type); if (type == XMLRPCG(le_xmlrpc_server)) { XMLRPC_VALUE xDesc = PHP_to_XMLRPC(desc); @@ -1274,19 +1274,19 @@ int set_pval_xmlrpc_type(pval* value, XMLRPC_VALUE_TYPE type) { /* we only really care about strings because they can represent * base64 and datetime. all other types have corresponding php types */ - if(value->type == IS_STRING) { + if(Z_TYPE_P(value) == IS_STRING) { if(type == xmlrpc_base64 || type == xmlrpc_datetime) { const char* typestr = xmlrpc_type_as_str(type, xmlrpc_vector_none); pval* type; MAKE_STD_ZVAL(type); - type->type = IS_STRING; - type->value.str.val = estrdup(typestr); - type->value.str.len = strlen(typestr); + Z_TYPE_P(type) = IS_STRING; + Z_STRVAL_P(type) = estrdup(typestr); + Z_STRLEN_P(type) = strlen(typestr); convert_to_object(value); - bSuccess = zend_hash_update(value->value.obj.properties, OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL); + bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL); } } @@ -1298,7 +1298,7 @@ XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue) { XMLRPC_VALUE_TYPE type = xmlrpc_none; if(value) { - switch(value->type) { + switch(Z_TYPE_P(value)) { case IS_NULL: type = xmlrpc_base64; break; @@ -1333,11 +1333,11 @@ XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue) { pval** attr; type = xmlrpc_vector; - if(zend_hash_find(value->value.obj.properties, + if(zend_hash_find(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void**)&attr) == SUCCESS) { - if((*attr)->type == IS_STRING) { - type = xmlrpc_str_as_type((*attr)->value.str.val); + if(Z_TYPE_PP(attr) == IS_STRING) { + type = xmlrpc_str_as_type(Z_STRVAL_PP(attr)); } } break; @@ -1347,8 +1347,8 @@ XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue) { /* if requested, return an unmolested (magic removed) copy of the value */ if(newvalue) { pval** val; - if( (type == xmlrpc_base64 && value->type != IS_NULL) || type == xmlrpc_datetime) { - if(zend_hash_find(value->value.obj.properties, + if( (type == xmlrpc_base64 && Z_TYPE_P(value) != IS_NULL) || type == xmlrpc_datetime) { + if(zend_hash_find(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR), (void**)&val) == SUCCESS) { *newvalue = *val; @@ -1380,14 +1380,14 @@ PHP_FUNCTION(xmlrpc_set_type) { #endif convert_to_string(type); - vtype = xmlrpc_str_as_type(type->value.str.val); + vtype = xmlrpc_str_as_type(Z_STRVAL_P(type)); if(vtype != xmlrpc_none) { if(set_pval_xmlrpc_type(arg, vtype) == SUCCESS) { RETURN_TRUE; } } else { - zend_error(E_WARNING,"invalid type '%s' passed to xmlrpc_set_type()", type->value.str.val); + zend_error(E_WARNING,"invalid type '%s' passed to xmlrpc_set_type()", Z_STRVAL_P(type)); } RETURN_FALSE; } @@ -1405,7 +1405,7 @@ PHP_FUNCTION(xmlrpc_get_type) { type = get_pval_xmlrpc_type(arg, 0); if(type == xmlrpc_vector) { - vtype = determine_vector_type(arg->value.ht); + vtype = determine_vector_type(Z_ARRVAL_P(arg)); } RETURN_STRING((char*)xmlrpc_type_as_str(type, vtype), 1); diff --git a/ext/xslt/xslt.c b/ext/xslt/xslt.c index 9f09854298..2647406674 100644 --- a/ext/xslt/xslt.c +++ b/ext/xslt/xslt.c @@ -150,12 +150,12 @@ extern xslt_args *xslt_parse_arguments(char *xml, if (! strncasecmp(xml, "arg:", 4)) { char *key = xml + 5; - return_value->xml.type = XSLT_IS_DATA; + return_value->Z_TYPE(xml) = XSLT_IS_DATA; return_value->xml.ptr = _find_xslt_argument((const char **) argv, (const char *) key); } else { - return_value->xml.type = XSLT_IS_FILE; + return_value->Z_TYPE(xml) = XSLT_IS_FILE; return_value->xml.ptr = estrdup(xml); } @@ -163,12 +163,12 @@ extern xslt_args *xslt_parse_arguments(char *xml, if (! strncasecmp(xsl, "arg:", 4)) { char *key = xsl + 5; - return_value->xsl.type = XSLT_IS_DATA; + return_value->Z_TYPE(xsl) = XSLT_IS_DATA; return_value->xsl.ptr = _find_xslt_argument((const char **) argv, (const char *) key); } else { - return_value->xsl.type = XSLT_IS_FILE; + return_value->Z_TYPE(xsl) = XSLT_IS_FILE; return_value->xsl.ptr = estrdup(xsl); } @@ -176,12 +176,12 @@ extern xslt_args *xslt_parse_arguments(char *xml, if (! strncasecmp(result, "arg:", 4)) { char *key = result + 5; - return_value->result.type = XSLT_IS_DATA; + return_value->Z_TYPE(result) = XSLT_IS_DATA; return_value->result.ptr = _find_xslt_argument((const char **) argv, (const char *) key); } else { - return_value->result.type = XSLT_IS_FILE; + return_value->Z_TYPE(result) = XSLT_IS_FILE; return_value->result.ptr = estrdup(result); } diff --git a/ext/yaz/php_yaz.c b/ext/yaz/php_yaz.c index a97e162473..0fd88dae2b 100644 --- a/ext/yaz/php_yaz.c +++ b/ext/yaz/php_yaz.c @@ -369,7 +369,7 @@ static const char *array_lookup_string(HashTable *ht, const char *idx) { SEPARATE_ZVAL(pvalue); convert_to_string(*pvalue); - return (*pvalue)->value.str.val; + return Z_STRVAL_PP(pvalue); } return 0; } @@ -383,7 +383,7 @@ static long *array_lookup_long(HashTable *ht, const char *idx) { SEPARATE_ZVAL(pvalue); convert_to_long(*pvalue); - return &(*pvalue)->value.lval; + return &Z_LVAL_PP(pvalue); } return 0; } @@ -397,7 +397,7 @@ static long *array_lookup_bool(HashTable *ht, const char *idx) { SEPARATE_ZVAL(pvalue); convert_to_boolean(*pvalue); - return &(*pvalue)->value.lval; + return &Z_LVAL_PP(pvalue); } return 0; } @@ -1235,7 +1235,7 @@ PHP_FUNCTION(yaz_connect) else { convert_to_string_ex (user); - user_str = (*user)->value.str.val; + user_str = Z_STRVAL_PP(user); } } else @@ -1243,7 +1243,7 @@ PHP_FUNCTION(yaz_connect) WRONG_PARAM_COUNT; } convert_to_string_ex (zurl); - zurl_str = (*zurl)->value.str.val; + zurl_str = Z_STRVAL_PP(zurl); for (cp = zurl_str; *cp && strchr("\t\n ", *cp); cp++) ; if (!*cp) @@ -1339,7 +1339,7 @@ PHP_FUNCTION(yaz_close) if (!p) RETURN_FALSE; release_assoc (p); - zend_list_delete ((*id)->value.lval); + zend_list_delete (Z_LVAL_PP(id)); RETURN_TRUE; } /* }}} */ @@ -1370,17 +1370,17 @@ PHP_FUNCTION(yaz_search) } p->action = 0; convert_to_string_ex (type); - type_str = (*type)->value.str.val; + type_str = Z_STRVAL_PP(type); convert_to_string_ex (query); - query_str = (*query)->value.str.val; + query_str = Z_STRVAL_PP(query); yaz_resultset_destroy (p->resultSets); r = p->resultSets = yaz_resultset_mk(); r->query = odr_malloc (r->odr, sizeof(*r->query)); if (!strcmp (type_str, "rpn")) { r->query->which = Z_Query_type_1; - r->query->u.type_1 = p_query_rpn (r->odr, PROTO_Z3950, query_str); - if (!r->query->u.type_1) + r->query->Z_TYPE(u)_1 = p_query_rpn (r->odr, PROTO_Z3950, query_str); + if (!r->query->Z_TYPE(u)_1) { yaz_resultset_destroy(r); p->resultSets = 0; @@ -1394,9 +1394,9 @@ PHP_FUNCTION(yaz_search) else if (!strcmp(type_str, "ccl")) { r->query->which = Z_Query_type_2; - r->query->u.type_2 = odr_malloc (r->odr, sizeof(*r->query->u.type_2)); - r->query->u.type_2->buf = odr_strdup(r->odr, query_str); - r->query->u.type_2->len = strlen(query_str); + r->query->Z_TYPE(u)_2 = odr_malloc (r->odr, sizeof(*r->query->Z_TYPE(u)_2)); + r->query->Z_TYPE(u)_2->buf = odr_strdup(r->odr, query_str); + r->query->Z_TYPE(u)_2->len = strlen(query_str); } else { @@ -1560,10 +1560,10 @@ PHP_FUNCTION(yaz_error) msg = "unknown diagnostic"; } /* Not macro using because RETURN_STRING throws away const */ - return_value->value.str.len = strlen(msg); - return_value->value.str.val = - estrndup(msg, return_value->value.str.len); - return_value->type = IS_STRING; + Z_STRLEN_P(return_value) = strlen(msg); + Z_STRVAL_P(return_value) = + estrndup(msg, Z_STRLEN_P(return_value)); + Z_TYPE_P(return_value) = IS_STRING; } release_assoc (p); } @@ -1867,7 +1867,7 @@ static void retval_grs1 (zval *return_value, Z_GenericRecord *p) grs[level] = e->content->u.subtree; eno[level] = -1; } - zend_hash_next_index_insert (return_value->value.ht, + zend_hash_next_index_insert (Z_ARRVAL_P(return_value), (void *) &my_zval, sizeof(zval *), NULL); eno[level]++; } @@ -1892,10 +1892,10 @@ PHP_FUNCTION(yaz_record) get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); convert_to_long_ex(pval_pos); - pos = (*pval_pos)->value.lval; + pos = Z_LVAL_PP(pval_pos); convert_to_string_ex(pval_type); - type = (*pval_type)->value.str.val; + type = Z_STRVAL_PP(pval_type); if (p && p->resultSets && p->resultSets->recordList && pos >= p->resultSetStartPoint && @@ -1996,7 +1996,7 @@ PHP_FUNCTION(yaz_syntax) { convert_to_string_ex (pval_syntax); xfree (p->preferredRecordSyntax); - p->preferredRecordSyntax = xstrdup ((*pval_syntax)->value.str.val); + p->preferredRecordSyntax = xstrdup (Z_STRVAL_PP(pval_syntax)); } release_assoc (p); } @@ -2018,7 +2018,7 @@ PHP_FUNCTION(yaz_element) { convert_to_string_ex (pval_element); xfree (p->elementSetNames); - p->elementSetNames = xstrdup ((*pval_element)->value.str.val); + p->elementSetNames = xstrdup (Z_STRVAL_PP(pval_element)); } release_assoc (p); } @@ -2041,11 +2041,11 @@ PHP_FUNCTION(yaz_range) if (p) { convert_to_long_ex (pval_start); - p->resultSetStartPoint = (*pval_start)->value.lval; + p->resultSetStartPoint = Z_LVAL_PP(pval_start); if (p->resultSetStartPoint < 1) p->resultSetStartPoint = 1; convert_to_long_ex (pval_number); - p->numberOfRecordsRequested = (*pval_number)->value.lval; + p->numberOfRecordsRequested = Z_LVAL_PP(pval_number); } release_assoc (p); } @@ -2071,11 +2071,11 @@ PHP_FUNCTION(yaz_sort) if (p->resultSets && p->resultSets->sorted) { if (!p->sort_criteria || strcmp (p->sort_criteria, - (*pval_criteria)->value.str.val)) + Z_STRVAL_PP(pval_criteria))) p->resultSets->sorted = 0; } xfree (p->sort_criteria); - p->sort_criteria = xstrdup ((*pval_criteria)->value.str.val); + p->sort_criteria = xstrdup (Z_STRVAL_PP(pval_criteria)); } release_assoc (p); } @@ -2441,7 +2441,7 @@ PHP_FUNCTION(yaz_scan_result) add_next_index_string(my_zval, "unknown", 1); zend_hash_next_index_insert ( - return_value->value.ht, (void *) &my_zval, sizeof(zval *), + Z_ARRVAL_P(return_value), (void *) &my_zval, sizeof(zval *), NULL); } @@ -2492,7 +2492,7 @@ PHP_FUNCTION(yaz_ccl_conf) #endif if (type != HASH_KEY_IS_STRING || Z_TYPE_PP(ent) != IS_STRING) continue; - ccl_qual_fitem(p->ccl_parser->bibset, (*ent)->value.str.val, key); + ccl_qual_fitem(p->ccl_parser->bibset, Z_STRVAL_PP(ent), key); } } release_assoc (p); @@ -2523,7 +2523,7 @@ PHP_FUNCTION(yaz_ccl_parse) get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p); if (p) { - const char *query_str = (*pval_query)->value.str.val; + const char *query_str = Z_STRVAL_PP(pval_query); struct ccl_rpn_node *rpn; struct ccl_token *token_list = ccl_parser_tokenize(p->ccl_parser, query_str); @@ -2575,7 +2575,7 @@ PHP_FUNCTION(yaz_database) if (p) { xfree (p->local_databases); - p->local_databases = xstrdup ((*pval_database)->value.str.val); + p->local_databases = xstrdup (Z_STRVAL_PP(pval_database)); RETVAL_TRUE; } else diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 21b928eb85..91e4d77c67 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -274,9 +274,9 @@ PHP_FUNCTION(gzfile) } convert_to_string_ex(filename); - zp = php_gzopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE TSRMLS_CC); + zp = php_gzopen_wrapper(Z_STRVAL_PP(filename),"r", use_include_path|ENFORCE_SAFE_MODE TSRMLS_CC); if (!zp) { - php_error(E_WARNING,"gzFile(\"%s\") - %s",(*filename)->value.str.val,strerror(errno)); + php_error(E_WARNING,"gzFile(\"%s\") - %s",Z_STRVAL_PP(filename),strerror(errno)); RETURN_FALSE; } @@ -408,12 +408,12 @@ PHP_FUNCTION(gzgets) RETVAL_FALSE; } else { if (PG(magic_quotes_runtime)) { - return_value->value.str.val = php_addslashes(buf,0,&return_value->value.str.len,1 TSRMLS_CC); + Z_STRVAL_P(return_value) = php_addslashes(buf,0,&Z_STRLEN_P(return_value),1 TSRMLS_CC); } else { - return_value->value.str.val = buf; - return_value->value.str.len = strlen(return_value->value.str.val); + Z_STRVAL_P(return_value) = buf; + Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); } - return_value->type = IS_STRING; + Z_TYPE_P(return_value) = IS_STRING; } return; } @@ -441,9 +441,9 @@ PHP_FUNCTION(gzgetc) } else { buf[0]=(char)c; buf[1]='\0'; - return_value->value.str.val = buf; - return_value->value.str.len = 1; - return_value->type = IS_STRING; + Z_STRVAL_P(return_value) = buf; + Z_STRLEN_P(return_value) = 1; + Z_TYPE_P(return_value) = IS_STRING; } return; } @@ -472,8 +472,8 @@ PHP_FUNCTION(gzgetss) RETURN_FALSE; } convert_to_string_ex(allow); - allowed_tags = (*allow)->value.str.val; - allowed_tags_len = (*allow)->value.str.len; + allowed_tags = Z_STRVAL_PP(allow); + allowed_tags_len = Z_STRLEN_PP(allow); break; default: WRONG_PARAM_COUNT; @@ -483,7 +483,7 @@ PHP_FUNCTION(gzgetss) convert_to_long_ex(bytes); - len = (*bytes)->value.lval; + len = Z_LVAL_PP(bytes); ZEND_FETCH_RESOURCE(zp, gzFile *, fd, -1, "Zlib file", le_zp); @@ -702,16 +702,16 @@ PHP_FUNCTION(gzread) ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - return_value->value.str.val = emalloc(sizeof(char) * (len + 1)); + Z_STRVAL_P(return_value) = emalloc(sizeof(char) * (len + 1)); /* needed because recv doesnt put a null at the end*/ - return_value->value.str.len = gzread(zp, return_value->value.str.val, len); - return_value->value.str.val[return_value->value.str.len] = 0; + Z_STRLEN_P(return_value) = gzread(zp, Z_STRVAL_P(return_value), len); + Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; if (PG(magic_quotes_runtime)) { - return_value->value.str.val = php_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1 TSRMLS_CC); + Z_STRVAL_P(return_value) = php_addslashes(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value),&Z_STRLEN_P(return_value),1 TSRMLS_CC); } - return_value->type = IS_STRING; + Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ @@ -736,7 +736,7 @@ PHP_FUNCTION(gzcompress) if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zlimit); - limit = (*zlimit)->value.lval; + limit = Z_LVAL_PP(zlimit); if((limit<0)||(limit>9)) { php_error(E_WARNING,"gzcompress: compression level must be whithin 0..9"); RETURN_FALSE; @@ -747,14 +747,14 @@ PHP_FUNCTION(gzcompress) } convert_to_string_ex(data); - l2 = (*data)->value.str.len + ((*data)->value.str.len/1000) + 15 + 1; /* room for \0 */ + l2 = Z_STRLEN_PP(data) + (Z_STRLEN_PP(data)/1000) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(l2); if(! s2) RETURN_FALSE; if(limit>=0) { - status = compress2(s2,&l2,(*data)->value.str.val, (*data)->value.str.len,limit); + status = compress2(s2,&l2,Z_STRVAL_PP(data), Z_STRLEN_PP(data),limit); } else { - status = compress(s2,&l2,(*data)->value.str.val, (*data)->value.str.len); + status = compress(s2,&l2,Z_STRVAL_PP(data), Z_STRLEN_PP(data)); } if (status==Z_OK) { @@ -788,11 +788,11 @@ PHP_FUNCTION(gzuncompress) if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zlimit); - if((*zlimit)->value.lval<=0) { + if(Z_LVAL_PP(zlimit)<=0) { php_error(E_WARNING,"gzuncompress: length must be greater zero"); RETURN_FALSE; } - plength = (*zlimit)->value.lval; + plength = Z_LVAL_PP(zlimit); break; default: WRONG_PARAM_COUNT; @@ -807,10 +807,10 @@ PHP_FUNCTION(gzuncompress) that should be eneugh for all real life cases */ do { - length=plength?plength:(*data)->value.str.len*(1<<factor++); + length=plength?plength:Z_STRLEN_PP(data)*(1<<factor++); s2 = (char *) erealloc(s1,length); if(! s2) { if(s1) efree(s1); RETURN_FALSE; } - status = uncompress(s2, &length ,(*data)->value.str.val, (*data)->value.str.len); + status = uncompress(s2, &length ,Z_STRVAL_PP(data), Z_STRLEN_PP(data)); s1=s2; } while((status==Z_BUF_ERROR)&&(!plength)&&(factor<maxfactor)); @@ -845,7 +845,7 @@ PHP_FUNCTION(gzdeflate) if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zlimit); - level = (*zlimit)->value.lval; + level = Z_LVAL_PP(zlimit); if((level<0)||(level>9)) { php_error(E_WARNING,"gzdeflate: compression level must be whithin 0..9"); RETURN_FALSE; @@ -861,8 +861,8 @@ PHP_FUNCTION(gzdeflate) stream.zfree = (free_func) Z_NULL; stream.opaque = (voidpf) Z_NULL; - stream.next_in = (Bytef*) (*data)->value.str.val; - stream.avail_in = (*data)->value.str.len; + stream.next_in = (Bytef*) Z_STRVAL_PP(data); + stream.avail_in = Z_STRLEN_PP(data); stream.avail_out = stream.avail_in + (stream.avail_in/1000) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(stream.avail_out); @@ -916,11 +916,11 @@ PHP_FUNCTION(gzinflate) if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zlimit); - if((*zlimit)->value.lval<=0) { + if(Z_LVAL_PP(zlimit)<=0) { php_error(E_WARNING,"gzinflate: length must be greater zero"); RETURN_FALSE; } - plength = (*zlimit)->value.lval; + plength = Z_LVAL_PP(zlimit); break; default: WRONG_PARAM_COUNT; @@ -939,12 +939,12 @@ PHP_FUNCTION(gzinflate) stream.zfree = (free_func) Z_NULL; do { - length=plength?plength:(*data)->value.str.len*(1<<factor++); + length=plength?plength:Z_STRLEN_PP(data)*(1<<factor++); s2 = (char *) erealloc(s1,length); if(! s2) { if(s1) efree(s1); RETURN_FALSE; } - stream.next_in = (Bytef*) (*data)->value.str.val; - stream.avail_in = (uInt) (*data)->value.str.len; + stream.next_in = (Bytef*) Z_STRVAL_PP(data); + stream.avail_in = (uInt) Z_STRLEN_PP(data); stream.next_out = s2; stream.avail_out = (uInt) length; diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 4182d80c33..853a7fb558 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -360,7 +360,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) file_handle->filename = SG(request_info).path_translated; file_handle->free_filename = 0; file_handle->handle.fp = fp; - file_handle->type = ZEND_HANDLE_FP; + Z_TYPE_P(file_handle) = ZEND_HANDLE_FP; return SUCCESS; } diff --git a/main/main.c b/main/main.c index 3c1f16d480..6b01a62c28 100644 --- a/main/main.c +++ b/main/main.c @@ -483,9 +483,9 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ ALLOC_ZVAL(tmp); INIT_PZVAL(tmp); - tmp->value.str.val = (char *) estrndup(buffer, buffer_len); - tmp->value.str.len = buffer_len; - tmp->type = IS_STRING; + Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len); + Z_STRLEN_P(tmp) = buffer_len; + Z_TYPE_P(tmp) = IS_STRING; zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL); } } @@ -1206,14 +1206,14 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) } /* auto-type */ ALLOC_ZVAL(tmp); - tmp->type = IS_STRING; - tmp->value.str.len = strlen(ss); - tmp->value.str.val = estrndup(ss, tmp->value.str.len); + Z_TYPE_P(tmp) = IS_STRING; + Z_STRLEN_P(tmp) = strlen(ss); + Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp)); INIT_PZVAL(tmp); count++; - if (zend_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) { - if (tmp->type == IS_STRING) { - efree(tmp->value.str.val); + if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(pval *), NULL)==FAILURE) { + if (Z_TYPE_P(tmp) == IS_STRING) { + efree(Z_STRVAL_P(tmp)); } } if (space) { @@ -1227,8 +1227,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) /* prepare argc */ ALLOC_ZVAL(argc); - argc->value.lval = count; - argc->type = IS_LONG; + Z_LVAL_P(argc) = count; + Z_TYPE_P(argc) = IS_LONG; INIT_PZVAL(argc); if (PG(register_globals)) { @@ -1238,8 +1238,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL); } - zend_hash_update(track_vars_array->value.ht, "argv", sizeof("argv"), &arr, sizeof(pval *), NULL); - zend_hash_update(track_vars_array->value.ht, "argc", sizeof("argc"), &argc, sizeof(pval *), NULL); + zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL); + zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, sizeof(pval *), NULL); } /* }}} */ @@ -1283,7 +1283,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) PG(during_request_startup) = 0; - if (primary_file->type == ZEND_HANDLE_FILENAME + if (Z_TYPE_P(primary_file) == ZEND_HANDLE_FILENAME && primary_file->filename) { VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1); VCWD_CHDIR_FILE(primary_file->filename); @@ -1293,7 +1293,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) prepend_file.filename = PG(auto_prepend_file); prepend_file.opened_path = NULL; prepend_file.free_filename = 0; - prepend_file.type = ZEND_HANDLE_FILENAME; + Z_TYPE(prepend_file) = ZEND_HANDLE_FILENAME; prepend_file_p = &prepend_file; } else { prepend_file_p = NULL; @@ -1302,7 +1302,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) append_file.filename = PG(auto_append_file); append_file.opened_path = NULL; append_file.free_filename = 0; - append_file.type = ZEND_HANDLE_FILENAME; + Z_TYPE(append_file) = ZEND_HANDLE_FILENAME; append_file_p = &append_file; } else { append_file_p = NULL; diff --git a/main/output.c b/main/output.c index edbb29612d..f03f15af23 100644 --- a/main/output.c +++ b/main/output.c @@ -174,8 +174,8 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS OG(ob_lock) = 1; if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL TSRMLS_CC)==SUCCESS) { convert_to_string_ex(&alternate_buffer); - final_buffer = alternate_buffer->value.str.val; - final_buffer_length = alternate_buffer->value.str.len; + final_buffer = Z_STRVAL_P(alternate_buffer); + final_buffer_length = Z_STRLEN_P(alternate_buffer); } OG(ob_lock) = 0; zval_ptr_dtor(&OG(active_ob_buffer).output_handler); @@ -585,7 +585,7 @@ PHP_FUNCTION(ob_implicit_flush) RETURN_FALSE; } convert_to_long_ex(zv_flag); - flag = (*zv_flag)->value.lval; + flag = Z_LVAL_PP(zv_flag); break; default: WRONG_PARAM_COUNT; diff --git a/main/php_ini.c b/main/php_ini.c index 782d44f7c7..b1d40daf52 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -135,8 +135,8 @@ PHPAPI void display_ini_entries(zend_module_entry *module) */ static void pvalue_config_destructor(zval *pvalue) { - if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) { - free(pvalue->value.str.val); + if (Z_TYPE_P(pvalue) == IS_STRING && Z_STRVAL_P(pvalue) != empty_string) { + free(Z_STRVAL_P(pvalue)); } } /* }}} */ @@ -262,7 +262,7 @@ int php_init_config(char *php_ini_path_override) if (!fh.handle.fp) { return SUCCESS; /* having no configuration file is ok */ } - fh.type = ZEND_HANDLE_FP; + Z_TYPE(fh) = ZEND_HANDLE_FP; fh.filename = php_ini_opened_path; zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists); @@ -270,12 +270,12 @@ int php_init_config(char *php_ini_path_override) if (php_ini_opened_path) { zval tmp; - tmp.value.str.len = strlen(php_ini_opened_path); - tmp.value.str.val = zend_strndup(php_ini_opened_path, tmp.value.str.len); - tmp.type = IS_STRING; + Z_STRLEN(tmp) = strlen(php_ini_opened_path); + Z_STRVAL(tmp) = zend_strndup(php_ini_opened_path, Z_STRLEN(tmp)); + Z_TYPE(tmp) = IS_STRING; zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"), (void *) &tmp, sizeof(zval), NULL); efree(php_ini_opened_path); - php_ini_opened_path = zend_strndup(tmp.value.str.val, tmp.value.str.len); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); } return SUCCESS; @@ -333,7 +333,7 @@ PHPAPI int cfg_get_long(char *varname, long *result) var = *tmp; zval_copy_ctor(&var); convert_to_long(&var); - *result = var.value.lval; + *result = Z_LVAL(var); return SUCCESS; } /* }}} */ @@ -351,7 +351,7 @@ PHPAPI int cfg_get_double(char *varname, double *result) var = *tmp; zval_copy_ctor(&var); convert_to_double(&var); - *result = var.value.dval; + *result = Z_DVAL(var); return SUCCESS; } /* }}} */ @@ -366,7 +366,7 @@ PHPAPI int cfg_get_string(char *varname, char **result) *result=NULL; return FAILURE; } - *result = tmp->value.str.val; + *result = Z_STRVAL_P(tmp); return SUCCESS; } /* }}} */ diff --git a/main/php_variables.c b/main/php_variables.c index 4d9bd6467a..29db3d351a 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -40,13 +40,13 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva zval new_entry; /* Prepare value */ - new_entry.value.str.len = str_len; + Z_STRLEN(new_entry) = str_len; if (PG(magic_quotes_gpc)) { - new_entry.value.str.val = php_addslashes(strval, new_entry.value.str.len, &new_entry.value.str.len, 0 TSRMLS_CC); + Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC); } else { - new_entry.value.str.val = estrndup(strval, new_entry.value.str.len); + Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry)); } - new_entry.type = IS_STRING; + Z_TYPE(new_entry) = IS_STRING; php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); } @@ -69,9 +69,9 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_arra } if (track_vars_array) { if (symtable1) { - symtable2 = track_vars_array->value.ht; + symtable2 = Z_ARRVAL_P(track_vars_array); } else { - symtable1 = track_vars_array->value.ht; + symtable1 = Z_ARRVAL_P(track_vars_array); } } if (!symtable1) { @@ -129,7 +129,7 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_arra escaped_index = index; } if (zend_hash_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE - || (*gpc_element_p)->type != IS_ARRAY) { + || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { MAKE_STD_ZVAL(gpc_element); array_init(gpc_element); zend_hash_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); @@ -141,7 +141,7 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_arra if (!top_gpc_p) { top_gpc_p = gpc_element_p; } - symtable1 = (*gpc_element_p)->value.ht; + symtable1 = Z_ARRVAL_PP(gpc_element_p); /* ip pointed to the '[' character, now obtain the key */ index = ++ip; index_len = 0; @@ -169,7 +169,7 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_arra } else { MAKE_STD_ZVAL(gpc_element); gpc_element->value = val->value; - gpc_element->type = val->type; + Z_TYPE_P(gpc_element) = Z_TYPE_P(val); if (!index) { zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } else { diff --git a/main/rfc1867.c b/main/rfc1867.c index 802ded822a..abba25c221 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -446,8 +446,8 @@ static void php_mime_split(char *buf, int cnt, char *boundary, int len, zval *ar { zval file_size; - file_size.value.lval = bytes; - file_size.type = IS_LONG; + Z_LVAL(file_size) = bytes; + Z_TYPE(file_size) = IS_LONG; /* Add $foo_size */ if(is_arr_upload) { diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c index 7fb350e4f5..2178b98453 100644 --- a/sapi/aolserver/aolserver.c +++ b/sapi/aolserver/aolserver.c @@ -403,7 +403,7 @@ php_ns_module_main(TSRMLS_D) { zend_file_handle file_handle; - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c index 3a248c0ebb..e9d39c86c4 100644 --- a/sapi/apache/mod_php4.c +++ b/sapi/apache/mod_php4.c @@ -255,7 +255,7 @@ static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_ /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */ if (track_vars_array) { - symbol_table = track_vars_array->value.ht; + symbol_table = Z_ARRVAL_P(track_vars_array); } else if (PG(register_globals)) { /* should never happen nowadays */ symbol_table = EG(active_symbol_table); @@ -458,7 +458,7 @@ static void init_request_info(TSRMLS_D) */ static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC) { - zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, Z_TYPE_P(per_dir_entry), PHP_INI_STAGE_ACTIVATE); return 0; } /* }}} */ @@ -497,7 +497,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename) fh.filename = r->filename; fh.opened_path = NULL; fh.free_filename = 0; - fh.type = ZEND_HANDLE_FILENAME; + Z_TYPE(fh) = ZEND_HANDLE_FILENAME; zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &fh); return OK; } @@ -641,8 +641,8 @@ static void copy_per_dir_entry(php_per_dir_entry *per_dir_entry) */ static zend_bool should_overwrite_per_dir_entry(php_per_dir_entry *orig_per_dir_entry, php_per_dir_entry *new_per_dir_entry) { - if (new_per_dir_entry->type==PHP_INI_SYSTEM - && orig_per_dir_entry->type!=PHP_INI_SYSTEM) { + if (Z_TYPE_P(new_per_dir_entry)==PHP_INI_SYSTEM + && Z_TYPE_P(orig_per_dir_entry)!=PHP_INI_SYSTEM) { return 1; } else { return 0; @@ -697,7 +697,7 @@ CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, sapi_startup(&apache_sapi_module); php_apache_startup(&apache_sapi_module); } - per_dir_entry.type = mode; + Z_TYPE(per_dir_entry) = mode; if (strcasecmp(arg2, "none") == 0) { arg2 = ""; diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index 8cff77e6c4..9274ad2bc6 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -151,11 +151,11 @@ PHP_FUNCTION(apache_note) } convert_to_string_ex(arg_name); - note_val = (char *) table_get(((request_rec *)SG(server_context))->notes, (*arg_name)->value.str.val); + note_val = (char *) table_get(((request_rec *)SG(server_context))->notes, Z_STRVAL_PP(arg_name)); if (arg_count == 2) { convert_to_string_ex(arg_val); - table_set(((request_rec *)SG(server_context))->notes, (*arg_name)->value.str.val, (*arg_val)->value.str.val); + table_set(((request_rec *)SG(server_context))->notes, Z_STRVAL_PP(arg_name), Z_STRVAL_PP(arg_val)); } if (note_val) { @@ -307,14 +307,14 @@ PHP_FUNCTION(virtual) } convert_to_string_ex(filename); - if (!(rr = sub_req_lookup_uri ((*filename)->value.str.val, ((request_rec *) SG(server_context))))) { - php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", (*filename)->value.str.val); + if (!(rr = sub_req_lookup_uri (Z_STRVAL_PP(filename), ((request_rec *) SG(server_context))))) { + php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename)); if (rr) destroy_sub_req (rr); RETURN_FALSE; } if (rr->status != 200) { - php_error(E_WARNING, "Unable to include '%s' - error finding URI", (*filename)->value.str.val); + php_error(E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename)); if (rr) destroy_sub_req (rr); RETURN_FALSE; } @@ -323,7 +323,7 @@ PHP_FUNCTION(virtual) php_header(); if (run_sub_req(rr)) { - php_error(E_WARNING, "Unable to include '%s' - request execution failed", (*filename)->value.str.val); + php_error(E_WARNING, "Unable to include '%s' - request execution failed", Z_STRVAL_PP(filename)); if (rr) destroy_sub_req (rr); RETURN_FALSE; } else { @@ -393,8 +393,8 @@ PHP_FUNCTION(apache_lookup_uri) } convert_to_string_ex(filename); - if(!(rr = sub_req_lookup_uri((*filename)->value.str.val, ((request_rec *) SG(server_context))))) { - php_error(E_WARNING, "URI lookup failed", (*filename)->value.str.val); + if(!(rr = sub_req_lookup_uri(Z_STRVAL_PP(filename), ((request_rec *) SG(server_context))))) { + php_error(E_WARNING, "URI lookup failed", Z_STRVAL_PP(filename)); RETURN_FALSE; } object_init(return_value); @@ -468,8 +468,8 @@ PHP_FUNCTION(apache_exec_uri) } convert_to_string_ex(filename); - if(!(rr = ap_sub_req_lookup_uri((*filename)->value.str.val, ((request_rec *) SG(server_context))))) { - php_error(E_WARNING, "URI lookup failed", (*filename)->value.str.val); + if(!(rr = ap_sub_req_lookup_uri(Z_STRVAL_PP(filename), ((request_rec *) SG(server_context))))) { + php_error(E_WARNING, "URI lookup failed", Z_STRVAL_PP(filename)); RETURN_FALSE; } RETVAL_LONG(ap_run_sub_req(rr)); diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c index 30dff99c76..b62773e25a 100644 --- a/sapi/apache/sapi_apache.c +++ b/sapi/apache/sapi_apache.c @@ -81,7 +81,7 @@ int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC) return NOT_FOUND; } } else { - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.handle.fd = 0; file_handle.filename = SG(request_info).path_translated; file_handle.opened_path = NULL; diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 5dbb8947ff..b3b6cd17ff 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -369,7 +369,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) apr_file_name_get(&path, ((apr_bucket_file *) b->data)->fd); - zfd.type = ZEND_HANDLE_FILENAME; + Z_TYPE(zfd) = ZEND_HANDLE_FILENAME; zfd.filename = (char *) path; zfd.free_filename = 0; zfd.opened_path = NULL; diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c index 962b9acc92..6f6659508f 100644 --- a/sapi/caudium/caudium.c +++ b/sapi/caudium/caudium.c @@ -165,7 +165,7 @@ INLINE static struct svalue *lookup_header(char *headername) sind = make_shared_string("env"); headers = low_mapping_string_lookup(REQUEST_DATA, sind); free_string(sind); - if(!headers || headers->type != PIKE_T_MAPPING) return NULL; + if(!headers || Z_TYPE_P(headers) != PIKE_T_MAPPING) return NULL; sind = make_shared_string(headername); value = low_mapping_string_lookup(headers->u.mapping, sind); free_string(sind); @@ -180,7 +180,7 @@ INLINE static char *lookup_string_header(char *headername, char *default_value) { struct svalue *head = NULL; THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup"); - if(!head || head->type != PIKE_T_STRING) + if(!head || Z_TYPE_P(head) != PIKE_T_STRING) return default_value; return head->u.string->str; } @@ -192,7 +192,7 @@ INLINE static int lookup_integer_header(char *headername, int default_value) { struct svalue *head = NULL; THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup"); - if(!head || head->type != PIKE_T_INT) + if(!head || Z_TYPE_P(head) != PIKE_T_INT) return default_value; return head->u.integer; } @@ -288,10 +288,10 @@ php_caudium_set_header(char *header_name, char *value, char *p) (int)(p - header_name)); s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind); - if(!s_headermap || s_headermap->type != PIKE_T_MAPPING) + if(!s_headermap || Z_TYPE_P(s_headermap) != PIKE_T_MAPPING) { struct svalue mappie; - mappie.type = PIKE_T_MAPPING; + Z_TYPE(mappie) = PIKE_T_MAPPING; headermap = allocate_mapping(1); mappie.u.mapping = headermap; mapping_string_insert(REQUEST_DATA, ind, &mappie); @@ -302,7 +302,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) soldval = low_mapping_string_lookup(headermap, hind); vallen = strlen(value); if(soldval != NULL && - soldval->type == PIKE_T_STRING && + Z_TYPE_P(soldval) == PIKE_T_STRING && soldval->u.string->size_shift == 0) { /* Existing, valid header. Prepend.*/ hval = begin_shared_string(soldval->u.string->len + 1 + vallen); @@ -314,7 +314,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) hval = make_shared_string(value); } } - hsval.type = PIKE_T_STRING; + Z_TYPE(hsval) = PIKE_T_STRING; hsval.u.string = hval; mapping_string_insert(headermap, hind, &hsval); @@ -367,7 +367,7 @@ php_caudium_low_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) free_string(ind); push_int(SG(sapi_headers).http_response_code); - if(s_headermap && s_headermap->type == PIKE_T_MAPPING) + if(s_headermap && Z_TYPE_P(s_headermap) == PIKE_T_MAPPING) ref_push_mapping(s_headermap->u.mapping); else push_int(0); @@ -566,21 +566,21 @@ static void php_caudium_hash_environment(TSRMLS_D) sind = make_shared_string("env"); headers = low_mapping_string_lookup(REQUEST_DATA, sind); free_string(sind); - if(headers && headers->type == PIKE_T_MAPPING) { + if(headers && Z_TYPE_P(headers) == PIKE_T_MAPPING) { indices = mapping_indices(headers->u.mapping); for(i = 0; i < indices->size; i++) { ind = &indices->item[i]; val = low_mapping_lookup(headers->u.mapping, ind); - if(ind && ind->type == PIKE_T_STRING && - val && val->type == PIKE_T_STRING) { + if(ind && Z_TYPE_P(ind) == PIKE_T_STRING && + val && Z_TYPE_P(val) == PIKE_T_STRING) { int buf_len; buf_len = MIN(511, ind->u.string->len); strncpy(buf, ind->u.string->str, buf_len); buf[buf_len] = '\0'; /* Terminate correctly */ MAKE_STD_ZVAL(pval); - pval->type = IS_STRING; - pval->value.str.len = val->u.string->len; - pval->value.str.val = estrndup(val->u.string->str, pval->value.str.len); + Z_TYPE_P(pval) = IS_STRING; + Z_STRLEN_P(pval) = val->u.string->len; + Z_STRVAL_P(pval) = estrndup(val->u.string->str, Z_STRLEN_P(pval)); zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL); } @@ -590,8 +590,8 @@ static void php_caudium_hash_environment(TSRMLS_D) /* MAKE_STD_ZVAL(pval); - pval->type = IS_LONG; - pval->value.lval = Ns_InfoBootTime(); + Z_TYPE_P(pval) = IS_LONG; + Z_LVAL_P(pval) = Ns_InfoBootTime(); zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME", sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL); */ } @@ -688,7 +688,7 @@ static void php_caudium_module_main(php_caudium_request *ureq) VCWD_CHDIR_FILE(THIS->filename->str); #endif - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = THIS->filename->str; file_handle.opened_path = NULL; file_handle.free_filename = 0; @@ -759,7 +759,7 @@ void f_php_caudium_request_handler(INT32 args) get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script, &request_data, &my_fd_obj, &done_callback); - if(done_callback->type != PIKE_T_FUNCTION) + if(Z_TYPE_P(done_callback) != PIKE_T_FUNCTION) Pike_error("PHP4.Interpreter->run: Bad argument 4, expected function.\n"); add_ref(request_data); add_ref(my_fd_obj); @@ -772,7 +772,7 @@ void f_php_caudium_request_handler(INT32 args) ind = make_shared_binary_string("my_fd", 5); raw_fd = low_mapping_string_lookup(THIS->request_data, ind); - if(raw_fd && raw_fd->type == PIKE_T_OBJECT) + if(raw_fd && Z_TYPE_P(raw_fd) == PIKE_T_OBJECT) { int fd = fd_from_object(raw_fd->u.object); if(fd == -1) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 5c71db425c..64a664184e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -676,7 +676,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine SG(request_info).no_headers = 1; } file_handle.filename = "-"; - file_handle.type = ZEND_HANDLE_FP; + Z_TYPE(file_handle) = ZEND_HANDLE_FP; file_handle.handle.fp = stdin; file_handle.opened_path = NULL; file_handle.free_filename = 0; diff --git a/sapi/fastcgi/fastcgi.c b/sapi/fastcgi/fastcgi.c index 80b5c3c204..901b59bb9b 100644 --- a/sapi/fastcgi/fastcgi.c +++ b/sapi/fastcgi/fastcgi.c @@ -196,7 +196,7 @@ static void fastcgi_module_main(TSRMLS_D) zend_file_handle file_handle; int c, retval = FAILURE; - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index 6256d7f93b..db69ac4d93 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -748,7 +748,7 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) file_handle.filename = SG(request_info.path_translated); file_handle.free_filename = 0; #endif - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.opened_path = NULL; php_request_startup(TSRMLS_C); diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index 71d8c7ec28..c076fa711b 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -449,7 +449,7 @@ nsapi_module_main(NSLS_D TSRMLS_DC) return FAILURE; } - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c index dcd94a38e9..f7d46da7ce 100644 --- a/sapi/phttpd/phttpd.c +++ b/sapi/phttpd/phttpd.c @@ -259,7 +259,7 @@ int php_doit(TSRMLS_D TSRMLS_DC) return -1; } - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index a1bb15f527..33cc78613b 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -355,9 +355,9 @@ static void hash_pi3web_variables(TSRMLS_D) } *colon = 0; INIT_PZVAL(entry); - entry->value.str.len = strlen(value); - entry->value.str.val = estrndup(value, entry->value.str.len); - entry->type = IS_STRING; + Z_STRLEN_P(entry) = strlen(value); + Z_STRVAL_P(entry) = estrndup(value, Z_STRLEN_P(entry)); + Z_TYPE_P(entry) = IS_STRING; zend_hash_add(&EG(symbol_table), variable, strlen(variable)+1, &entry, sizeof(zval *), NULL); *colon = ':'; } @@ -379,7 +379,7 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) zend_first_try { file_handle.filename = lpCB->lpszFileName; file_handle.free_filename = 0; - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.opened_path = NULL; CG(extended_info) = 0; diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c index 81f67c43d0..5e38ea5d0c 100644 --- a/sapi/roxen/roxen.c +++ b/sapi/roxen/roxen.c @@ -172,7 +172,7 @@ static INLINE struct svalue *lookup_header(char *headername) sind = make_shared_string("env"); headers = low_mapping_string_lookup(REQUEST_DATA, sind); free_string(sind); - if(!headers || headers->type != PIKE_T_MAPPING) return NULL; + if(!headers || Z_TYPE_P(headers) != PIKE_T_MAPPING) return NULL; sind = make_shared_string(headername); value = low_mapping_string_lookup(headers->u.mapping, sind); free_string(sind); @@ -187,7 +187,7 @@ INLINE static char *lookup_string_header(char *headername, char *default_value) { struct svalue *head = NULL; THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup"); - if(!head || head->type != PIKE_T_STRING) + if(!head || Z_TYPE_P(head) != PIKE_T_STRING) return default_value; return head->u.string->str; } @@ -199,7 +199,7 @@ INLINE static int lookup_integer_header(char *headername, int default_value) { struct svalue *head = NULL; THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup"); - if(!head || head->type != PIKE_T_INT) + if(!head || Z_TYPE_P(head) != PIKE_T_INT) return default_value; return head->u.integer; } @@ -301,7 +301,7 @@ static void php_roxen_set_header(char *header_name, char *value, char *p) if(!s_headermap) { struct svalue mappie; - mappie.type = PIKE_T_MAPPING; + Z_TYPE(mappie) = PIKE_T_MAPPING; headermap = allocate_mapping(1); mappie.u.mapping = headermap; mapping_string_insert(REQUEST_DATA, ind, &mappie); @@ -309,7 +309,7 @@ static void php_roxen_set_header(char *header_name, char *value, char *p) } else headermap = s_headermap->u.mapping; - hsval.type = PIKE_T_STRING; + Z_TYPE(hsval) = PIKE_T_STRING; hsval.u.string = hval; mapping_string_insert(headermap, hind, &hsval); @@ -364,7 +364,7 @@ php_roxen_low_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) free_string(ind); push_int(SG(sapi_headers).http_response_code); - if(s_headermap && s_headermap->type == PIKE_T_MAPPING) + if(s_headermap && Z_TYPE_P(s_headermap) == PIKE_T_MAPPING) ref_push_mapping(s_headermap->u.mapping); else push_int(0); @@ -513,9 +513,9 @@ static sapi_module_struct roxen_sapi_module = { */ #define ADD_STRING(name) \ MAKE_STD_ZVAL(pval); \ - pval->type = IS_STRING; \ - pval->value.str.len = strlen(buf); \ - pval->value.str.val = estrndup(buf, pval->value.str.len); \ + Z_TYPE_P(pval) = IS_STRING; \ + Z_STRLEN_P(pval) = strlen(buf); \ + Z_STRVAL_P(pval) = estrndup(buf, Z_STRLEN_P(pval)); \ zend_hash_update(&EG(symbol_table), name, sizeof(name), \ &pval, sizeof(zval *), NULL) @@ -535,21 +535,21 @@ php_roxen_hash_environment(TSRMLS_D) sind = make_shared_string("env"); headers = low_mapping_string_lookup(REQUEST_DATA, sind); free_string(sind); - if(headers && headers->type == PIKE_T_MAPPING) { + if(headers && Z_TYPE_P(headers) == PIKE_T_MAPPING) { indices = mapping_indices(headers->u.mapping); for(i = 0; i < indices->size; i++) { ind = &indices->item[i]; val = low_mapping_lookup(headers->u.mapping, ind); - if(ind && ind->type == PIKE_T_STRING && - val && val->type == PIKE_T_STRING) { + if(ind && Z_TYPE_P(ind) == PIKE_T_STRING && + val && Z_TYPE_P(val) == PIKE_T_STRING) { int buf_len; buf_len = MIN(511, ind->u.string->len); strncpy(buf, ind->u.string->str, buf_len); buf[buf_len] = '\0'; /* Terminate correctly */ MAKE_STD_ZVAL(pval); - pval->type = IS_STRING; - pval->value.str.len = val->u.string->len; - pval->value.str.val = estrndup(val->u.string->str, pval->value.str.len); + Z_TYPE_P(pval) = IS_STRING; + Z_STRLEN_P(pval) = val->u.string->len; + Z_STRVAL_P(pval) = estrndup(val->u.string->str, Z_STRLEN_P(pval)); zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL); } @@ -559,8 +559,8 @@ php_roxen_hash_environment(TSRMLS_D) /* MAKE_STD_ZVAL(pval); - pval->type = IS_LONG; - pval->value.lval = Ns_InfoBootTime(); + Z_TYPE_P(pval) = IS_LONG; + Z_LVAL_P(pval) = Ns_InfoBootTime(); zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME", sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL); */ } @@ -579,7 +579,7 @@ static int php_roxen_module_main(TSRMLS_D) GET_THIS(); #endif - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = THIS->filename; file_handle.free_filename = 0; file_handle.opened_path = NULL; @@ -620,7 +620,7 @@ void f_php_roxen_request_handler(INT32 args) "callback!"); get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script, &request_data, &my_fd_obj, &done_callback); - if(done_callback->type != PIKE_T_FUNCTION) + if(Z_TYPE_P(done_callback) != PIKE_T_FUNCTION) error("PHP4.Interpreter->run: Bad argument 4, expected function.\n"); PHP_LOCK(THIS); /* Need to lock here or reusing the same object might cause * problems in changing stuff in that object */ @@ -653,7 +653,7 @@ void f_php_roxen_request_handler(INT32 args) ind = make_shared_binary_string("my_fd", 5); raw_fd = low_mapping_string_lookup(THIS->request_data, ind); - if(raw_fd && raw_fd->type == PIKE_T_OBJECT) + if(raw_fd && Z_TYPE_P(raw_fd) == PIKE_T_OBJECT) { int fd = fd_from_object(raw_fd->u.object); if(fd == -1) diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index ddb531a644..8226194f99 100644 --- a/sapi/thttpd/thttpd.c +++ b/sapi/thttpd/thttpd.c @@ -253,7 +253,7 @@ static void thttpd_module_main(TSRMLS_D) { zend_file_handle file_handle; - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c index 48fb84c86e..8aa9e51a1f 100644 --- a/sapi/tux/php_tux.c +++ b/sapi/tux/php_tux.c @@ -275,7 +275,7 @@ static void tux_module_main(TSRMLS_D) { zend_file_handle file_handle; - file_handle.type = ZEND_HANDLE_FILENAME; + Z_TYPE(file_handle) = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated; file_handle.free_filename = 0; file_handle.opened_path = NULL; |