Skip to content

Commit 08c4b47

Browse files
committed
update for phpng
1 parent 5ce6c33 commit 08c4b47

File tree

2 files changed

+28
-33
lines changed

2 files changed

+28
-33
lines changed

ext/calendar/calendar.c

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -260,29 +260,28 @@ PHP_MINFO_FUNCTION(calendar)
260260
php_info_print_table_end();
261261
}
262262

263-
static void _php_cal_info(int cal, zval **ret)
263+
static void _php_cal_info(int cal, zval *ret)
264264
{
265-
zval *months, *smonths;
265+
zval months, smonths;
266266
int i;
267267
struct cal_entry_t *calendar;
268268

269269
calendar = &cal_conversion_table[cal];
270-
array_init(*ret);
270+
array_init(ret);
271271

272-
MAKE_STD_ZVAL(months);
273-
MAKE_STD_ZVAL(smonths);
274-
array_init(months);
275-
array_init(smonths);
272+
array_init(&months);
273+
array_init(&smonths);
276274

277275
for (i = 1; i <= calendar->num_months; i++) {
278-
add_index_string(months, i, calendar->month_name_long[i]);
279-
add_index_string(smonths, i, calendar->month_name_short[i]);
276+
add_index_string(&months, i, calendar->month_name_long[i]);
277+
add_index_string(&smonths, i, calendar->month_name_short[i]);
280278
}
281-
add_assoc_zval(*ret, "months", months);
282-
add_assoc_zval(*ret, "abbrevmonths", smonths);
283-
add_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month);
284-
add_assoc_string(*ret, "calname", calendar->name);
285-
add_assoc_string(*ret, "calsymbol", calendar->symbol);
279+
280+
add_assoc_zval(ret, "months", &months);
281+
add_assoc_zval(ret, "abbrevmonths", &smonths);
282+
add_assoc_long(ret, "maxdaysinmonth", calendar->max_days_in_month);
283+
add_assoc_string(ret, "calname", calendar->name);
284+
add_assoc_string(ret, "calsymbol", calendar->symbol);
286285

287286
}
288287

@@ -299,14 +298,13 @@ PHP_FUNCTION(cal_info)
299298

300299
if (cal == -1) {
301300
int i;
302-
zval *val;
301+
zval val;
303302

304303
array_init(return_value);
305304

306305
for (i = 0; i < CAL_NUM_CALS; i++) {
307-
MAKE_STD_ZVAL(val);
308306
_php_cal_info(i, &val);
309-
add_index_zval(return_value, i, val);
307+
add_index_zval(return_value, i, &val);
310308
}
311309
return;
312310
}
@@ -317,7 +315,7 @@ PHP_FUNCTION(cal_info)
317315
RETURN_FALSE;
318316
}
319317

320-
_php_cal_info(cal, &return_value);
318+
_php_cal_info(cal, return_value);
321319

322320
}
323321
/* }}} */
@@ -447,7 +445,7 @@ PHP_FUNCTION(jdtogregorian)
447445
SdnToGregorian(julday, &year, &month, &day);
448446
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
449447

450-
RETURN_STRING(date, 1);
448+
RETURN_STRING(date);
451449
}
452450
/* }}} */
453451

@@ -480,7 +478,7 @@ PHP_FUNCTION(jdtojulian)
480478
SdnToJulian(julday, &year, &month, &day);
481479
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
482480

483-
RETURN_STRING(date, 1);
481+
RETURN_STRING(date);
484482
}
485483
/* }}} */
486484

@@ -610,7 +608,7 @@ PHP_FUNCTION(jdtojewish)
610608
SdnToJewish(julday, &year, &month, &day);
611609
if (!heb) {
612610
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
613-
RETURN_STRING(date, 1);
611+
RETURN_STRING(date);
614612
} else {
615613
if (year <= 0 || year > 9999) {
616614
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Year out of range (0-9999).");
@@ -626,7 +624,7 @@ PHP_FUNCTION(jdtojewish)
626624
efree(yearp);
627625
}
628626

629-
RETURN_STRING(hebdate, 1);
627+
RETURN_STRING(hebdate);
630628

631629
}
632630
}
@@ -661,7 +659,7 @@ PHP_FUNCTION(jdtofrench)
661659
SdnToFrench(julday, &year, &month, &day);
662660
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
663661

664-
RETURN_STRING(date, 1);
662+
RETURN_STRING(date);
665663
}
666664
/* }}} */
667665

@@ -697,10 +695,10 @@ PHP_FUNCTION(jddayofweek)
697695

698696
switch (mode) {
699697
case CAL_DOW_SHORT:
700-
RETURN_STRING(daynamel, 1);
698+
RETURN_STRING(daynamel);
701699
break;
702700
case CAL_DOW_LONG:
703-
RETURN_STRING(daynames, 1);
701+
RETURN_STRING(daynames);
704702
break;
705703
case CAL_DOW_DAYNO:
706704
default:
@@ -750,7 +748,7 @@ PHP_FUNCTION(jdmonthname)
750748
break;
751749
}
752750

753-
RETURN_STRING(monthname, 1);
751+
RETURN_STRING(monthname);
754752
}
755753
/* }}} */
756754

ext/calendar/easter.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
3030
/* based on code by Simon Kershaw, <[email protected]> */
3131

3232
struct tm te;
33-
long year, golden, solar, lunar, pfm, dom, tmp, easter;
33+
long year, golden, solar, lunar, pfm, dom, tmp, easter, result;
3434
long method = CAL_EASTER_DEFAULT;
3535

3636
/* Default to the current year if year parameter is not given */
@@ -111,14 +111,11 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
111111
te.tm_mon = 3; /* April */
112112
te.tm_mday = easter-10;
113113
}
114-
115-
Z_LVAL_P(return_value) = mktime(&te);
114+
result = mktime(&te);
116115
} else { /* return the days after March 21 */
117-
Z_LVAL_P(return_value) = easter;
116+
result = easter;
118117
}
119-
120-
Z_TYPE_P(return_value) = IS_LONG;
121-
118+
ZVAL_LONG(return_value, result);
122119
}
123120

124121
/* {{{ proto int easter_date([int year])

0 commit comments

Comments
 (0)