diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-04-15 15:40:40 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-04-15 15:40:40 +0400 |
commit | 050d7e38ad4163e7fa65e26724d3516ce7b33601 (patch) | |
tree | 2bb49b1b73c37b35fc778e83d9353f0eb9cc12a3 /ext | |
parent | 93d3a613d82d32dd6f5499e211bfe194d60898b0 (diff) | |
download | php-git-050d7e38ad4163e7fa65e26724d3516ce7b33601.tar.gz |
Cleanup (1-st round)
Diffstat (limited to 'ext')
102 files changed, 776 insertions, 731 deletions
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index 2f440597ba..668f88c78d 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -618,7 +618,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) array_init(return_value); add_assoc_long (return_value, "errno", errnum); - add_assoc_string(return_value, "errstr", (char*)errstr, 1); + add_assoc_string(return_value, "errstr", (char*)errstr); break; } } diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 34b34da371..4a8bfc4985 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -275,14 +275,14 @@ static void _php_cal_info(int cal, zval **ret) array_init(smonths); for (i = 1; i <= calendar->num_months; i++) { - add_index_string(months, i, calendar->month_name_long[i], 1); - add_index_string(smonths, i, calendar->month_name_short[i], 1); + add_index_string(months, i, calendar->month_name_long[i]); + add_index_string(smonths, i, calendar->month_name_short[i]); } add_assoc_zval(*ret, "months", months); add_assoc_zval(*ret, "abbrevmonths", smonths); add_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month); - add_assoc_string(*ret, "calname", calendar->name, 1); - add_assoc_string(*ret, "calsymbol", calendar->symbol, 1); + add_assoc_string(*ret, "calname", calendar->name); + add_assoc_string(*ret, "calsymbol", calendar->symbol); } @@ -409,7 +409,7 @@ PHP_FUNCTION(cal_from_jd) calendar->from_jd(jd, &year, &month, &day); snprintf(date, sizeof(date), "%i/%i/%i", month, day, year); - add_assoc_string(return_value, "date", date, 1); + add_assoc_string(return_value, "date", date); add_assoc_long(return_value, "month", month); add_assoc_long(return_value, "day", day); @@ -418,16 +418,16 @@ PHP_FUNCTION(cal_from_jd) /* day of week */ dow = DayOfWeek(jd); add_assoc_long(return_value, "dow", dow); - add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1); - add_assoc_string(return_value, "dayname", DayNameLong[dow], 1); + add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]); + add_assoc_string(return_value, "dayname", DayNameLong[dow]); /* month name */ if(cal == CAL_JEWISH) { /* special case for Jewish calendar */ - add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month], 1); - add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month], 1); + add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month]); + add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month]); } else { - add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1); - add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1); + add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month]); + add_assoc_string(return_value, "monthname", calendar->month_name_long[month]); } } /* }}} */ diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 921929aa52..bdf0eb14b7 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -156,7 +156,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC); #define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (long) v); #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s), (double) v); -#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) (v ? v : ""), 1); +#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) (v ? v : "")); #define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v); #if defined(PHP_WIN32) || defined(__GNUC__) @@ -1758,7 +1758,7 @@ PHP_FUNCTION(curl_version) array_init(protocol_list); while (*p != NULL) { - add_next_index_string(protocol_list, *p, 1); + add_next_index_string(protocol_list, *p); p++; } CAAZ("protocols", protocol_list); @@ -1822,7 +1822,7 @@ static void split_certinfo(char *string, zval *hash) if(tmp) { *tmp = '\0'; val = tmp+1; - add_assoc_string(hash, key, val, 1); + add_assoc_string(hash, key, val); } s = split+2; } while(split); @@ -1863,7 +1863,7 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode TSRMLS_DC) split_certinfo(&slist->data[len+1], hash); add_assoc_zval(certhash, s, hash); } else { - add_assoc_string(certhash, s, &slist->data[len+1], 1); + add_assoc_string(certhash, s, &slist->data[len+1]); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not extract hash key from certificate info"); @@ -3167,7 +3167,7 @@ PHP_FUNCTION(curl_getinfo) array_init(return_value); if (curl_easy_getinfo(ch->cp, option, &slist) == CURLE_OK) { while (slist) { - add_next_index_string(return_value, slist->data, 1); + add_next_index_string(return_value, slist->data); slist = slist->next; } curl_slist_free_all(slist); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index ca58fc1a4a..6bc2db7a71 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1807,8 +1807,8 @@ PHP_FUNCTION(getdate) add_assoc_long(return_value, "mon", ts->m); add_assoc_long(return_value, "year", ts->y); add_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); - add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d), 1); - add_assoc_string(return_value, "month", mon_full_names[ts->m - 1], 1); + add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d)); + add_assoc_string(return_value, "month", mon_full_names[ts->m - 1]); add_index_long(return_value, 0, timestamp); timelib_time_dtor(ts); @@ -2826,14 +2826,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) / add_assoc_long(z, "warning_count", error->warning_count); array_init(&element); for (i = 0; i < error->warning_count; i++) { - add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message, 1); + add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message); } add_assoc_zval(z, "warnings", &element); add_assoc_long(z, "error_count", error->error_count); array_init(&element); for (i = 0; i < error->error_count; i++) { - add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message, 1); + add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message); } add_assoc_zval(z, "errors", &element); } /* }}} */ @@ -2891,16 +2891,16 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * break; case TIMELIB_ZONETYPE_ID: if (parsed_time->tz_abbr) { - add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1); + add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr); } if (parsed_time->tz_info) { - add_assoc_string(return_value, "tz_id", parsed_time->tz_info->name, 1); + add_assoc_string(return_value, "tz_id", parsed_time->tz_info->name); } break; case TIMELIB_ZONETYPE_ABBR: PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z); add_assoc_bool(return_value, "is_dst", parsed_time->dst); - add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1); + add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr); break; } } @@ -3840,7 +3840,7 @@ PHP_FUNCTION(timezone_transitions_get) add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC)); \ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \ - add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \ + add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \ add_next_index_zval(return_value, &element); #define add(i,ts) \ @@ -3849,7 +3849,7 @@ PHP_FUNCTION(timezone_transitions_get) add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC)); \ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \ - add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \ + add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \ add_next_index_zval(return_value, &element); #define add_last() add(tzobj->tzi.tz->timecnt - 1, timestamp_begin) @@ -3913,10 +3913,10 @@ PHP_FUNCTION(timezone_location_get) } array_init(return_value); - add_assoc_string(return_value, "country_code", tzobj->tzi.tz->location.country_code, 1); + add_assoc_string(return_value, "country_code", tzobj->tzi.tz->location.country_code); add_assoc_double(return_value, "latitude", tzobj->tzi.tz->location.latitude); add_assoc_double(return_value, "longitude", tzobj->tzi.tz->location.longitude); - add_assoc_string(return_value, "comments", tzobj->tzi.tz->location.comments, 1); + add_assoc_string(return_value, "comments", tzobj->tzi.tz->location.comments); } /* }}} */ @@ -4454,10 +4454,10 @@ PHP_FUNCTION(timezone_identifiers_list) for (i = 0; i < item_count; ++i) { if (what == PHP_DATE_TIMEZONE_PER_COUNTRY) { if (tzdb->data[table[i].pos + 5] == option[0] && tzdb->data[table[i].pos + 6] == option[1]) { - add_next_index_string(return_value, table[i].id, 1); + add_next_index_string(return_value, table[i].id); } } else if (what == PHP_DATE_TIMEZONE_GROUP_ALL_W_BC || (check_id_allowed(table[i].id, what) && (tzdb->data[table[i].pos + 4] == '\1'))) { - add_next_index_string(return_value, table[i].id, 1); + add_next_index_string(return_value, table[i].id); } }; } @@ -4492,7 +4492,7 @@ PHP_FUNCTION(timezone_abbreviations_list) add_assoc_bool(&element, "dst", entry->type); add_assoc_long(&element, "offset", entry->gmtoffset); if (entry->full_tz_name) { - add_assoc_string(&element, "timezone_id", entry->full_tz_name, 1); + add_assoc_string(&element, "timezone_id", entry->full_tz_name); } else { add_assoc_null(&element, "timezone_id"); } diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 9df7f34001..86c27d172e 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -1062,11 +1062,11 @@ PHP_FUNCTION(dba_key_split) } array_init(return_value); if (key[0] == '[' && (name = strchr(key, ']')) != NULL) { - add_next_index_stringl(return_value, key+1, name - (key + 1), 1); - add_next_index_stringl(return_value, name+1, key_len - (name - key + 1), 1); + add_next_index_stringl(return_value, key+1, name - (key + 1)); + add_next_index_stringl(return_value, name+1, key_len - (name - key + 1)); } else { - add_next_index_stringl(return_value, "", 0, 1); - add_next_index_stringl(return_value, key, key_len, 1); + add_next_index_stringl(return_value, "", 0); + add_next_index_stringl(return_value, key, key_len); } } /* }}} */ @@ -1215,9 +1215,12 @@ PHP_FUNCTION(dba_handlers) for(hptr = handler; hptr->name; hptr++) { if (full_info) { - add_assoc_string(return_value, hptr->name, hptr->info(hptr, NULL TSRMLS_CC), 0); + // TODO: avoid reallocation ??? + char *str = hptr->info(hptr, NULL TSRMLS_CC); + add_assoc_string(return_value, hptr->name, str); + efree(str); } else { - add_next_index_string(return_value, hptr->name, 1); + add_next_index_string(return_value, hptr->name); } } } @@ -1244,7 +1247,7 @@ PHP_FUNCTION(dba_list) } if (Z_TYPE_P(le) == le_db || Z_TYPE_P(le) == le_pdb) { info = (dba_info *)(le->ptr); - add_index_string(return_value, i, info->path, 1); + add_index_string(return_value, i, info->path); } } } diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 6de2feac80..e577b37003 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -186,9 +186,9 @@ enumerate_providers_fn (const char * const name, MAKE_STD_ZVAL(tmp_array); array_init(tmp_array); - add_assoc_string(tmp_array, "name", (char *)name, 1); - add_assoc_string(tmp_array, "desc", (char *)desc, 1); - add_assoc_string(tmp_array, "file", (char *)file, 1); + add_assoc_string(tmp_array, "name", (char *)name); + add_assoc_string(tmp_array, "desc", (char *)desc); + add_assoc_string(tmp_array, "file", (char *)file); if (Z_TYPE_P(zdesc)!=IS_ARRAY) { array_init(zdesc); @@ -207,10 +207,10 @@ describe_dict_fn (const char * const lang, { zval *zdesc = (zval *) ud; array_init(zdesc); - add_assoc_string(zdesc, "lang", (char *)lang, 1); - add_assoc_string(zdesc, "name", (char *)name, 1); - add_assoc_string(zdesc, "desc", (char *)desc, 1); - add_assoc_string(zdesc, "file", (char *)file, 1); + add_assoc_string(zdesc, "lang", (char *)lang); + add_assoc_string(zdesc, "name", (char *)name); + add_assoc_string(zdesc, "desc", (char *)desc); + add_assoc_string(zdesc, "file", (char *)file); } /* }}} */ @@ -223,10 +223,10 @@ static void php_enchant_list_dicts_fn( const char * const lang_tag, MAKE_STD_ZVAL(tmp_array); array_init(tmp_array); - add_assoc_string(tmp_array, "lang_tag", (char *)lang_tag, 1); - add_assoc_string(tmp_array, "provider_name", (char *)provider_name, 1); - add_assoc_string(tmp_array, "provider_desc", (char *)provider_desc, 1); - add_assoc_string(tmp_array, "provider_file", (char *)provider_file, 1); + add_assoc_string(tmp_array, "lang_tag", (char *)lang_tag); + add_assoc_string(tmp_array, "provider_name", (char *)provider_name); + add_assoc_string(tmp_array, "provider_desc", (char *)provider_desc); + add_assoc_string(tmp_array, "provider_file", (char *)provider_file); if (Z_TYPE_P(zdesc) != IS_ARRAY) { array_init(zdesc); @@ -749,7 +749,7 @@ PHP_FUNCTION(enchant_dict_quick_check) if (suggs && n_sugg) { int i; for (i = 0; i < n_sugg; i++) { - add_next_index_string(sugg, suggs[i], 1); + add_next_index_string(sugg, suggs[i]); } enchant_dict_free_suggestions(pdict->pdict, suggs); } @@ -805,7 +805,7 @@ PHP_FUNCTION(enchant_dict_suggest) array_init(return_value); for (i = 0; i < n_sugg; i++) { - add_next_index_string(return_value, suggs[i], 1); + add_next_index_string(return_value, suggs[i]); } enchant_dict_free_suggestions(pdict->pdict, suggs); diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index a6496502f8..668f955105 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -352,7 +352,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) match_len = 1; if (array) { - ZVAL_DEREF_REF(array); + ZVAL_DEREF(array); } if (array && err != REG_NOMATCH) { @@ -368,7 +368,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) start = subs[i].rm_so; end = subs[i].rm_eo; if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) { - add_index_stringl(array, i, string+start, end-start, 1); + add_index_stringl(array, i, string+start, end-start); } else { add_index_bool(array, i, 0); } @@ -664,7 +664,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) { if (subs[0].rm_so == 0 && subs[0].rm_eo) { /* match is at start of string, return empty string */ - add_next_index_stringl(return_value, "", 0, 1); + add_next_index_stringl(return_value, "", 0); /* skip ahead the length of the regex match */ strp += subs[0].rm_eo; } else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) { @@ -683,7 +683,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) size = subs[0].rm_so; /* add it to the array */ - add_next_index_stringl(return_value, strp, size, 1); + add_next_index_stringl(return_value, strp, size); /* point at our new starting point */ strp = strp + subs[0].rm_eo; @@ -708,7 +708,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) /* otherwise we just have one last element to add to the array */ size = endp - strp; - add_next_index_stringl(return_value, strp, size, 1); + add_next_index_stringl(return_value, strp, size); regfree(&re); } diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 0b28f1c260..7900998a81 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -1981,9 +1981,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im case TAG_FMT_SBYTE: case TAG_FMT_UNDEFINED: if (!info_value->s) { - add_assoc_stringl(tmpi, name, "", 0, 1); + add_assoc_stringl(tmpi, name, "", 0); } else { - add_assoc_stringl(tmpi, name, info_value->s, info_data->length, 1); + add_assoc_stringl(tmpi, name, info_value->s, info_data->length); } break; @@ -1992,9 +1992,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im val = ""; } if (section_index==SECTION_COMMENT) { - add_index_string(tmpi, idx++, val, 1); + add_index_string(tmpi, idx++, val); } else { - add_assoc_string(tmpi, name, val, 1); + add_assoc_string(tmpi, name, val); } break; @@ -2039,9 +2039,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im case TAG_FMT_URATIONAL: snprintf(buffer, sizeof(buffer), "%i/%i", info_value->ur.num, info_value->ur.den); if (l==1) { - add_assoc_string(tmpi, name, buffer, 1); + add_assoc_string(tmpi, name, buffer); } else { - add_index_string(array, ap, buffer, 1); + add_index_string(array, ap, buffer); } break; @@ -2065,9 +2065,9 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im case TAG_FMT_SRATIONAL: snprintf(buffer, sizeof(buffer), "%i/%i", info_value->sr.num, info_value->sr.den); if (l==1) { - add_assoc_string(tmpi, name, buffer, 1); + add_assoc_string(tmpi, name, buffer); } else { - add_index_string(array, ap, buffer, 1); + add_index_string(array, ap, buffer); } break; diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c index 644807d0dd..37c0631d6f 100644 --- a/ext/filter/callback_filter.c +++ b/ext/filter/callback_filter.c @@ -41,7 +41,8 @@ void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL) if (status == SUCCESS && retval_ptr != NULL) { if (retval_ptr != value) { zval_dtor(value); - COPY_PZVAL_TO_ZVAL(*value, retval_ptr); + ZVAL_COPY_VALUE(value, retval_ptr); +//??? COPY_PZVAL_TO_ZVAL(*value, retval_ptr); } else { zval_ptr_dtor(&retval_ptr); } diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 4d3899e089..9007a36c87 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -896,7 +896,7 @@ PHP_FUNCTION(filter_list) array_init(return_value); for (i = 0; i < size; ++i) { - add_next_index_string(return_value, (char *)filter_list[i].name, 1); + add_next_index_string(return_value, (char *)filter_list[i].name); } } /* }}} */ diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 558463b845..2047193a94 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -479,7 +479,7 @@ ftp_raw(ftpbuf_t *ftp, const char *cmd, zval *return_value) } array_init(return_value); while (ftp_readline(ftp)) { - add_next_index_string(return_value, ftp->inbuf, 1); + add_next_index_string(return_value, ftp->inbuf); if (isdigit(ftp->inbuf[0]) && isdigit(ftp->inbuf[1]) && isdigit(ftp->inbuf[2]) && ftp->inbuf[3] == ' ') { return; } diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 79c871f559..9856559552 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -673,7 +673,7 @@ PHP_FUNCTION(ftp_nlist) array_init(return_value); for (ptr = nlist; *ptr; ptr++) { - add_next_index_string(return_value, *ptr, 1); + add_next_index_string(return_value, *ptr); } efree(nlist); } @@ -702,7 +702,7 @@ PHP_FUNCTION(ftp_rawlist) array_init(return_value); for (ptr = llist; *ptr; ptr++) { - add_next_index_string(return_value, *ptr, 1); + add_next_index_string(return_value, *ptr); } efree(llist); } diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 2a704d7a85..b54606ebd3 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1361,14 +1361,14 @@ PHP_FUNCTION(gd_info) array_init(return_value); - add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING, 1); + add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING); #ifdef ENABLE_GD_TTF add_assoc_bool(return_value, "FreeType Support", 1); #if HAVE_LIBFREETYPE - add_assoc_string(return_value, "FreeType Linkage", "with freetype", 1); + add_assoc_string(return_value, "FreeType Linkage", "with freetype"); #else - add_assoc_string(return_value, "FreeType Linkage", "with unknown library", 1); + add_assoc_string(return_value, "FreeType Linkage", "with unknown library"); #endif #else add_assoc_bool(return_value, "FreeType Support", 0); diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 928ec778dc..1e8d45eca5 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -599,7 +599,7 @@ PHP_FUNCTION(hash_algos) for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos); (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, &str_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTENT; zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) { - add_next_index_stringl(return_value, str, str_len-1, 1); + add_next_index_stringl(return_value, str, str_len-1); } } /* }}} */ diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index ea6ac1a1f1..ec4753e409 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -2355,9 +2355,9 @@ PHP_FUNCTION(iconv_mime_decode_headers) elem = &new_elem; } - add_next_index_stringl(*elem, header_value, header_value_len, 1); + add_next_index_stringl(*elem, header_value, header_value_len); } else { - add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len, 1); + add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len); } } encoded_str_len -= next_pos - encoded_str; @@ -2451,9 +2451,9 @@ PHP_FUNCTION(iconv_get_encoding) if (!strcasecmp("all", type)) { array_init(return_value); - add_assoc_string(return_value, "input_encoding", ICONVG(input_encoding), 1); - add_assoc_string(return_value, "output_encoding", ICONVG(output_encoding), 1); - add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding), 1); + add_assoc_string(return_value, "input_encoding", ICONVG(input_encoding)); + add_assoc_string(return_value, "output_encoding", ICONVG(output_encoding)); + add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding)); } else if (!strcasecmp("input_encoding", type)) { RETVAL_STRING(ICONVG(input_encoding), 1); } else if (!strcasecmp("output_encoding", type)) { diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 0e8310a367..876be777a8 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -793,7 +793,7 @@ void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist) /* walk through the ACLLIST */ for(; alist; alist = alist->next) { - add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights), 1); + add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights)); } } /* }}} */ @@ -1667,7 +1667,7 @@ PHP_FUNCTION(imap_headers) } mail_fetchsubject(t = tmp + strlen(tmp), imap_le_struct->imap_stream, msgno, (long)25); snprintf(t += strlen(t), sizeof(tmp) - strlen(tmp), " (%ld chars)", cache->rfc822_size); - add_next_index_string(return_value, tmp, 1); + add_next_index_string(return_value, tmp); } } /* }}} */ @@ -1862,7 +1862,7 @@ PHP_FUNCTION(imap_list) array_init(return_value); cur=IMAPG(imap_folders); while (cur != NIL) { - add_next_index_string(return_value, cur->LTEXT, 1); + add_next_index_string(return_value, cur->LTEXT); cur=cur->next; } mail_free_stringlist (&IMAPG(imap_folders)); @@ -1904,14 +1904,14 @@ PHP_FUNCTION(imap_list_full) while (cur != NIL) { MAKE_STD_ZVAL(mboxob); object_init(mboxob); - add_property_string(mboxob, "name", cur->LTEXT, 1); + add_property_string(mboxob, "name", cur->LTEXT); add_property_long(mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; - add_property_string(mboxob, "delimiter", delim, 1); + add_property_string(mboxob, "delimiter", delim); #else - add_property_string(mboxob, "delimiter", cur->delimiter, 1); + add_property_string(mboxob, "delimiter", cur->delimiter); #endif add_next_index_object(return_value, mboxob TSRMLS_CC); cur=cur->next; @@ -1947,7 +1947,7 @@ PHP_FUNCTION(imap_listscan) array_init(return_value); cur=IMAPG(imap_folders); while (cur != NIL) { - add_next_index_string(return_value, cur->LTEXT, 1); + add_next_index_string(return_value, cur->LTEXT); cur=cur->next; } mail_free_stringlist (&IMAPG(imap_folders)); @@ -1977,9 +1977,9 @@ PHP_FUNCTION(imap_check) if (imap_le_struct->imap_stream && imap_le_struct->imap_stream->mailbox) { rfc822_date(date); object_init(return_value); - add_property_string(return_value, "Date", date, 1); - add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1); - add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1); + add_property_string(return_value, "Date", date); + add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); + add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); } else { @@ -2084,33 +2084,33 @@ PHP_FUNCTION(imap_headerinfo) /* now run through properties that are only going to be returned from a server, not text headers */ - add_property_string(return_value, "Recent", cache->recent ? (cache->seen ? "R": "N") : " ", 1); - add_property_string(return_value, "Unseen", (cache->recent | cache->seen) ? " " : "U", 1); - add_property_string(return_value, "Flagged", cache->flagged ? "F" : " ", 1); - add_property_string(return_value, "Answered", cache->answered ? "A" : " ", 1); - add_property_string(return_value, "Deleted", cache->deleted ? "D" : " ", 1); - add_property_string(return_value, "Draft", cache->draft ? "X" : " ", 1); + add_property_string(return_value, "Recent", cache->recent ? (cache->seen ? "R": "N") : " "); + add_property_string(return_value, "Unseen", (cache->recent | cache->seen) ? " " : "U"); + add_property_string(return_value, "Flagged", cache->flagged ? "F" : " "); + add_property_string(return_value, "Answered", cache->answered ? "A" : " "); + add_property_string(return_value, "Deleted", cache->deleted ? "D" : " "); + add_property_string(return_value, "Draft", cache->draft ? "X" : " "); snprintf(dummy, sizeof(dummy), "%4ld", cache->msgno); - add_property_string(return_value, "Msgno", dummy, 1); + add_property_string(return_value, "Msgno", dummy); mail_date(dummy, cache); - add_property_string(return_value, "MailDate", dummy, 1); + add_property_string(return_value, "MailDate", dummy); snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size); - add_property_string(return_value, "Size", dummy, 1); + add_property_string(return_value, "Size", dummy); add_property_long(return_value, "udate", mail_longdate(cache)); if (en->from && fromlength) { fulladdress[0] = 0x00; mail_fetchfrom(fulladdress, imap_le_struct->imap_stream, msgno, fromlength); - add_property_string(return_value, "fetchfrom", fulladdress, 1); + add_property_string(return_value, "fetchfrom", fulladdress); } if (en->subject && subjectlength) { fulladdress[0] = 0x00; mail_fetchsubject(fulladdress, imap_le_struct->imap_stream, msgno, subjectlength); - add_property_string(return_value, "fetchsubject", fulladdress, 1); + add_property_string(return_value, "fetchsubject", fulladdress); } } /* }}} */ @@ -2169,7 +2169,7 @@ PHP_FUNCTION(imap_lsub) array_init(return_value); cur=IMAPG(imap_sfolders); while (cur != NIL) { - add_next_index_string(return_value, cur->LTEXT, 1); + add_next_index_string(return_value, cur->LTEXT); cur=cur->next; } mail_free_stringlist (&IMAPG(imap_sfolders)); @@ -2210,14 +2210,14 @@ PHP_FUNCTION(imap_lsub_full) while (cur != NIL) { MAKE_STD_ZVAL(mboxob); object_init(mboxob); - add_property_string(mboxob, "name", cur->LTEXT, 1); + add_property_string(mboxob, "name", cur->LTEXT); add_property_long(mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; - add_property_string(mboxob, "delimiter", delim, 1); + add_property_string(mboxob, "delimiter", delim); #else - add_property_string(mboxob, "delimiter", cur->delimiter, 1); + add_property_string(mboxob, "delimiter", cur->delimiter); #endif add_next_index_object(return_value, mboxob TSRMLS_CC); cur=cur->next; @@ -2586,9 +2586,9 @@ PHP_FUNCTION(imap_mailboxmsginfo) add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); add_property_long(return_value, "Size", msize); rfc822_date(date); - add_property_string(return_value, "Date", date, 1); - add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1); - add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1); + add_property_string(return_value, "Date", date); + add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); + add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); } /* }}} */ @@ -2662,16 +2662,16 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist) MAKE_STD_ZVAL(tovals); object_init(tovals); if (addresstmp->mailbox) { - add_property_string(tovals, "mailbox", addresstmp->mailbox, 1); + add_property_string(tovals, "mailbox", addresstmp->mailbox); } if (addresstmp->host) { - add_property_string(tovals, "host", addresstmp->host, 1); + add_property_string(tovals, "host", addresstmp->host); } if (addresstmp->personal) { - add_property_string(tovals, "personal", addresstmp->personal, 1); + add_property_string(tovals, "personal", addresstmp->personal); } if (addresstmp->adl) { - add_property_string(tovals, "adl", addresstmp->adl, 1); + add_property_string(tovals, "adl", addresstmp->adl); } add_next_index_object(return_value, tovals TSRMLS_CC); } while ((addresstmp = addresstmp->next)); @@ -3303,20 +3303,20 @@ PHP_FUNCTION(imap_bodystruct) if (body->subtype) { add_property_long(return_value, "ifsubtype", 1); - add_property_string(return_value, "subtype", body->subtype, 1); + add_property_string(return_value, "subtype", body->subtype); } else { add_property_long(return_value, "ifsubtype", 0); } if (body->description) { add_property_long(return_value, "ifdescription", 1); - add_property_string(return_value, "description", body->description, 1); + add_property_string(return_value, "description", body->description); } else { add_property_long(return_value, "ifdescription", 0); } if (body->id) { add_property_long(return_value, "ifid", 1); - add_property_string(return_value, "id", body->id, 1); + add_property_string(return_value, "id", body->id); } else { add_property_long(return_value, "ifid", 0); } @@ -3330,7 +3330,7 @@ PHP_FUNCTION(imap_bodystruct) #ifdef IMAP41 if (body->disposition.type) { add_property_long(return_value, "ifdisposition", 1); - add_property_string(return_value, "disposition", body->disposition.type, 1); + add_property_string(return_value, "disposition", body->disposition.type); } else { add_property_long(return_value, "ifdisposition", 0); } @@ -3343,8 +3343,8 @@ PHP_FUNCTION(imap_bodystruct) do { MAKE_STD_ZVAL(dparam); object_init(dparam); - add_property_string(dparam, "attribute", dpar->attribute, 1); - add_property_string(dparam, "value", dpar->value, 1); + add_property_string(dparam, "attribute", dpar->attribute); + add_property_string(dparam, "value", dpar->value); add_next_index_object(dparametres, dparam TSRMLS_CC); } while ((dpar = dpar->next)); add_assoc_object(return_value, "dparameters", dparametres TSRMLS_CC); @@ -3362,10 +3362,10 @@ PHP_FUNCTION(imap_bodystruct) MAKE_STD_ZVAL(param); object_init(param); if (par->attribute) { - add_property_string(param, "attribute", par->attribute, 1); + add_property_string(param, "attribute", par->attribute); } if (par->value) { - add_property_string(param, "value", par->value, 1); + add_property_string(param, "value", par->value); } add_next_index_object(parametres, param TSRMLS_CC); @@ -3421,33 +3421,37 @@ PHP_FUNCTION(imap_fetch_overview) MAKE_STD_ZVAL(myoverview); object_init(myoverview); if (env->subject) { - add_property_string(myoverview, "subject", env->subject, 1); + add_property_string(myoverview, "subject", env->subject); } if (env->from) { env->from->next=NULL; address =_php_rfc822_write_address(env->from TSRMLS_CC); if (address) { - add_property_string(myoverview, "from", address, 0); + // TODO: avoid reallocation ??? + add_property_string(myoverview, "from", address); + efree(address); } } if (env->to) { env->to->next = NULL; address = _php_rfc822_write_address(env->to TSRMLS_CC); if (address) { - add_property_string(myoverview, "to", address, 0); + // TODO: avoid reallocation ??? + add_property_string(myoverview, "to", address); + efree(address); } } if (env->date) { - add_property_string(myoverview, "date", env->date, 1); + add_property_string(myoverview, "date", env->date); } if (env->message_id) { - add_property_string(myoverview, "message_id", env->message_id, 1); + add_property_string(myoverview, "message_id", env->message_id); } if (env->references) { - add_property_string(myoverview, "references", env->references, 1); + add_property_string(myoverview, "references", env->references); } if (env->in_reply_to) { - add_property_string(myoverview, "in_reply_to", env->in_reply_to, 1); + add_property_string(myoverview, "in_reply_to", env->in_reply_to); } add_property_long(myoverview, "size", elt->rfc822_size); add_property_long(myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); @@ -4147,7 +4151,7 @@ PHP_FUNCTION(imap_alerts) cur = IMAPG(imap_alertstack); while (cur != NIL) { - add_next_index_string(return_value, cur->LTEXT, 1); + add_next_index_string(return_value, cur->LTEXT); cur = cur->next; } mail_free_stringlist(&IMAPG(imap_alertstack)); @@ -4174,7 +4178,7 @@ PHP_FUNCTION(imap_errors) cur = IMAPG(imap_errorstack); while (cur != NIL) { - add_next_index_string(return_value, cur->LTEXT, 1); + add_next_index_string(return_value, cur->LTEXT); cur = cur->next; } mail_free_errorlist(&IMAPG(imap_errorstack)); @@ -4238,8 +4242,8 @@ PHP_FUNCTION(imap_mime_header_decode) text[charset_token - offset] = 0x00; MAKE_STD_ZVAL(myobject); object_init(myobject); - add_property_string(myobject, "charset", "default", 1); - add_property_string(myobject, "text", text, 1); + add_property_string(myobject, "charset", "default"); + add_property_string(myobject, "text", text); 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 */ @@ -4265,8 +4269,8 @@ PHP_FUNCTION(imap_mime_header_decode) } MAKE_STD_ZVAL(myobject); object_init(myobject); - add_property_string(myobject, "charset", charset, 1); - add_property_string(myobject, "text", decode, 1); + add_property_string(myobject, "charset", charset); + add_property_string(myobject, "text", decode); zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void *)&myobject, sizeof(zval *), NULL); /* only free decode if it was allocated by rfc822_qprint or rfc822_base64 */ @@ -4295,8 +4299,8 @@ PHP_FUNCTION(imap_mime_header_decode) text[end - charset_token] = 0x00; MAKE_STD_ZVAL(myobject); object_init(myobject); - add_property_string(myobject, "charset", "default", 1); - add_property_string(myobject, "text", text, 1); + add_property_string(myobject, "charset", "default"); + add_property_string(myobject, "text", text); 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. */ @@ -4432,10 +4436,10 @@ static char* _php_imap_parse_address (ADDRESS *addresslist, zval *paddress TSRML do { MAKE_STD_ZVAL(tmpvals); object_init(tmpvals); - if (addresstmp->personal) add_property_string(tmpvals, "personal", addresstmp->personal, 1); - if (addresstmp->adl) add_property_string(tmpvals, "adl", addresstmp->adl, 1); - if (addresstmp->mailbox) add_property_string(tmpvals, "mailbox", addresstmp->mailbox, 1); - if (addresstmp->host) add_property_string(tmpvals, "host", addresstmp->host, 1); + if (addresstmp->personal) add_property_string(tmpvals, "personal", addresstmp->personal); + if (addresstmp->adl) add_property_string(tmpvals, "adl", addresstmp->adl); + if (addresstmp->mailbox) add_property_string(tmpvals, "mailbox", addresstmp->mailbox); + if (addresstmp->host) add_property_string(tmpvals, "host", addresstmp->host); add_next_index_object(paddress, tmpvals TSRMLS_CC); } while ((addresstmp = addresstmp->next)); return fulladdress; @@ -4451,23 +4455,25 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) object_init(myzvalue); - if (en->remail) add_property_string(myzvalue, "remail", en->remail, 1); - if (en->date) add_property_string(myzvalue, "date", en->date, 1); - if (en->date) add_property_string(myzvalue, "Date", en->date, 1); - if (en->subject) add_property_string(myzvalue, "subject", en->subject, 1); - if (en->subject) add_property_string(myzvalue, "Subject", en->subject, 1); - if (en->in_reply_to) add_property_string(myzvalue, "in_reply_to", en->in_reply_to, 1); - if (en->message_id) add_property_string(myzvalue, "message_id", en->message_id, 1); - if (en->newsgroups) add_property_string(myzvalue, "newsgroups", en->newsgroups, 1); - if (en->followup_to) add_property_string(myzvalue, "followup_to", en->followup_to, 1); - if (en->references) add_property_string(myzvalue, "references", en->references, 1); + if (en->remail) add_property_string(myzvalue, "remail", en->remail); + if (en->date) add_property_string(myzvalue, "date", en->date); + if (en->date) add_property_string(myzvalue, "Date", en->date); + if (en->subject) add_property_string(myzvalue, "subject", en->subject); + if (en->subject) add_property_string(myzvalue, "Subject", en->subject); + if (en->in_reply_to) add_property_string(myzvalue, "in_reply_to", en->in_reply_to); + if (en->message_id) add_property_string(myzvalue, "message_id", en->message_id); + if (en->newsgroups) add_property_string(myzvalue, "newsgroups", en->newsgroups); + if (en->followup_to) add_property_string(myzvalue, "followup_to", en->followup_to); + if (en->references) add_property_string(myzvalue, "references", en->references); if (en->to) { MAKE_STD_ZVAL(paddress); array_init(paddress); fulladdress = _php_imap_parse_address(en->to, paddress TSRMLS_CC); if (fulladdress) { - add_property_string(myzvalue, "toaddress", fulladdress, 0); + // TODO: avoid reallocation ??? + add_property_string(myzvalue, "toaddress", fulladdress); + efree(fulladdress); } add_assoc_object(myzvalue, "to", paddress TSRMLS_CC); } @@ -4477,7 +4483,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) array_init(paddress); fulladdress = _php_imap_parse_address(en->from, paddress TSRMLS_CC); if (fulladdress) { - add_property_string(myzvalue, "fromaddress", fulladdress, 0); + // TODO: avoid reallocation ??? + add_property_string(myzvalue, "fromaddress", fulladdress); + efree(fulladdress); } add_assoc_object(myzvalue, "from", paddress TSRMLS_CC); } @@ -4487,7 +4495,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) array_init(paddress); fulladdress = _php_imap_parse_address(en->cc, paddress TSRMLS_CC); if (fulladdress) { - add_property_string(myzvalue, "ccaddress", fulladdress, 0); + // TODO: avoid reallocation ??? + add_property_string(myzvalue, "ccaddress", fulladdress); + efree(fulladdress); } add_assoc_object(myzvalue, "cc", paddress TSRMLS_CC); } @@ -4497,7 +4507,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) array_init(paddress); fulladdress = _php_imap_parse_address(en->bcc, paddress TSRMLS_CC); if (fulladdress) { - add_property_string(myzvalue, "bccaddress", fulladdress, 0); + // TODO: avoid reallocation ??? + add_property_string(myzvalue, "bccaddress", fulladdress); + efree(fulladdress); } add_assoc_object(myzvalue, "bcc", paddress TSRMLS_CC); } @@ -4507,7 +4519,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) array_init(paddress); fulladdress = _php_imap_parse_address(en->reply_to, paddress TSRMLS_CC); if (fulladdress) { - add_property_string(myzvalue, "reply_toaddress", fulladdress, 0); + // TODO: avoid reallocation ??? + add_property_string(myzvalue, "reply_toaddress", fulladdress); + efree(fulladdress); } add_assoc_object(myzvalue, "reply_to", paddress TSRMLS_CC); } @@ -4517,7 +4531,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) array_init(paddress); fulladdress = _php_imap_parse_address(en->sender, paddress TSRMLS_CC); if (fulladdress) { - add_property_string(myzvalue, "senderaddress", fulladdress, 0); + // TODO: avoid reallocation ??? + add_property_string(myzvalue, "senderaddress", fulladdress); + efree(fulladdress); } add_assoc_object(myzvalue, "sender", paddress TSRMLS_CC); } @@ -4527,7 +4543,9 @@ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC) array_init(paddress); fulladdress = _php_imap_parse_address(en->return_path, paddress TSRMLS_CC); if (fulladdress) { - add_property_string(myzvalue, "return_pathaddress", fulladdress, 0); + // TODO: avoid reallocation ??? + add_property_string(myzvalue, "return_pathaddress", fulladdress); + efree(fulladdress); } add_assoc_object(myzvalue, "return_path", paddress TSRMLS_CC); } @@ -4552,21 +4570,21 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) if (body->subtype) { add_property_long(arg, "ifsubtype", 1); - add_property_string(arg, "subtype", body->subtype, 1); + add_property_string(arg, "subtype", body->subtype); } else { add_property_long(arg, "ifsubtype", 0); } if (body->description) { add_property_long(arg, "ifdescription", 1); - add_property_string(arg, "description", body->description, 1); + add_property_string(arg, "description", body->description); } else { add_property_long(arg, "ifdescription", 0); } if (body->id) { add_property_long(arg, "ifid", 1); - add_property_string(arg, "id", body->id, 1); + add_property_string(arg, "id", body->id); } else { add_property_long(arg, "ifid", 0); } @@ -4582,7 +4600,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) #ifdef IMAP41 if (body->disposition.type) { add_property_long(arg, "ifdisposition", 1); - add_property_string(arg, "disposition", body->disposition.type, 1); + add_property_string(arg, "disposition", body->disposition.type); } else { add_property_long(arg, "ifdisposition", 0); } @@ -4595,8 +4613,8 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) do { MAKE_STD_ZVAL(dparam); object_init(dparam); - add_property_string(dparam, "attribute", dpar->attribute, 1); - add_property_string(dparam, "value", dpar->value, 1); + add_property_string(dparam, "attribute", dpar->attribute); + add_property_string(dparam, "value", dpar->value); add_next_index_object(dparametres, dparam TSRMLS_CC); } while ((dpar = dpar->next)); add_assoc_object(arg, "dparameters", dparametres TSRMLS_CC); @@ -4614,10 +4632,10 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) MAKE_STD_ZVAL(param); object_init(param); if (par->attribute) { - add_property_string(param, "attribute", par->attribute, 1); + add_property_string(param, "attribute", par->attribute); } if (par->value) { - add_property_string(param, "value", par->value, 1); + add_property_string(param, "value", par->value); } add_next_index_object(parametres, param TSRMLS_CC); diff --git a/ext/interbase/ibase_query.c b/ext/interbase/ibase_query.c index 53eb7a885e..36e753794f 100644 --- a/ext/interbase/ibase_query.c +++ b/ext/interbase/ibase_query.c @@ -1918,18 +1918,18 @@ static void _php_ibase_field_info(zval *return_value, XSQLVAR *var) /* {{{ */ array_init(return_value); - add_index_stringl(return_value, 0, var->sqlname, var->sqlname_length, 1); - add_assoc_stringl(return_value, "name", var->sqlname, var->sqlname_length, 1); + add_index_stringl(return_value, 0, var->sqlname, var->sqlname_length); + add_assoc_stringl(return_value, "name", var->sqlname, var->sqlname_length); - add_index_stringl(return_value, 1, var->aliasname, var->aliasname_length, 1); - add_assoc_stringl(return_value, "alias", var->aliasname, var->aliasname_length, 1); + add_index_stringl(return_value, 1, var->aliasname, var->aliasname_length); + add_assoc_stringl(return_value, "alias", var->aliasname, var->aliasname_length); - add_index_stringl(return_value, 2, var->relname, var->relname_length, 1); - add_assoc_stringl(return_value, "relation", var->relname, var->relname_length, 1); + add_index_stringl(return_value, 2, var->relname, var->relname_length); + add_assoc_stringl(return_value, "relation", var->relname, var->relname_length); len = slprintf(buf, 16, "%d", var->sqllen); - add_index_stringl(return_value, 3, buf, len, 1); - add_assoc_stringl(return_value, "length", buf, len, 1); + add_index_stringl(return_value, 3, buf, len); + add_assoc_stringl(return_value, "length", buf, len); if (var->sqlscale < 0) { unsigned short precision = 0; @@ -1947,8 +1947,8 @@ static void _php_ibase_field_info(zval *return_value, XSQLVAR *var) /* {{{ */ break; } len = slprintf(buf, 16, "NUMERIC(%d,%d)", precision, -var->sqlscale); - add_index_stringl(return_value, 4, s, len, 1); - add_assoc_stringl(return_value, "type", s, len, 1); + add_index_stringl(return_value, 4, s, len); + add_assoc_stringl(return_value, "type", s, len); } else { switch (var->sqltype & ~1) { case SQL_TEXT: @@ -1992,8 +1992,8 @@ static void _php_ibase_field_info(zval *return_value, XSQLVAR *var) /* {{{ */ s = "QUAD"; break; } - add_index_string(return_value, 4, s, 1); - add_assoc_string(return_value, "type", s, 1); + add_index_string(return_value, 4, s); + add_assoc_string(return_value, "type", s); } } /* }}} */ diff --git a/ext/interbase/ibase_service.c b/ext/interbase/ibase_service.c index bd6d4ad1aa..a8a085d17b 100644 --- a/ext/interbase/ibase_service.c +++ b/ext/interbase/ibase_service.c @@ -353,7 +353,7 @@ query_loop: case isc_spb_dbname: len = isc_vax_integer(result,2); - add_next_index_stringl(return_value, result +2, len, 1); + add_next_index_stringl(return_value, result +2, len); result += len+2; } } while (*result != isc_info_flag_end); @@ -375,25 +375,25 @@ query_loop: add_next_index_zval(return_value, user); len = isc_vax_integer(result,2); - add_assoc_stringl(user, "user_name", result +2, len, 1); + add_assoc_stringl(user, "user_name", result +2, len); result += len+2; break; case isc_spb_sec_firstname: len = isc_vax_integer(result,2); - add_assoc_stringl(user, "first_name", result +2, len, 1); + add_assoc_stringl(user, "first_name", result +2, len); result += len+2; break; case isc_spb_sec_middlename: len = isc_vax_integer(result,2); - add_assoc_stringl(user, "middle_name", result +2, len, 1); + add_assoc_stringl(user, "middle_name", result +2, len); result += len+2; break; case isc_spb_sec_lastname: len = isc_vax_integer(result,2); - add_assoc_stringl(user, "last_name", result +2, len, 1); + add_assoc_stringl(user, "last_name", result +2, len); result += len+2; break; diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index b6b47348f0..181d0e03b9 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -165,7 +165,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp TSRMLS } add_assoc_string_ex(&zv, "type", sizeof("type"), - const_cast<char*>(typeid(*biter).name()), 1); + const_cast<char*>(typeid(*biter).name())); return Z_ARRVAL(zv); } diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index 497279e090..99828c43ea 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -168,7 +168,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1); add_assoc_string_ex(&zv, "type", sizeof("type"), - const_cast<char*>(cal->getType()), 1); + const_cast<char*>(cal->getType())); { zval ztz = zval_used_for_init, @@ -191,10 +191,10 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) Locale locale = cal->getLocale(ULOC_VALID_LOCALE, uec); if (U_SUCCESS(uec)) { add_assoc_string_ex(&zv, "locale", sizeof("locale"), - const_cast<char*>(locale.getName()), 1); + const_cast<char*>(locale.getName())); } else { add_assoc_string_ex(&zv, "locale", sizeof("locale"), - const_cast<char*>(u_errorName(uec)), 1); + const_cast<char*>(u_errorName(uec))); } } @@ -210,7 +210,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) if (U_SUCCESS(uec)) { add_assoc_long(zfields, name, (long)res); } else { - add_assoc_string(zfields, name, const_cast<char*>(u_errorName(uec)), 1); + add_assoc_string(zfields, name, const_cast<char*>(u_errorName(uec))); } } diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index ae7d0093f7..179602d8fa 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -210,7 +210,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_available_locales) array_init(return_value); for (int i = 0; i < count; i++) { Locale locale = availLocales[i]; - add_next_index_string(return_value, locale.getName(), 1); + add_next_index_string(return_value, locale.getName()); } } diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 5f2d1e7fa7..cddcf82418 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -549,7 +549,7 @@ static void php_converter_resolve_callback(zval *zobj, array_init(&caller); Z_ADDREF_P(zobj); add_index_zval(&caller, 0, zobj); - add_index_string(&caller, 1, callback_name, 1); + add_index_string(&caller, 1, callback_name); if (zend_fcall_info_init(&caller, 0, finfo, fcache, NULL, &errstr TSRMLS_CC) == FAILURE) { php_converter_throw_failure(objval, U_INTERNAL_PROGRAM_ERROR TSRMLS_CC, "Error setting converter callback: %s", errstr); } @@ -913,7 +913,7 @@ static PHP_METHOD(UConverter, getAvailable) { array_init(return_value); for(i = 0; i < count; i++) { const char *name = ucnv_getAvailableName(i); - add_next_index_string(return_value, name, 1); + add_next_index_string(return_value, name); } } /* }}} */ @@ -952,7 +952,7 @@ static PHP_METHOD(UConverter, getAliases) { zval_dtor(return_value); RETURN_NULL(); } - add_next_index_string(return_value, alias, 1); + add_next_index_string(return_value, alias); } } /* }}} */ @@ -980,7 +980,7 @@ static PHP_METHOD(UConverter, getStandards) { zval_dtor(return_value); RETURN_NULL(); } - add_next_index_string(return_value, name, 1); + add_next_index_string(return_value, name); } } /* }}} */ diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 21b5847f2d..f5be81f74a 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -724,7 +724,9 @@ PHP_FUNCTION( locale_get_keywords ) RETURN_FALSE; } - add_assoc_stringl( return_value, (char *)kw_key, kw_value , kw_value_len, 0); + // TODO: avoid reallocation ??? + add_assoc_stringl( return_value, (char *)kw_key, kw_value , kw_value_len); + efree(kw_value); } /* end of while */ } /* end of if e!=NULL */ @@ -1047,11 +1049,11 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name } cur_key_name = (char*)ecalloc( 25, 25); sprintf( cur_key_name , "%s%d", key_name , cnt++); - add_assoc_string( hash_arr, cur_key_name , token ,TRUE ); + add_assoc_string( hash_arr, cur_key_name , token); /* tokenize on the "_" or "-" and stop at singleton if any */ while( (token = php_strtok_r(NULL , DELIMITER , &last_ptr)) && (strlen(token)>1) ){ sprintf( cur_key_name , "%s%d", key_name , cnt++); - add_assoc_string( hash_arr, cur_key_name , token , TRUE ); + add_assoc_string( hash_arr, cur_key_name , token); } /* if( strcmp(key_name, LOC_PRIVATE_TAG) == 0 ){ @@ -1060,7 +1062,7 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name } } else { if( result == 1 ){ - add_assoc_string( hash_arr, key_name , key_value , TRUE ); + add_assoc_string( hash_arr, key_name , key_value); cur_result = 1; } } @@ -1107,7 +1109,7 @@ PHP_FUNCTION(locale_parse) grOffset = findOffset( LOC_GRANDFATHERED , loc_name ); if( grOffset >= 0 ){ - add_assoc_string( return_value , LOC_GRANDFATHERED_LANG_TAG , estrdup(loc_name) ,FALSE ); + add_assoc_string( return_value , LOC_GRANDFATHERED_LANG_TAG , loc_name); } else{ /* Not grandfathered */ @@ -1164,10 +1166,10 @@ PHP_FUNCTION(locale_get_all_variants) if( result > 0 && variant){ /* Tokenize on the "_" or "-" */ token = php_strtok_r( variant , DELIMITER , &saved_ptr); - add_next_index_stringl( return_value, token , strlen(token) ,TRUE ); + add_next_index_stringl( return_value, token , strlen(token)); /* tokenize on the "_" or "-" and stop at singleton if any */ while( (token = php_strtok_r(NULL , DELIMITER, &saved_ptr)) && (strlen(token)>1) ){ - add_next_index_stringl( return_value, token , strlen(token) ,TRUE ); + add_next_index_stringl( return_value, token , strlen(token)); } } if( variant ){ diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index dc1212431a..ca1828cd37 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -340,7 +340,7 @@ PHP_FUNCTION( resourcebundle_locales ) array_init( return_value ); while ((entry = uenum_next( icuenum, &entry_len, &icuerror ))) { - add_next_index_stringl( return_value, (char *) entry, entry_len, 1 ); + add_next_index_stringl( return_value, (char *) entry, entry_len); } uenum_close( icuenum ); } diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 374b163851..fa08af8503 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -311,7 +311,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC) if (U_FAILURE(uec)) { return Z_ARRVAL(zv); } - add_assoc_stringl_ex(&zv, "id", sizeof("id"), str, str_len, 0); + // TODO: avoid reallocation ??? + add_assoc_stringl_ex(&zv, "id", sizeof("id"), str, str_len); + efree(str); int32_t rawOffset, dstOffset; UDate now = Calendar::getNow(); diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index 1aa39c54b9..4b77508ff0 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -277,7 +277,9 @@ PHP_FUNCTION( transliterator_list_ids ) } else { - add_next_index_stringl( return_value, el_char, el_len, 0 ); + // TODO: avoid reallocation ??? + add_next_index_stringl( return_value, el_char, el_len); + efree(el_char); } } uenum_close( en ); diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index e9b9d2e97c..db400ff3a4 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -972,13 +972,13 @@ PHP_FUNCTION(ldap_get_entries) array_init(tmp2); add_assoc_long(tmp2, "count", num_values); for (i = 0; i < num_values; i++) { - add_index_stringl(tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len, 1); + add_index_stringl(tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } ldap_value_free_len(ldap_value); attr_len = strlen(attribute); zend_hash_update(Z_ARRVAL_P(tmp1), php_strtolower(attribute, attr_len), attr_len+1, (void *) &tmp2, sizeof(zval *), NULL); - add_index_string(tmp1, num_attrib, attribute, 1); + add_index_string(tmp1, num_attrib, attribute); num_attrib++; #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS @@ -994,7 +994,7 @@ PHP_FUNCTION(ldap_get_entries) add_assoc_long(tmp1, "count", num_attrib); dn = ldap_get_dn(ldap, ldap_result_entry); - add_assoc_string(tmp1, "dn", dn, 1); + add_assoc_string(tmp1, "dn", dn); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS ldap_memfree(dn); #else @@ -1111,12 +1111,12 @@ PHP_FUNCTION(ldap_get_attributes) array_init(tmp); add_assoc_long(tmp, "count", num_values); for (i = 0; i < num_values; i++) { - add_index_stringl(tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len, 1); + add_index_stringl(tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } ldap_value_free_len(ldap_value); zend_hash_update(Z_ARRVAL_P(return_value), attribute, strlen(attribute)+1, (void *) &tmp, sizeof(zval *), NULL); - add_index_string(return_value, num_attrib, attribute, 1); + add_index_string(return_value, num_attrib, attribute); num_attrib++; #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS @@ -1161,7 +1161,7 @@ PHP_FUNCTION(ldap_get_values_len) array_init(return_value); for (i=0; i<num_values; i++) { - add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len, 1); + add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len); } add_assoc_long(return_value, "count", num_values); @@ -1225,7 +1225,7 @@ PHP_FUNCTION(ldap_explode_dn) add_assoc_long(return_value, "count", count); for (i = 0; i<count; i++) { - add_index_string(return_value, i, ldap_value[i], 1); + add_index_string(return_value, i, ldap_value[i]); } ldap_value_free(ldap_value); @@ -1867,7 +1867,7 @@ PHP_FUNCTION(ldap_parse_result) if (lreferrals != NULL) { refp = lreferrals; while (*refp) { - add_next_index_string(referrals, *refp, 1); + add_next_index_string(referrals, *refp); refp++; } ldap_value_free(lreferrals); @@ -1978,7 +1978,7 @@ PHP_FUNCTION(ldap_parse_reference) if (lreferrals != NULL) { refp = lreferrals; while (*refp) { - add_next_index_string(referrals, *refp, 1); + add_next_index_string(referrals, *refp); refp++; } ldap_value_free(lreferrals); @@ -2345,9 +2345,9 @@ PHP_FUNCTION(ldap_control_paged_result) /* return a PHP control object */ array_init(return_value); - add_assoc_string(return_value, "oid", ctrl.ldctl_oid, 1); + add_assoc_string(return_value, "oid", ctrl.ldctl_oid); if (ctrl.ldctl_value.bv_len) { - add_assoc_stringl(return_value, "value", ctrl.ldctl_value.bv_val, ctrl.ldctl_value.bv_len, 1); + add_assoc_stringl(return_value, "value", ctrl.ldctl_value.bv_val, ctrl.ldctl_value.bv_len); } if (ctrl.ldctl_iscritical) { add_assoc_bool(return_value, "iscritical", ctrl.ldctl_iscritical); diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index c8eda85417..b0974b4020 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -589,7 +589,7 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL, add_assoc_null_ex(ctxzv, #memb, sizeof(#memb) - 1); \ } else { \ add_assoc_string_ex(ctxzv, #memb, sizeof(#memb - 1), \ - (char *)context->memb, 1); \ + (char *)context->memb); \ } ADD_NULL_OR_STRING_KEY(directory) @@ -982,14 +982,14 @@ static PHP_FUNCTION(libxml_get_last_error) add_property_long(return_value, "code", error->code); add_property_long(return_value, "column", error->int2); if (error->message) { - add_property_string(return_value, "message", error->message, 1); + add_property_string(return_value, "message", error->message); } else { - add_property_stringl(return_value, "message", "", 0, 1); + add_property_stringl(return_value, "message", "", 0); } if (error->file) { - add_property_string(return_value, "file", error->file, 1); + add_property_string(return_value, "file", error->file); } else { - add_property_stringl(return_value, "file", "", 0, 1); + add_property_stringl(return_value, "file", "", 0); } add_property_long(return_value, "line", error->line); } else { @@ -1021,14 +1021,14 @@ static PHP_FUNCTION(libxml_get_errors) add_property_long(&z_error, "code", error->code); add_property_long(&z_error, "column", error->int2); if (error->message) { - add_property_string(&z_error, "message", error->message, 1); + add_property_string(&z_error, "message", error->message); } else { - add_property_stringl(&z_error, "message", "", 0, 1); + add_property_stringl(&z_error, "message", "", 0); } if (error->file) { - add_property_string(&z_error, "file", error->file, 1); + add_property_string(&z_error, "file", error->file); } else { - add_property_stringl(&z_error, "file", "", 0, 1); + add_property_stringl(&z_error, "file", "", 0); } add_property_long(&z_error, "line", error->line); add_next_index_zval(return_value, &z_error); diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 340d631dc8..b7f97bb953 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1804,7 +1804,7 @@ PHP_FUNCTION(mb_http_input) size_t i; array_init(return_value); for (i = 0; i < n; i++) { - add_next_index_string(return_value, (*entry)->name, 1); + add_next_index_string(return_value, (*entry)->name); entry++; } retname = 0; @@ -1902,7 +1902,7 @@ PHP_FUNCTION(mb_detect_order) const mbfl_encoding **entry = MBSTRG(current_detect_order_list); array_init(return_value); for (i = 0; i < n; i++) { - add_next_index_string(return_value, (*entry)->name, 1); + add_next_index_string(return_value, (*entry)->name); entry++; } } else { @@ -3300,7 +3300,7 @@ PHP_FUNCTION(mb_list_encodings) i = 0; encodings = mbfl_get_supported_encodings(); while ((encoding = encodings[i++]) != NULL) { - add_next_index_string(return_value, (char *) encoding->name, 1); + add_next_index_string(return_value, (char *) encoding->name); } } /* }}} */ @@ -3327,7 +3327,7 @@ PHP_FUNCTION(mb_encoding_aliases) if (encoding->aliases != NULL) { const char **alias; for (alias = *encoding->aliases; *alias; ++alias) { - add_next_index_string(return_value, (char *)*alias, 1); + add_next_index_string(return_value, (char *)*alias); } } } @@ -4334,16 +4334,16 @@ PHP_FUNCTION(mb_get_info) if (!typ || !strcasecmp("all", typ)) { array_init(return_value); if (MBSTRG(current_internal_encoding)) { - add_assoc_string(return_value, "internal_encoding", (char *)MBSTRG(current_internal_encoding)->name, 1); + add_assoc_string(return_value, "internal_encoding", (char *)MBSTRG(current_internal_encoding)->name); } if (MBSTRG(http_input_identify)) { - add_assoc_string(return_value, "http_input", (char *)MBSTRG(http_input_identify)->name, 1); + add_assoc_string(return_value, "http_input", (char *)MBSTRG(http_input_identify)->name); } if (MBSTRG(current_http_output_encoding)) { - add_assoc_string(return_value, "http_output", (char *)MBSTRG(current_http_output_encoding)->name, 1); + add_assoc_string(return_value, "http_output", (char *)MBSTRG(current_http_output_encoding)->name); } if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { - add_assoc_string(return_value, "http_output_conv_mimetypes", name, 1); + add_assoc_string(return_value, "http_output_conv_mimetypes", name); } add_assoc_long(return_value, "func_overload", MBSTRG(func_overload)); if (MBSTRG(func_overload)){ @@ -4351,33 +4351,33 @@ PHP_FUNCTION(mb_get_info) array_init(&row1); while (over_func->type > 0) { if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func, 1); + add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func); } over_func++; } add_assoc_zval(return_value, "func_overload_list", &row1); } else { - add_assoc_string(return_value, "func_overload_list", "no overload", 1); + add_assoc_string(return_value, "func_overload_list", "no overload"); } if (lang != NULL) { if ((name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) { - add_assoc_string(return_value, "mail_charset", name, 1); + add_assoc_string(return_value, "mail_charset", name); } if ((name = (char *)mbfl_no_encoding2name(lang->mail_header_encoding)) != NULL) { - add_assoc_string(return_value, "mail_header_encoding", name, 1); + add_assoc_string(return_value, "mail_header_encoding", name); } if ((name = (char *)mbfl_no_encoding2name(lang->mail_body_encoding)) != NULL) { - add_assoc_string(return_value, "mail_body_encoding", name, 1); + add_assoc_string(return_value, "mail_body_encoding", name); } } add_assoc_long(return_value, "illegal_chars", MBSTRG(illegalchars)); if (MBSTRG(encoding_translation)) { - add_assoc_string(return_value, "encoding_translation", "On", 1); + add_assoc_string(return_value, "encoding_translation", "On"); } else { - add_assoc_string(return_value, "encoding_translation", "Off", 1); + add_assoc_string(return_value, "encoding_translation", "Off"); } if ((name = (char *)mbfl_no_language2name(MBSTRG(language))) != NULL) { - add_assoc_string(return_value, "language", name, 1); + add_assoc_string(return_value, "language", name); } n = MBSTRG(current_detect_order_list_size); entry = MBSTRG(current_detect_order_list); @@ -4385,24 +4385,24 @@ PHP_FUNCTION(mb_get_info) size_t i; array_init(&row2); for (i = 0; i < n; i++) { - add_next_index_string(&row2, (*entry)->name, 1); + add_next_index_string(&row2, (*entry)->name); entry++; } add_assoc_zval(return_value, "detect_order", &row2); } if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - add_assoc_string(return_value, "substitute_character", "none", 1); + add_assoc_string(return_value, "substitute_character", "none"); } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) { - add_assoc_string(return_value, "substitute_character", "long", 1); + add_assoc_string(return_value, "substitute_character", "long"); } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { - add_assoc_string(return_value, "substitute_character", "entity", 1); + add_assoc_string(return_value, "substitute_character", "entity"); } else { add_assoc_long(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar)); } if (MBSTRG(strict_detection)) { - add_assoc_string(return_value, "strict_detection", "On", 1); + add_assoc_string(return_value, "strict_detection", "On"); } else { - add_assoc_string(return_value, "strict_detection", "Off", 1); + add_assoc_string(return_value, "strict_detection", "Off"); } } else if (!strcasecmp("internal_encoding", typ)) { if (MBSTRG(current_internal_encoding)) { @@ -4428,7 +4428,7 @@ PHP_FUNCTION(mb_get_info) array_init(return_value); while (over_func->type > 0) { if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func, 1); + add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func); } over_func++; } @@ -4466,7 +4466,7 @@ PHP_FUNCTION(mb_get_info) size_t i; array_init(return_value); for (i = 0; i < n; i++) { - add_next_index_string(return_value, (*entry)->name, 1); + add_next_index_string(return_value, (*entry)->name); entry++; } } diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 9a82f10104..223ecffc2a 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -749,7 +749,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) beg = regs->beg[i]; end = regs->end[i]; if (beg >= 0 && beg < end && end <= string_len) { - add_index_stringl(array, i, (char *)&str[beg], end - beg, 1); + add_index_stringl(array, i, (char *)&str[beg], end - beg); } else { add_index_bool(array, i, 0); } @@ -959,7 +959,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp array_init(&subpats); for (i = 0; i < regs->num_regs; i++) { - add_next_index_stringl(&subpats, string + regs->beg[i], regs->end[i] - regs->beg[i], 1); + add_next_index_stringl(&subpats, string + regs->beg[i], regs->end[i] - regs->beg[i]); } ZVAL_COPY_VALUE(&args[0], &subpats); @@ -1092,7 +1092,7 @@ PHP_FUNCTION(mb_split) /* add it to the array */ if ((pos - (OnigUChar *)string) < end) { if (beg < string_len && beg >= (chunk_pos - (OnigUChar *)string)) { - add_next_index_stringl(return_value, (char *)chunk_pos, ((OnigUChar *)(string + beg) - chunk_pos), 1); + add_next_index_stringl(return_value, (char *)chunk_pos, ((OnigUChar *)(string + beg) - chunk_pos)); --count; } else { err = -2; @@ -1120,9 +1120,9 @@ PHP_FUNCTION(mb_split) /* otherwise we just have one last element to add to the array */ n = ((OnigUChar *)(string + string_len) - chunk_pos); if (n > 0) { - add_next_index_stringl(return_value, (char *)chunk_pos, n, 1); + add_next_index_stringl(return_value, (char *)chunk_pos, n); } else { - add_next_index_stringl(return_value, "", 0, 1); + add_next_index_stringl(return_value, "", 0); } } /* }}} */ @@ -1256,7 +1256,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) beg = MBREX(search_regs)->beg[i]; end = MBREX(search_regs)->end[i]; if (beg >= 0 && beg <= end && end <= len) { - add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1); + add_index_stringl(return_value, i, (char *)&str[beg], end - beg); } else { add_index_bool(return_value, i, 0); } @@ -1375,7 +1375,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) beg = MBREX(search_regs)->beg[i]; end = MBREX(search_regs)->end[i]; if (beg >= 0 && beg <= end && end <= len) { - add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1); + add_index_stringl(return_value, i, (char *)&str[beg], end - beg); } else { add_index_bool(return_value, i, 0); } diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 89ad83f6bf..37ba19b649 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -1004,7 +1004,7 @@ PHP_FUNCTION(mcrypt_list_algorithms) php_error_docref(NULL TSRMLS_CC, E_WARNING, "No algorithms found in module dir"); } for (i = 0; i < count; i++) { - add_index_string(return_value, i, modules[i], 1); + add_index_string(return_value, i, modules[i]); } mcrypt_free_p(modules, count); } @@ -1031,7 +1031,7 @@ PHP_FUNCTION(mcrypt_list_modes) php_error_docref(NULL TSRMLS_CC, E_WARNING, "No modes found in module dir"); } for (i = 0; i < count; i++) { - add_index_string(return_value, i, modules[i], 1); + add_index_string(return_value, i, modules[i]); } mcrypt_free_p(modules, count); } diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index eef472aa3f..340f55b421 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -1538,11 +1538,11 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) data_len = Z_STRLEN(result->data[result->cur_row][i]); if (result_type & MSSQL_NUM) { - add_index_stringl(return_value, i, data, data_len, 1); + add_index_stringl(return_value, i, data, data_len); } if (result_type & MSSQL_ASSOC) { - add_assoc_stringl(return_value, result->fields[i].name, data, data_len, 1); + add_assoc_stringl(return_value, result->fields[i].name, data, data_len); } } else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) { @@ -1718,11 +1718,11 @@ PHP_FUNCTION(mssql_fetch_field) object_init(return_value); - add_property_string(return_value, "name",result->fields[field_offset].name, 1); + add_property_string(return_value, "name",result->fields[field_offset].name); 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_string(return_value, "column_source",result->fields[field_offset].column_source); add_property_long(return_value, "numeric", result->fields[field_offset].numeric); - add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset])), 1); + add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 573c1728ac..b6d43687e0 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -2426,9 +2426,9 @@ PHP_FUNCTION(mysql_fetch_field) } object_init(return_value); - add_property_string(return_value, "name", (mysql_field->name?mysql_field->name:""), 1); - add_property_string(return_value, "table", (mysql_field->table?mysql_field->table:""), 1); - add_property_string(return_value, "def", (mysql_field->def?mysql_field->def:""), 1); + add_property_string(return_value, "name", (mysql_field->name?mysql_field->name:"")); + add_property_string(return_value, "table", (mysql_field->table?mysql_field->table:"")); + add_property_string(return_value, "def", (mysql_field->def?mysql_field->def:"")); add_property_long(return_value, "max_length", mysql_field->max_length); add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); @@ -2436,7 +2436,7 @@ PHP_FUNCTION(mysql_fetch_field) 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, "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(mysql_field->type)); 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)); } diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 9028401595..00a0b93622 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1127,18 +1127,18 @@ PHP_FUNCTION(mysqli_stmt_fetch) /* {{{ php_add_field_properties */ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRMLS_DC) { - add_property_string(value, "name",(field->name ? field->name : ""), 1); - add_property_string(value, "orgname",(field->org_name ? field->org_name : ""), 1); - add_property_string(value, "table",(field->table ? field->table : ""), 1); - add_property_string(value, "orgtable",(field->org_table ? field->org_table : ""), 1); - add_property_string(value, "def",(field->def ? field->def : ""), 1); - add_property_string(value, "db",(field->db ? field->db : ""), 1); + add_property_string(value, "name",(field->name ? field->name : "")); + add_property_string(value, "orgname",(field->org_name ? field->org_name : "")); + add_property_string(value, "table",(field->table ? field->table : "")); + add_property_string(value, "orgtable",(field->org_table ? field->org_table : "")); + add_property_string(value, "def",(field->def ? field->def : "")); + add_property_string(value, "db",(field->db ? field->db : "")); /* FIXME: manually set the catalog to "def" due to bug in * libmysqlclient which does not initialize field->catalog * and in addition, the catalog is always be "def" */ - add_property_string(value, "catalog", "def", 1); + add_property_string(value, "catalog", "def"); add_property_long(value, "max_length", field->max_length); add_property_long(value, "length", field->length); diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index db0352baeb..c9e45968b3 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -440,8 +440,8 @@ PHP_FUNCTION(mysqli_error_list) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate); + add_assoc_string_ex(single_error, "error", sizeof("error"), message->error); add_next_index_zval(return_value, single_error); } } @@ -451,8 +451,8 @@ PHP_FUNCTION(mysqli_error_list) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_errno(mysql->mysql)); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql), 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql), 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql)); + add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql)); add_next_index_zval(return_value, single_error); } #endif @@ -484,8 +484,8 @@ PHP_FUNCTION(mysqli_stmt_error_list) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate); + add_assoc_string_ex(single_error, "error", sizeof("error"), message->error); add_next_index_zval(return_value, single_error); } } @@ -495,8 +495,8 @@ PHP_FUNCTION(mysqli_stmt_error_list) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_stmt_errno(stmt->stmt)); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt), 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt), 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt)); + add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt)); add_next_index_zval(return_value, single_error); } #endif @@ -1034,14 +1034,14 @@ PHP_FUNCTION(mysqli_get_charset) #endif object_init(return_value); - add_property_string(return_value, "charset", (name) ? (char *)name : "", 1); - add_property_string(return_value, "collation",(collation) ? (char *)collation : "", 1); - add_property_string(return_value, "dir", (dir) ? (char *)dir : "", 1); + add_property_string(return_value, "charset", (name) ? (char *)name : ""); + add_property_string(return_value, "collation",(collation) ? (char *)collation : ""); + add_property_string(return_value, "dir", (dir) ? (char *)dir : ""); add_property_long(return_value, "min_length", minlength); add_property_long(return_value, "max_length", maxlength); add_property_long(return_value, "number", number); add_property_long(return_value, "state", state); - add_property_string(return_value, "comment", (comment) ? (char *)comment : "", 1); + add_property_string(return_value, "comment", (comment) ? (char *)comment : ""); } /* }}} */ #endif diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index 7060367394..d11643d215 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -216,8 +216,8 @@ static int link_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate); + add_assoc_string_ex(single_error, "error", sizeof("error"), message->error); add_next_index_zval(*retval, single_error); } } @@ -227,8 +227,8 @@ static int link_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_errno(mysql->mysql)); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql), 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql), 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_sqlstate(mysql->mysql)); + add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_error(mysql->mysql)); add_next_index_zval(*retval, single_error); } #endif @@ -413,8 +413,8 @@ static int stmt_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), message->error_no); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate, 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), message->error, 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), message->sqlstate); + add_assoc_string_ex(single_error, "error", sizeof("error"), message->error); add_next_index_zval(*retval, single_error); } } @@ -424,8 +424,8 @@ static int stmt_error_list_read(mysqli_object *obj, zval **retval TSRMLS_DC) MAKE_STD_ZVAL(single_error); array_init(single_error); add_assoc_long_ex(single_error, "errno", sizeof("errno"), mysql_stmt_errno(stmt->stmt)); - add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt), 1); - add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt), 1); + add_assoc_string_ex(single_error, "sqlstate", sizeof("sqlstate"), mysql_stmt_sqlstate(stmt->stmt)); + add_assoc_string_ex(single_error, "error", sizeof("error"), mysql_stmt_error(stmt->stmt)); add_next_index_zval(*retval, single_error); } #endif diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c index ce193275ec..c6387e4e8a 100644 --- a/ext/mysqlnd/mysqlnd_statistics.c +++ b/ext/mysqlnd/mysqlnd_statistics.c @@ -206,7 +206,7 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING char tmp[25]; sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]); - add_assoc_string_ex(return_value, names[i].s, names[i].l + 1, tmp, 1); + add_assoc_string_ex(return_value, names[i].s, names[i].l + 1, tmp); } } /* }}} */ diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index d6a62325f3..06e9def575 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1660,9 +1660,11 @@ go_out: if (errcode) { array_init(return_value); add_assoc_long(return_value, "code", errcode); - add_assoc_string(return_value, "message", (char*) errbuf, 0); + // TODO: avoid reallocation ??? + add_assoc_string(return_value, "message", (char*) errbuf); + efree(errbuf); add_assoc_long(return_value, "offset", error_offset); - add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "", 1); + add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : ""); } else { RETURN_FALSE; } diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 56882cf908..f8349cdc99 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -1048,7 +1048,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) add_next_index_null(bind->zval); } else { connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ - add_next_index_stringl(bind->zval, (char *)buff, buff_len, 1); + add_next_index_stringl(bind->zval, (char *)buff, buff_len); } } } @@ -1068,7 +1068,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) ZVAL_STRINGL(*entry, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1); zend_hash_move_forward(hash); } else { - add_next_index_stringl(bind->zval, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1); + add_next_index_stringl(bind->zval, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length); } } break; diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 4d21b3a136..bc3f4c9520 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1553,8 +1553,8 @@ PHP_FUNCTION(odbc_data_source) array_init(return_value); - add_assoc_string_ex(return_value, "server", sizeof("server"), server_name, 1); - add_assoc_string_ex(return_value, "description", sizeof("description"), desc, 1); + add_assoc_string_ex(return_value, "server", sizeof("server"), server_name); + add_assoc_string_ex(return_value, "description", sizeof("description"), desc); } /* }}} */ diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index a0ccfb3a3a..78d95023b5 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -517,7 +517,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) str = asctime(ta); len = strlen(str); if (len > 0 && str[len - 1] == '\n') len--; - add_assoc_stringl(&persistent_script_report, "last_used", str, len, 1); + add_assoc_stringl(&persistent_script_report, "last_used", str, len); add_assoc_long(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); if (ZCG(accel_directives).validate_timestamps) { add_assoc_long(&persistent_script_report, "timestamp", (long)script->timestamp); @@ -597,7 +597,7 @@ static ZEND_FUNCTION(opcache_get_status) static int add_blacklist_path(zend_blacklist_entry *p, zval *return_value TSRMLS_DC) { - add_next_index_stringl(return_value, p->path, p->path_length, 1); + add_next_index_stringl(return_value, p->path, p->path_length); return 0; } @@ -639,10 +639,10 @@ static ZEND_FUNCTION(opcache_get_configuration) add_assoc_long(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks); add_assoc_long(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout); add_assoc_long(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq); - add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model), 1); - add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename), 1); + add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model)); + add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename)); add_assoc_long(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size); - add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log), 1); + add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log)); add_assoc_bool(&directives, "opcache.protect_memory", ZCG(accel_directives).protect_memory); add_assoc_bool(&directives, "opcache.save_comments", ZCG(accel_directives).save_comments); @@ -655,8 +655,8 @@ static ZEND_FUNCTION(opcache_get_configuration) /*version */ array_init(&version); - add_assoc_string(&version, "version", ACCELERATOR_VERSION, 1); - add_assoc_string(&version, "opcache_product_name", ACCELERATOR_PRODUCT_NAME, 1); + add_assoc_string(&version, "version", ACCELERATOR_VERSION); + add_assoc_string(&version, "opcache_product_name", ACCELERATOR_PRODUCT_NAME); add_assoc_zval(return_value, "version", &version); /* blacklist */ diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index fd4b22076a..b65f2d9736 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -648,16 +648,16 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s if (zend_hash_find(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, (void**)&data) == SUCCESS) { if (Z_TYPE_PP(data) == IS_ARRAY) { subentries = *data; - add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1); + add_next_index_stringl(subentries, (char *)to_add, to_add_len); } else if (Z_TYPE_PP(data) == IS_STRING) { MAKE_STD_ZVAL(subentries); array_init(subentries); - add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1); - add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1); + add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data)); + add_next_index_stringl(subentries, (char *)to_add, to_add_len); zend_hash_update(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, &subentries, sizeof(zval*), NULL); } } else { - add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len, 1); + add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len); } } } @@ -669,7 +669,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str) /* {{{ */ { - add_assoc_stringl(val, key, (char *)str->data, str->length, 1); + add_assoc_stringl(val, key, (char *)str->data, str->length); } /* }}} */ @@ -1932,7 +1932,7 @@ PHP_FUNCTION(openssl_x509_parse) array_init(return_value); if (cert->name) { - add_assoc_string(return_value, "name", cert->name, 1); + add_assoc_string(return_value, "name", cert->name); } /* add_assoc_bool(return_value, "valid", cert->valid); */ @@ -1941,13 +1941,13 @@ PHP_FUNCTION(openssl_x509_parse) { char buf[32]; snprintf(buf, sizeof(buf), "%08lx", X509_subject_name_hash(cert)); - add_assoc_string(return_value, "hash", buf, 1); + add_assoc_string(return_value, "hash", buf); } add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames TSRMLS_CC); add_assoc_long(return_value, "version", X509_get_version(cert)); - add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)), 1); + add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert))); add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert)); add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert)); @@ -1957,12 +1957,12 @@ PHP_FUNCTION(openssl_x509_parse) tmpstr = (char *)X509_alias_get0(cert, NULL); if (tmpstr) { - add_assoc_string(return_value, "alias", tmpstr, 1); + add_assoc_string(return_value, "alias", tmpstr); } /* add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert)); - add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert)), 1); - add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert)), 1); + add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert))); + add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert))); */ MAKE_STD_ZVAL(subitem); array_init(subitem); @@ -1988,7 +1988,7 @@ PHP_FUNCTION(openssl_x509_parse) add_index_bool(subsub, 1, purpset); pname = useshortnames ? X509_PURPOSE_get0_sname(purp) : X509_PURPOSE_get0_name(purp); - add_index_string(subsub, 2, pname, 1); + add_index_string(subsub, 2, pname); /* NOTE: if purpset > 1 then it's a warning - we should mention it ? */ @@ -2014,7 +2014,7 @@ PHP_FUNCTION(openssl_x509_parse) if (nid == NID_subject_alt_name) { if (openssl_x509v3_subjectAltName(bio_out, extension) == 0) { BIO_get_mem_ptr(bio_out, &bio_buf); - add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1); + add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length); } else { zval_dtor(return_value); if (certresource == -1 && cert) { @@ -2026,7 +2026,7 @@ PHP_FUNCTION(openssl_x509_parse) } else if (X509V3_EXT_print(bio_out, extension, 0, 0)) { BIO_get_mem_ptr(bio_out, &bio_buf); - add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1); + add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length); } else { add_assoc_asn1_string(subitem, extname, X509_EXTENSION_get_data(extension)); } @@ -3468,7 +3468,9 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC) char *str = emalloc(len + 1); \ BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)str); \ str[len] = 0; \ - add_assoc_stringl(_type, #_name, str, len, 0); \ + /* TODO: avoid reallocation ??? */ \ + add_assoc_stringl(_type, #_name, str, len); \ + efree(str); \ } \ } while (0) @@ -3792,7 +3794,7 @@ PHP_FUNCTION(openssl_pkey_get_details) array_init(return_value); add_assoc_long(return_value, "bits", EVP_PKEY_bits(pkey)); - add_assoc_stringl(return_value, "key", pbio, pbio_len, 1); + add_assoc_stringl(return_value, "key", pbio, pbio_len); /*TODO: Use the real values once the openssl constants are used * See the enum at the top of this file */ @@ -4828,7 +4830,8 @@ PHP_FUNCTION(openssl_seal) array_init(ekeys); for (i=0; i<nkeys; i++) { eks[i][eksl[i]] = '\0'; - add_next_index_stringl(ekeys, erealloc(eks[i], eksl[i] + 1), eksl[i], 0); + add_next_index_stringl(ekeys, eks[i], eksl[i]); + efree(eks[i]); eks[i] = NULL; } #if 0 @@ -5243,14 +5246,14 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ static void openssl_add_method_or_alias(const OBJ_NAME *name, void *arg) /* {{{ */ { - add_next_index_string((zval*)arg, (char*)name->name, 1); + add_next_index_string((zval*)arg, (char*)name->name); } /* }}} */ static void openssl_add_method(const OBJ_NAME *name, void *arg) /* {{{ */ { if (name->alias == 0) { - add_next_index_string((zval*)arg, (char*)name->name, 1); + add_next_index_string((zval*)arg, (char*)name->name); } } /* }}} */ diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 2c228f0230..bd76b556af 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -507,7 +507,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset, array_init(&match_pair); /* Add (match, offset) to the return value */ - add_next_index_stringl(&match_pair, str, len, 1); + add_next_index_stringl(&match_pair, str, len); add_next_index_long(&match_pair, offset); if (name) { @@ -540,7 +540,7 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * } if (subpats) { - ZVAL_DEREF_REF(subpats); + ZVAL_DEREF(subpats); } php_pcre_match_impl(pce, subject, subject_len, return_value, subpats, global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC); @@ -682,7 +682,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1], NULL); } else { add_next_index_stringl(&match_sets[i], (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + offsets[(i<<1)+1] - offsets[i<<1]); } } /* @@ -692,7 +692,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec */ if (count < num_subpats) { for (; i < num_subpats; i++) { - add_next_index_string(&match_sets[i], "", 1); + add_next_index_string(&match_sets[i], ""); } } } else { @@ -707,10 +707,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec } else { if (subpat_names[i]) { add_assoc_stringl(&result_set, subpat_names[i], (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + offsets[(i<<1)+1] - offsets[i<<1]); } add_next_index_stringl(&result_set, (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + offsets[(i<<1)+1] - offsets[i<<1]); } } /* And add it to the output array */ @@ -726,10 +726,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec } else { if (subpat_names[i]) { add_assoc_stringl(subpats, subpat_names[i], (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + offsets[(i<<1)+1] - offsets[i<<1]); } add_next_index_stringl(subpats, (char *)stringlist[i], - offsets[(i<<1)+1] - offsets[i<<1], 1); + offsets[(i<<1)+1] - offsets[i<<1]); } } } @@ -853,9 +853,9 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char * array_init(&args[0]); for (i = 0; i < count; i++) { if (subpat_names[i]) { - add_assoc_stringl(&args[0], subpat_names[i], &subject[offsets[i<<1]] , offsets[(i<<1)+1] - offsets[i<<1], 1); + add_assoc_stringl(&args[0], subpat_names[i], &subject[offsets[i<<1]] , offsets[(i<<1)+1] - offsets[i<<1]); } - add_next_index_stringl(&args[0], &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1); + add_next_index_stringl(&args[0], &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1]); } if (call_user_function_ex(EG(function_table), NULL, function, &retval, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { @@ -1403,7 +1403,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl } } if (ZEND_NUM_ARGS() > 4) { - ZVAL_DEREF_REF(zcount); + ZVAL_DEREF(zcount); zval_dtor(zcount); ZVAL_LONG(zcount, replace_count); } @@ -1541,7 +1541,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec } else { /* Add the piece to the return value */ add_next_index_stringl(return_value, last_match, - &subject[offsets[0]]-last_match, 1); + &subject[offsets[0]]-last_match); } /* One less left to do */ @@ -1563,7 +1563,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec } else { add_next_index_stringl(return_value, &subject[offsets[i<<1]], - match_len, 1); + match_len); } } } @@ -1622,7 +1622,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec add_offset_pair(return_value, &subject[start_offset], subject_len - start_offset, start_offset, NULL); } else { /* Add the last piece to the return value */ - add_next_index_stringl(return_value, last_match, subject + subject_len - last_match, 1); + add_next_index_stringl(return_value, last_match, subject + subject_len - last_match); } } diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index 85ce2a91d2..77c2e1823e 100644 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -111,7 +111,7 @@ PHP_FUNCTION(pdo_drivers) zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos); while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash, (void**)&pdriver, &pos)) { - add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len, 1); + add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len); zend_hash_move_forward_ex(&pdo_driver_hash, &pos); } } diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 2b3e639f33..1eb0e8af3c 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -86,7 +86,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate MAKE_STD_ZVAL(info); array_init(info); - add_next_index_string(info, *pdo_err, 1); + add_next_index_string(info, *pdo_err); add_next_index_long(info, 0); zend_update_property(pdo_ex, ex, "errorInfo", sizeof("errorInfo")-1, info TSRMLS_CC); @@ -128,7 +128,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ MAKE_STD_ZVAL(info); array_init(info); - add_next_index_string(info, *pdo_err, 1); + add_next_index_string(info, *pdo_err); if (dbh->methods->fetch_err(dbh, stmt, info TSRMLS_CC)) { zval **item; @@ -919,7 +919,7 @@ static PHP_METHOD(PDO, getAttribute) case PDO_ATTR_STATEMENT_CLASS: array_init(return_value); - add_next_index_string(return_value, dbh->def_stmt_ce->name, 1); + add_next_index_string(return_value, dbh->def_stmt_ce->name); if (dbh->def_stmt_ctor_args) { Z_ADDREF_P(dbh->def_stmt_ctor_args); add_next_index_zval(return_value, dbh->def_stmt_ctor_args); @@ -1055,9 +1055,9 @@ static PHP_METHOD(PDO, errorInfo) array_init(return_value); if (dbh->query_stmt) { - add_next_index_string(return_value, dbh->query_stmt->error_code, 1); + add_next_index_string(return_value, dbh->query_stmt->error_code); } else { - add_next_index_string(return_value, dbh->error_code, 1); + add_next_index_string(return_value, dbh->error_code); } if (dbh->methods->fetch_err) { @@ -1220,7 +1220,7 @@ static PHP_METHOD(PDO, getAvailableDrivers) zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos); while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash, (void**)&pdriver, &pos)) { - add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len, 1); + add_next_index_stringl(return_value, (char*)(*pdriver)->driver_name, (*pdriver)->driver_name_len); zend_hash_move_forward_ex(&pdo_driver_hash, &pos); } } diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 12bd35ce7d..cf1f4c5a81 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1718,7 +1718,7 @@ static PHP_METHOD(PDOStatement, errorInfo) } array_init(return_value); - add_next_index_string(return_value, stmt->error_code, 1); + add_next_index_string(return_value, stmt->error_code); if (stmt->dbh->methods->fetch_err) { stmt->dbh->methods->fetch_err(stmt->dbh, stmt, return_value TSRMLS_CC); @@ -1861,7 +1861,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta) /* add stock items */ col = &stmt->columns[colno]; - add_assoc_string(return_value, "name", col->name, 1); + add_assoc_string(return_value, "name", col->name); add_assoc_long(return_value, "len", col->maxlen); /* FIXME: unsigned ? */ add_assoc_long(return_value, "precision", col->precision); if (col->param_type != PDO_PARAM_ZVAL) { diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 0fa68900b0..350a3c670d 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -61,11 +61,13 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS msg, einfo->dberr, einfo->severity, stmt ? stmt->active_query_string : ""); add_next_index_long(info, einfo->dberr); - add_next_index_string(info, message, 0); + // TODO: avoid reallocation ??? + add_next_index_string(info, message); + efree(message); add_next_index_long(info, einfo->oserr); add_next_index_long(info, einfo->severity); if (einfo->oserrstr) { - add_next_index_string(info, einfo->oserrstr, 1); + add_next_index_string(info, einfo->oserrstr); } return 1; diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index 18e9e679cc..c13d58bd57 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -306,8 +306,8 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *re add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) ); add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision ); add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale ); - add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1), 1); - add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1)), 1); + add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1)); + add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1))); add_assoc_long(return_value, "native_type_id", dbcoltype(H->link, colno+1)); add_assoc_long(return_value, "native_usertype_id", dbcolutype(H->link, colno+1)); diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index aa5e795594..b78afdd28b 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -618,10 +618,10 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval i += l; strcpy(&buf[i++], " "); } - add_next_index_string(info, buf, 1); + add_next_index_string(info, buf); } else if (H->last_app_error) { add_next_index_long(info, -999); - add_next_index_string(info, const_cast(H->last_app_error),1); + add_next_index_string(info, const_cast(H->last_app_error)); } return 1; } diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 825fe2647f..ee0155ac95 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -130,7 +130,7 @@ static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in if (einfo->errcode) { add_next_index_long(info, einfo->errcode); - add_next_index_string(info, einfo->errmsg, 1); + add_next_index_string(info, einfo->errmsg); } PDO_DBG_RETURN(1); diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 95501c22c7..1830a46c13 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -827,26 +827,26 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_va F = S->fields + colno; if (F->def) { - add_assoc_string(return_value, "mysql:def", F->def, 1); + add_assoc_string(return_value, "mysql:def", F->def); } if (IS_NOT_NULL(F->flags)) { - add_next_index_string(flags, "not_null", 1); + add_next_index_string(flags, "not_null"); } if (IS_PRI_KEY(F->flags)) { - add_next_index_string(flags, "primary_key", 1); + add_next_index_string(flags, "primary_key"); } if (F->flags & MULTIPLE_KEY_FLAG) { - add_next_index_string(flags, "multiple_key", 1); + add_next_index_string(flags, "multiple_key"); } if (F->flags & UNIQUE_KEY_FLAG) { - add_next_index_string(flags, "unique_key", 1); + add_next_index_string(flags, "unique_key"); } if (IS_BLOB(F->flags)) { - add_next_index_string(flags, "blob", 1); + add_next_index_string(flags, "blob"); } str = type_to_name_native(F->type); if (str) { - add_assoc_string(return_value, "native_type", str, 1); + add_assoc_string(return_value, "native_type", str); } #ifdef PDO_USE_MYSQLND @@ -869,7 +869,7 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_va #endif add_assoc_zval(return_value, "flags", flags); - add_assoc_string(return_value, "table", (char *) (F->table?F->table:""), 1); + add_assoc_string(return_value, "table", (char *) (F->table?F->table:"")); PDO_DBG_RETURN(SUCCESS); } /* }}} */ diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 8f56c674d1..a8e7913fa7 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -50,7 +50,7 @@ static int pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info if (einfo->errcode) { add_next_index_long(info, einfo->errcode); - add_next_index_string(info, einfo->errmsg, 1); + add_next_index_string(info, einfo->errmsg); } return 1; diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 339db5698a..d4bf234689 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -49,8 +49,10 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf einfo->file, einfo->line); add_next_index_long(info, einfo->last_error); - add_next_index_string(info, message, 0); - add_next_index_string(info, einfo->last_state, 1); + // TODO: avoid reallocation ??? + add_next_index_string(info, message); + efree(message); + add_next_index_string(info, einfo->last_state); return 1; } diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 9b083f6545..ebdaaed3f1 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -114,7 +114,7 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in if (einfo->errcode) { add_next_index_long(info, einfo->errcode); - add_next_index_string(info, einfo->errmsg, 1); + add_next_index_string(info, einfo->errmsg); } return 1; @@ -874,7 +874,7 @@ static PHP_METHOD(PDO, pgsqlCopyToArray) if (ret == -1) { break; /* copy done */ } else if (ret > 0) { - add_next_index_stringl(return_value, csv, ret, 1); + add_next_index_stringl(return_value, csv, ret); PQfreemem(csv); } else { pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); @@ -1061,11 +1061,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify) array_init(return_value); if (result_type == PDO_FETCH_NUM || result_type == PDO_FETCH_BOTH) { - add_index_string(return_value, 0, pgsql_notify->relname, 1); + add_index_string(return_value, 0, pgsql_notify->relname); add_index_long(return_value, 1, pgsql_notify->be_pid); } if (result_type == PDO_FETCH_ASSOC || result_type == PDO_FETCH_BOTH) { - add_assoc_string(return_value, "message", pgsql_notify->relname, 1); + add_assoc_string(return_value, "message", pgsql_notify->relname); add_assoc_long(return_value, "pid", pgsql_notify->be_pid); } diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index ea5a67633e..904bce6c67 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -605,7 +605,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return goto done; } - add_assoc_string(return_value, "native_type", PQgetvalue(res, 0, 0), 1); + add_assoc_string(return_value, "native_type", PQgetvalue(res, 0, 0)); done: PQclear(res); return 1; diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 35fa547f27..bff259e848 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -93,7 +93,7 @@ static int pdo_sqlite_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *i if (einfo->errcode) { add_next_index_long(info, einfo->errcode); - add_next_index_string(info, einfo->errmsg, 1); + add_next_index_string(info, einfo->errmsg); } return 1; diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index ba49f7324c..e3ffa3eb0e 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -296,33 +296,33 @@ static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_v switch (sqlite3_column_type(S->stmt, colno)) { case SQLITE_NULL: - add_assoc_string(return_value, "native_type", "null", 1); + add_assoc_string(return_value, "native_type", "null"); break; case SQLITE_FLOAT: - add_assoc_string(return_value, "native_type", "double", 1); + add_assoc_string(return_value, "native_type", "double"); break; case SQLITE_BLOB: - add_next_index_string(flags, "blob", 1); + add_next_index_string(flags, "blob"); case SQLITE_TEXT: - add_assoc_string(return_value, "native_type", "string", 1); + add_assoc_string(return_value, "native_type", "string"); break; case SQLITE_INTEGER: - add_assoc_string(return_value, "native_type", "integer", 1); + add_assoc_string(return_value, "native_type", "integer"); break; } str = sqlite3_column_decltype(S->stmt, colno); if (str) { - add_assoc_string(return_value, "sqlite:decl_type", (char *)str, 1); + add_assoc_string(return_value, "sqlite:decl_type", (char *)str); } #ifdef SQLITE_ENABLE_COLUMN_METADATA str = sqlite3_column_table_name(S->stmt, colno); if (str) { - add_assoc_string(return_value, "table", (char *)str, 1); + add_assoc_string(return_value, "table", (char *)str); } #endif diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 20b281e6c7..8ca1238777 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1509,34 +1509,34 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type break; case PHP_PG_VERSION: array_init(return_value); - add_assoc_string(return_value, "client", PG_VERSION, 1); + add_assoc_string(return_value, "client", PG_VERSION); #if HAVE_PQPROTOCOLVERSION add_assoc_long(return_value, "protocol", PQprotocolVersion(pgsql)); #if HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3) { /* 8.0 or grater supports protorol version 3 */ char *tmp; - add_assoc_string(return_value, "server", (char*)PQparameterStatus(pgsql, "server_version"), 1); + add_assoc_string(return_value, "server", (char*)PQparameterStatus(pgsql, "server_version")); tmp = (char*)PQparameterStatus(pgsql, "server_encoding"); - add_assoc_string(return_value, "server_encoding", tmp, 1); + add_assoc_string(return_value, "server_encoding", tmp); tmp = (char*)PQparameterStatus(pgsql, "client_encoding"); - add_assoc_string(return_value, "client_encoding", tmp, 1); + add_assoc_string(return_value, "client_encoding", tmp); tmp = (char*)PQparameterStatus(pgsql, "is_superuser"); - add_assoc_string(return_value, "is_superuser", tmp, 1); + add_assoc_string(return_value, "is_superuser", tmp); tmp = (char*)PQparameterStatus(pgsql, "session_authorization"); - add_assoc_string(return_value, "session_authorization", tmp, 1); + add_assoc_string(return_value, "session_authorization", tmp); tmp = (char*)PQparameterStatus(pgsql, "DateStyle"); - add_assoc_string(return_value, "DateStyle", tmp, 1); + add_assoc_string(return_value, "DateStyle", tmp); tmp = (char*)PQparameterStatus(pgsql, "IntervalStyle"); - add_assoc_string(return_value, "IntervalStyle", tmp ? tmp : "", 1); + add_assoc_string(return_value, "IntervalStyle", tmp ? tmp : ""); tmp = (char*)PQparameterStatus(pgsql, "TimeZone"); - add_assoc_string(return_value, "TimeZone", tmp ? tmp : "", 1); + add_assoc_string(return_value, "TimeZone", tmp ? tmp : ""); tmp = (char*)PQparameterStatus(pgsql, "integer_datetimes"); - add_assoc_string(return_value, "integer_datetimes", tmp ? tmp : "", 1); + add_assoc_string(return_value, "integer_datetimes", tmp ? tmp : ""); tmp = (char*)PQparameterStatus(pgsql, "standard_conforming_strings"); - add_assoc_string(return_value, "standard_conforming_strings", tmp ? tmp : "", 1); + add_assoc_string(return_value, "standard_conforming_strings", tmp ? tmp : ""); tmp = (char*)PQparameterStatus(pgsql, "application_name"); - add_assoc_string(return_value, "application_name", tmp ? tmp : "", 1); + add_assoc_string(return_value, "application_name", tmp ? tmp : ""); } #endif #endif @@ -2628,22 +2628,15 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, } else { char *element = PQgetvalue(pgsql_result, pgsql_row, i); if (element) { - char *data; - int data_len; - int should_copy=0; const uint element_len = strlen(element); - data = safe_estrndup(element, element_len); - data_len = element_len; - if (result_type & PGSQL_NUM) { - add_index_stringl(return_value, i, data, data_len, should_copy); - should_copy=1; + add_index_stringl(return_value, i, element, element_len); } if (result_type & PGSQL_ASSOC) { field_name = PQfname(pgsql_result, i); - add_assoc_stringl(return_value, field_name, data, data_len, should_copy); + add_assoc_stringl(return_value, field_name, element, element_len); } } } @@ -2812,7 +2805,7 @@ PHP_FUNCTION(pg_fetch_all_columns) if (PQgetisnull(pgsql_result, pg_row, colno)) { add_next_index_null(return_value); } else { - add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, colno), 1); + add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, colno)); } } } @@ -3975,7 +3968,7 @@ PHP_FUNCTION(pg_copy_to) RETURN_FALSE; break; default: - add_next_index_string(return_value, csv, 1); + add_next_index_string(return_value, csv); PQfreemem(csv); break; } @@ -4008,7 +4001,7 @@ PHP_FUNCTION(pg_copy_to) case EOF: copydone = 1; case 0: - add_next_index_string(return_value, csv, 1); + add_next_index_string(return_value, csv); efree(csv); csv = (char *)NULL; break; @@ -5128,7 +5121,7 @@ PHP_FUNCTION(pg_get_notify) } array_init(return_value); if (result_type & PGSQL_NUM) { - add_index_string(return_value, 0, pgsql_notify->relname, 1); + add_index_string(return_value, 0, pgsql_notify->relname); add_index_long(return_value, 1, pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { @@ -5136,12 +5129,12 @@ PHP_FUNCTION(pg_get_notify) if (atof(PG_VERSION) >= 9.0) { #endif #if HAVE_PQPARAMETERSTATUS - add_index_string(return_value, 2, pgsql_notify->extra, 1); + add_index_string(return_value, 2, pgsql_notify->extra); #endif } } if (result_type & PGSQL_ASSOC) { - add_assoc_string(return_value, "message", pgsql_notify->relname, 1); + add_assoc_string(return_value, "message", pgsql_notify->relname); add_assoc_long(return_value, "pid", pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { @@ -5149,7 +5142,7 @@ PHP_FUNCTION(pg_get_notify) if (atof(PG_VERSION) >= 9.0) { #endif #if HAVE_PQPARAMETERSTATUS - add_assoc_string(return_value, "payload", pgsql_notify->extra, 1); + add_assoc_string(return_value, "payload", pgsql_notify->extra); #endif } } @@ -5248,7 +5241,7 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z MAKE_STD_ZVAL(elem); array_init(elem); add_assoc_long(elem, "num", atoi(PQgetvalue(pg_result,i,1))); - add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2), 1); + add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2)); add_assoc_long(elem, "len", atoi(PQgetvalue(pg_result,i,3))); if (!strcmp(PQgetvalue(pg_result,i,4), "t")) { add_assoc_bool(elem, "not null", 1); @@ -6664,15 +6657,10 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS } else { char *element = PQgetvalue(pg_result, pg_row, i); if (element) { - char *data; - size_t data_len; const size_t element_len = strlen(element); - data = safe_estrndup(element, element_len); - data_len = element_len; - field_name = PQfname(pg_result, i); - add_assoc_stringl(row, field_name, data, data_len, 0); + add_assoc_stringl(row, field_name, element, element_len); } } } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 9af857bf93..ccacf806d1 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1278,17 +1278,17 @@ PHP_METHOD(Phar, getSupportedSignatures) array_init(return_value); - add_next_index_stringl(return_value, "MD5", 3, 1); - add_next_index_stringl(return_value, "SHA-1", 5, 1); + add_next_index_stringl(return_value, "MD5", 3); + add_next_index_stringl(return_value, "SHA-1", 5); #ifdef PHAR_HASH_OK - add_next_index_stringl(return_value, "SHA-256", 7, 1); - add_next_index_stringl(return_value, "SHA-512", 7, 1); + add_next_index_stringl(return_value, "SHA-256", 7); + add_next_index_stringl(return_value, "SHA-512", 7); #endif #if PHAR_HAVE_OPENSSL - add_next_index_stringl(return_value, "OpenSSL", 7, 1); + add_next_index_stringl(return_value, "OpenSSL", 7); #else if (zend_hash_exists(&module_registry, "openssl", sizeof("openssl"))) { - add_next_index_stringl(return_value, "OpenSSL", 7, 1); + add_next_index_stringl(return_value, "OpenSSL", 7); } #endif } @@ -1307,11 +1307,11 @@ PHP_METHOD(Phar, getSupportedCompression) phar_request_initialize(TSRMLS_C); if (PHAR_G(has_zlib)) { - add_next_index_stringl(return_value, "GZ", 2, 1); + add_next_index_stringl(return_value, "GZ", 2); } if (PHAR_G(has_bz2)) { - add_next_index_stringl(return_value, "BZIP2", 5, 1); + add_next_index_stringl(return_value, "BZIP2", 5); } } /* }}} */ @@ -1716,7 +1716,9 @@ after_open_fp: php_stream_close(fp); } - add_assoc_string(p_obj->ret, str_key, opened, 0); + // TODO: avoid reallocation ??? + add_assoc_string(p_obj->ret, str_key, opened); + efree(opened); if (save) { efree(save); @@ -3085,26 +3087,28 @@ PHP_METHOD(Phar, getSignature) int unknown_len; array_init(return_value); - add_assoc_stringl(return_value, "hash", phar_obj->arc.archive->signature, phar_obj->arc.archive->sig_len, 1); + add_assoc_stringl(return_value, "hash", phar_obj->arc.archive->signature, phar_obj->arc.archive->sig_len); switch(phar_obj->arc.archive->sig_flags) { case PHAR_SIG_MD5: - add_assoc_stringl(return_value, "hash_type", "MD5", 3, 1); + add_assoc_stringl(return_value, "hash_type", "MD5", 3); break; case PHAR_SIG_SHA1: - add_assoc_stringl(return_value, "hash_type", "SHA-1", 5, 1); + add_assoc_stringl(return_value, "hash_type", "SHA-1", 5); break; case PHAR_SIG_SHA256: - add_assoc_stringl(return_value, "hash_type", "SHA-256", 7, 1); + add_assoc_stringl(return_value, "hash_type", "SHA-256", 7); break; case PHAR_SIG_SHA512: - add_assoc_stringl(return_value, "hash_type", "SHA-512", 7, 1); + add_assoc_stringl(return_value, "hash_type", "SHA-512", 7); break; case PHAR_SIG_OPENSSL: - add_assoc_stringl(return_value, "hash_type", "OpenSSL", 7, 1); + add_assoc_stringl(return_value, "hash_type", "OpenSSL", 7); break; default: unknown_len = spprintf(&unknown, 0, "Unknown (%u)", phar_obj->arc.archive->sig_flags); - add_assoc_stringl(return_value, "hash_type", unknown, unknown_len, 0); + // TODO: avoid reallocation ??? + add_assoc_stringl(return_value, "hash_type", unknown, unknown_len); + efree(unknown); break; } } else { diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 1dfa9997ed..64ef62742e 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -626,14 +626,14 @@ PHP_FUNCTION(posix_uname) array_init(return_value); - add_assoc_string(return_value, "sysname", u.sysname, 1); - add_assoc_string(return_value, "nodename", u.nodename, 1); - add_assoc_string(return_value, "release", u.release, 1); - add_assoc_string(return_value, "version", u.version, 1); - add_assoc_string(return_value, "machine", u.machine, 1); + add_assoc_string(return_value, "sysname", u.sysname); + add_assoc_string(return_value, "nodename", u.nodename); + add_assoc_string(return_value, "release", u.release); + add_assoc_string(return_value, "version", u.version); + add_assoc_string(return_value, "machine", u.machine); #if defined(_GNU_SOURCE) && !defined(DARWIN) && defined(HAVE_UTSNAME_DOMAINNAME) - add_assoc_string(return_value, "domainname", u.domainname, 1); + add_assoc_string(return_value, "domainname", u.domainname); #endif } /* }}} */ @@ -925,10 +925,10 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ MAKE_STD_ZVAL(array_members); array_init(array_members); - add_assoc_string(array_group, "name", g->gr_name, 1); - add_assoc_string(array_group, "passwd", g->gr_passwd, 1); + add_assoc_string(array_group, "name", g->gr_name); + add_assoc_string(array_group, "passwd", g->gr_passwd); for (count=0; g->gr_mem[count] != NULL; count++) { - add_next_index_string(array_members, g->gr_mem[count], 1); + add_next_index_string(array_members, g->gr_mem[count]); } zend_hash_update(Z_ARRVAL_P(array_group), "members", sizeof("members"), (void*)&array_members, sizeof(zval*), NULL); add_assoc_long(array_group, "gid", g->gr_gid); @@ -1094,13 +1094,13 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */ if (NULL == return_value || Z_TYPE_P(return_value) != IS_ARRAY) return 0; - add_assoc_string(return_value, "name", pw->pw_name, 1); - add_assoc_string(return_value, "passwd", pw->pw_passwd, 1); + add_assoc_string(return_value, "name", pw->pw_name); + add_assoc_string(return_value, "passwd", pw->pw_passwd); add_assoc_long (return_value, "uid", pw->pw_uid); add_assoc_long (return_value, "gid", pw->pw_gid); - add_assoc_string(return_value, "gecos", pw->pw_gecos, 1); - add_assoc_string(return_value, "dir", pw->pw_dir, 1); - add_assoc_string(return_value, "shell", pw->pw_shell, 1); + add_assoc_string(return_value, "gecos", pw->pw_gecos); + add_assoc_string(return_value, "dir", pw->pw_dir); + add_assoc_string(return_value, "shell", pw->pw_shell); return 1; } /* }}} */ @@ -1227,13 +1227,13 @@ static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC) { } if (rl.rlim_cur == RLIM_INFINITY) { - add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1); + add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { add_assoc_long(return_value, soft, rl.rlim_cur); } if (rl.rlim_max == RLIM_INFINITY) { - add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1); + add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { add_assoc_long(return_value, hard, rl.rlim_max); } diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index 85199d621d..0d053e5532 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -534,7 +534,7 @@ static PHP_FUNCTION(pspell_suggest) if (wl) { PspellStringEmulation *els = pspell_word_list_elements(wl); while ((sug = pspell_string_emulation_next(els)) != 0) { - add_next_index_string(return_value,(char *)sug,1); + add_next_index_string(return_value,(char *)sug); } delete_pspell_string_emulation(els); } else { diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 4bd9103462..3af1caabea 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -247,21 +247,21 @@ PHP_FUNCTION(readline_info) if (!what) { array_init(return_value); - add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer),1); + add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer)); add_assoc_long(return_value,"point",rl_point); add_assoc_long(return_value,"end",rl_end); #ifdef HAVE_LIBREADLINE add_assoc_long(return_value,"mark",rl_mark); add_assoc_long(return_value,"done",rl_done); add_assoc_long(return_value,"pending_input",rl_pending_input); - add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt),1); - add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name),1); + add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt)); + add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name)); #endif #if HAVE_ERASE_EMPTY_LINE add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line); #endif - add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version),1); - add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name),1); + add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version)); + add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name)); add_assoc_long(return_value,"attempted_completion_over",rl_attempted_completion_over); } else { if (!strcasecmp(what,"line_buffer")) { @@ -383,7 +383,7 @@ PHP_FUNCTION(readline_list_history) if (history) { int i; for (i = 0; history[i]; i++) { - add_next_index_string(return_value,history[i]->line,1); + add_next_index_string(return_value,history[i]->line); } } } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 224bec75ba..6dc4ef2edf 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1440,7 +1440,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c } if (return_output) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } else { zval_ptr_dtor(&retval); } @@ -1529,7 +1529,7 @@ ZEND_METHOD(reflection, export) } if (return_output) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } else { /* No need for _r variant, return of __toString should always be a string */ zend_print_zval(&retval, 0); @@ -1552,30 +1552,30 @@ ZEND_METHOD(reflection, getModifierNames) array_init(return_value); if (modifiers & (ZEND_ACC_ABSTRACT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { - add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1, 1); + add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1); } if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) { - add_next_index_stringl(return_value, "final", sizeof("final")-1, 1); + add_next_index_stringl(return_value, "final", sizeof("final")-1); } if (modifiers & ZEND_ACC_IMPLICIT_PUBLIC) { - add_next_index_stringl(return_value, "public", sizeof("public")-1, 1); + add_next_index_stringl(return_value, "public", sizeof("public")-1); } /* These are mutually exclusive */ switch (modifiers & ZEND_ACC_PPP_MASK) { case ZEND_ACC_PUBLIC: - add_next_index_stringl(return_value, "public", sizeof("public")-1, 1); + add_next_index_stringl(return_value, "public", sizeof("public")-1); break; case ZEND_ACC_PRIVATE: - add_next_index_stringl(return_value, "private", sizeof("private")-1, 1); + add_next_index_stringl(return_value, "private", sizeof("private")-1); break; case ZEND_ACC_PROTECTED: - add_next_index_stringl(return_value, "protected", sizeof("protected")-1, 1); + add_next_index_stringl(return_value, "protected", sizeof("protected")-1); break; } if (modifiers & ZEND_ACC_STATIC) { - add_next_index_stringl(return_value, "static", sizeof("static")-1, 1); + add_next_index_stringl(return_value, "static", sizeof("static")-1); } } /* }}} */ @@ -1928,7 +1928,7 @@ ZEND_METHOD(reflection_function, invoke) } if (Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } /* }}} */ @@ -1994,7 +1994,7 @@ ZEND_METHOD(reflection_function, invokeArgs) } if (Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } /* }}} */ @@ -2902,7 +2902,7 @@ ZEND_METHOD(reflection_method, invoke) } if (Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } /* }}} */ @@ -3017,7 +3017,7 @@ ZEND_METHOD(reflection_method, invokeArgs) } if (Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } /* }}} */ @@ -5292,7 +5292,7 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has if (number == ini_entry->module_number) { if (ini_entry->value) { - add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length, 1); + add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length); } else { add_assoc_null(retval, ini_entry->name); } diff --git a/ext/session/session.c b/ext/session/session.c index 946708a5ca..e7113c08cb 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -154,7 +154,7 @@ PHPAPI void php_add_session_var(zend_string *name TSRMLS_DC) /* {{{ */ zval empty_var; ZVAL_NULL(&empty_var); - ZEND_SET_SYMBOL_WITH_LENGTH(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), name->val, name->len, &empty_var, 1, 0); + zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), name, &empty_var); } } /* }}} */ @@ -183,7 +183,6 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */ zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0); /* Unconditionally destroy existing array -- possible dirty data */ zend_delete_global_variable(var_name TSRMLS_CC); - STR_RELEASE(var_name); if (!ZVAL_IS_UNDEF(&PS(http_session_vars))) { zval_ptr_dtor(&PS(http_session_vars)); @@ -191,8 +190,9 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */ array_init(&session_vars); ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); - - ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION") - 1, &PS(http_session_vars), 2, 1); + Z_ADDREF_P(&PS(http_session_vars)); + zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars)); + STR_RELEASE(var_name); } /* }}} */ @@ -844,6 +844,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */ const char *endptr = val + vallen; zval session_vars; php_unserialize_data_t var_hash; + zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0); ZVAL_NULL(&session_vars); PHP_VAR_UNSERIALIZE_INIT(var_hash); @@ -856,7 +857,9 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */ array_init(&session_vars); } ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); - ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION") - 1, &PS(http_session_vars), 2, 1); + Z_ADDREF_P(&PS(http_session_vars)); + zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars)); + STR_RELEASE(var_name); return SUCCESS; } /* }}} */ @@ -1648,8 +1651,8 @@ static PHP_FUNCTION(session_get_cookie_params) array_init(return_value); add_assoc_long(return_value, "lifetime", PS(cookie_lifetime)); - add_assoc_string(return_value, "path", PS(cookie_path), 1); - add_assoc_string(return_value, "domain", PS(cookie_domain), 1); + add_assoc_string(return_value, "path", PS(cookie_path)); + add_assoc_string(return_value, "domain", PS(cookie_domain)); add_assoc_bool(return_value, "secure", PS(cookie_secure)); add_assoc_bool(return_value, "httponly", PS(cookie_httponly)); } @@ -2650,7 +2653,8 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i PS(session_status) = php_session_active; IF_SESSION_VARS() { progress->cancel_upload |= php_check_cancel_upload(progress TSRMLS_CC); - ZEND_SET_SYMBOL_WITH_LENGTH(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s->val, progress->key.s->len, &progress->data, 2, 0); + if (Z_REFCOUNTED(progress->data)) Z_ADDREF(progress->data); + zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s, &progress->data); } php_session_flush(TSRMLS_C); } /* }}} */ @@ -2761,8 +2765,8 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo array_init(&progress->current_file); /* Each uploaded file has its own array. Trying to make it close to $_FILES entries. */ - add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name, 1); - add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename, 1); + add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name); + add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename); add_assoc_null_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1); add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, 0); @@ -2799,7 +2803,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo } if (data->temp_filename) { - add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename, 1); + add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename); } add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload); diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 632d55b421..95225d1472 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1417,7 +1417,7 @@ static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns) /* {{ { char *prefix = SXE_NS_PREFIX(ns); if (zend_hash_str_exists(Z_ARRVAL_P(return_value), prefix, strlen(prefix)) == 0) { - add_assoc_string(return_value, prefix, (char*)ns->href, 1); + add_assoc_string(return_value, prefix, (char*)ns->href); } } /* }}} */ diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 36d0f80249..7e505802ed 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -2962,9 +2962,9 @@ static zval *guess_zval_convert(encodeTypePtr type, xmlNodePtr data TSRMLS_DC) add_property_zval(soapvar, "enc_value", ret); parse_namespace(type_name, &cptype, &ns); nsptr = xmlSearchNs(data->doc, data, BAD_CAST(ns)); - add_property_string(soapvar, "enc_stype", cptype, 1); + add_property_string(soapvar, "enc_stype", cptype); if (nsptr) { - add_property_string(soapvar, "enc_ns", (char*)nsptr->href, 1); + add_property_string(soapvar, "enc_ns", (char*)nsptr->href); } efree(cptype); if (ns) {efree(ns);} diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 2a5679a439..f3abe680c9 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -849,7 +849,7 @@ try_again: smart_str_0(&soap_headers); if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && Z_LVAL_PP(trace) > 0) { - add_property_stringl(this_ptr, "__last_request_headers", soap_headers.c, soap_headers.len, 1); + add_property_stringl(this_ptr, "__last_request_headers", soap_headers.c, soap_headers.len); } smart_str_appendl(&soap_headers, request, request_size); smart_str_0(&soap_headers); @@ -894,7 +894,7 @@ try_again: if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && Z_LVAL_PP(trace) > 0) { - add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size, 1); + add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size); } /* Check to see what HTTP status was sent */ @@ -970,7 +970,7 @@ try_again: ALLOC_INIT_ZVAL(zcookie); array_init(zcookie); - add_index_stringl(zcookie, 0, eqpos + 1, cookie_len, 1); + add_index_stringl(zcookie, 0, eqpos + 1, cookie_len); if (sempos != NULL) { char *options = cookie + cookie_len+1; @@ -979,10 +979,10 @@ try_again: sempos = strstr(options, ";"); if (strstr(options,"path=") == options) { eqpos = options + sizeof("path=")-1; - add_index_stringl(zcookie, 1, eqpos, sempos?(sempos-eqpos):strlen(eqpos), 1); + add_index_stringl(zcookie, 1, eqpos, sempos?(sempos-eqpos):strlen(eqpos)); } else if (strstr(options,"domain=") == options) { eqpos = options + sizeof("domain=")-1; - add_index_stringl(zcookie, 2, eqpos, sempos?(sempos-eqpos):strlen(eqpos), 1); + add_index_stringl(zcookie, 2, eqpos, sempos?(sempos-eqpos):strlen(eqpos)); } else if (strstr(options,"secure") == options) { add_index_bool(zcookie, 3, 1); } @@ -997,11 +997,11 @@ try_again: char *t = phpurl->path?phpurl->path:"/"; char *c = strrchr(t, '/'); if (c) { - add_index_stringl(zcookie, 1, t, c-t, 1); + add_index_stringl(zcookie, 1, t, c-t); } } if (!zend_hash_index_exists(Z_ARRVAL_P(zcookie), 2)) { - add_index_string(zcookie, 2, phpurl->host, 1); + add_index_string(zcookie, 2, phpurl->host); } add_assoc_zval_ex(*cookies, name.c, name.len+1, zcookie); @@ -1173,7 +1173,7 @@ try_again: ALLOC_INIT_ZVAL(digest); array_init(digest); } - add_assoc_string(digest, name, val ,1); + add_assoc_string(digest, name, val); } } diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 5048bf0b2c..9f3b5e14bf 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -792,7 +792,7 @@ PHP_METHOD(SoapParam, SoapParam) return; } - add_property_stringl(this_ptr, "param_name", name, name_length, 1); + add_property_stringl(this_ptr, "param_name", name, name_length); add_property_zval(this_ptr, "param_data", data); } /* }}} */ @@ -819,8 +819,8 @@ PHP_METHOD(SoapHeader, SoapHeader) return; } - add_property_stringl(this_ptr, "namespace", ns, ns_len, 1); - add_property_stringl(this_ptr, "name", name, name_len, 1); + add_property_stringl(this_ptr, "namespace", ns, ns_len); + add_property_stringl(this_ptr, "name", name, name_len); if (data) { add_property_zval(this_ptr, "data", data); } @@ -832,7 +832,7 @@ PHP_METHOD(SoapHeader, SoapHeader) Z_LVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { add_property_long(this_ptr, "actor", Z_LVAL_P(actor)); } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) { - add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor), 1); + add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid actor"); } @@ -964,16 +964,16 @@ PHP_METHOD(SoapVar, SoapVar) } if (stype && stype_len > 0) { - add_property_stringl(this_ptr, "enc_stype", stype, stype_len, 1); + add_property_stringl(this_ptr, "enc_stype", stype, stype_len); } if (ns && ns_len > 0) { - add_property_stringl(this_ptr, "enc_ns", ns, ns_len, 1); + add_property_stringl(this_ptr, "enc_ns", ns, ns_len); } if (name && name_len > 0) { - add_property_stringl(this_ptr, "enc_name", name, name_len, 1); + add_property_stringl(this_ptr, "enc_name", name, name_len); } if (namens && namens_len > 0) { - add_property_stringl(this_ptr, "enc_namens", namens, namens_len, 1); + add_property_stringl(this_ptr, "enc_namens", namens, namens_len); } } /* }}} */ @@ -1357,7 +1357,7 @@ PHP_METHOD(SoapServer, getFunctions) zend_hash_internal_pointer_reset_ex(service->soap_functions.ft, &pos); while (zend_hash_get_current_data_ex(service->soap_functions.ft, (void **)&name, &pos) != FAILURE) { - add_next_index_string(return_value, Z_STRVAL_PP(name), 1); + add_next_index_string(return_value, Z_STRVAL_PP(name)); zend_hash_move_forward_ex(service->soap_functions.ft, &pos); } } @@ -1367,7 +1367,7 @@ PHP_METHOD(SoapServer, getFunctions) zend_hash_internal_pointer_reset_ex(ft, &pos); while (zend_hash_get_current_data_ex(ft, (void **)&f, &pos) != FAILURE) { if ((service->type != SOAP_OBJECT && service->type != SOAP_CLASS) || (f->common.fn_flags & ZEND_ACC_PUBLIC)) { - add_next_index_string(return_value, f->common.function_name, 1); + add_next_index_string(return_value, f->common.function_name); } zend_hash_move_forward_ex(ft, &pos); } @@ -2344,7 +2344,7 @@ PHP_METHOD(SoapClient, SoapClient) /* Fetching non-WSDL mode options */ if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode"); } @@ -2370,7 +2370,7 @@ PHP_METHOD(SoapClient, SoapClient) if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "location", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "location", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' option is required in nonWSDL mode"); } @@ -2383,10 +2383,10 @@ PHP_METHOD(SoapClient, SoapClient) } if (zend_hash_find(ht, "login", sizeof("login"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); if (zend_hash_find(ht, "password", sizeof("password"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } if (zend_hash_find(ht, "authentication", sizeof("authentication"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG && @@ -2396,17 +2396,17 @@ PHP_METHOD(SoapClient, SoapClient) } if (zend_hash_find(ht, "proxy_host", sizeof("proxy_host"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "_proxy_host", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "_proxy_host", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); if (zend_hash_find(ht, "proxy_port", sizeof("proxy_port"), (void**)&tmp) == SUCCESS) { convert_to_long(*tmp); add_property_long(this_ptr, "_proxy_port", Z_LVAL_PP(tmp)); } if (zend_hash_find(ht, "proxy_login", sizeof("proxy_login"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "_proxy_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "_proxy_login", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); if (zend_hash_find(ht, "proxy_password", sizeof("proxy_password"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "_proxy_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "_proxy_password", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } } } @@ -2451,7 +2451,7 @@ PHP_METHOD(SoapClient, SoapClient) php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_PP(tmp)); } else { xmlCharEncCloseFunc(encoding); - add_property_stringl(this_ptr, "_encoding", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "_encoding", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } } if (zend_hash_find(ht, "classmap", sizeof("classmap"), (void**)&tmp) == SUCCESS && @@ -2494,7 +2494,7 @@ PHP_METHOD(SoapClient, SoapClient) if (zend_hash_find(ht, "user_agent", sizeof("user_agent"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { - add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); + add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } if (zend_hash_find(ht, "keep_alive", sizeof("keep_alive"), (void**)&tmp) == SUCCESS && @@ -2559,7 +2559,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && Z_LVAL_PP(trace) > 0) { - add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1); + add_property_stringl(this_ptr, "__last_request", buf, buf_size); } INIT_ZVAL(func); @@ -2594,7 +2594,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act ret = FALSE; } else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS && Z_LVAL_PP(trace) > 0) { - add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response), 1); + add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response)); } zval_ptr_dtor(¶ms[4]); zval_ptr_dtor(¶ms[3]); @@ -2968,7 +2968,7 @@ PHP_METHOD(SoapClient, __getFunctions) zend_hash_internal_pointer_reset_ex(&sdl->functions, &pos); while (zend_hash_get_current_data_ex(&sdl->functions, (void **)&function, &pos) != FAILURE) { function_to_string((*function), &buf); - add_next_index_stringl(return_value, buf.c, buf.len, 1); + add_next_index_stringl(return_value, buf.c, buf.len); smart_str_free(&buf); zend_hash_move_forward_ex(&sdl->functions, &pos); } @@ -2999,7 +2999,7 @@ PHP_METHOD(SoapClient, __getTypes) zend_hash_internal_pointer_reset_ex(sdl->types, &pos); while (zend_hash_get_current_data_ex(sdl->types, (void **)&type, &pos) != FAILURE) { type_to_string((*type), &buf, 0); - add_next_index_stringl(return_value, buf.c, buf.len, 1); + add_next_index_stringl(return_value, buf.c, buf.len); smart_str_free(&buf); zend_hash_move_forward_ex(sdl->types, &pos); } @@ -3145,7 +3145,7 @@ PHP_METHOD(SoapClient, __setCookie) ALLOC_INIT_ZVAL(zcookie); array_init(zcookie); - add_index_stringl(zcookie, 0, val, val_len, 1); + add_index_stringl(zcookie, 0, val, val_len); add_assoc_zval_ex(*cookies, name, name_len+1, zcookie); } } @@ -3213,7 +3213,7 @@ PHP_METHOD(SoapClient, __setLocation) } if (location && location_len) { - add_property_stringl(this_ptr, "location", location, location_len, 1); + add_property_stringl(this_ptr, "location", location, location_len); } else { zend_hash_del(Z_OBJPROP_P(this_ptr), "location", sizeof("location")); } @@ -3244,50 +3244,50 @@ static void set_soap_fault(zval *obj, char *fault_code_ns, char *fault_code, cha object_init_ex(obj, soap_fault_class_entry); } - add_property_string(obj, "faultstring", fault_string ? fault_string : "", 1); + add_property_string(obj, "faultstring", fault_string ? fault_string : ""); zend_update_property_string(zend_exception_get_default(TSRMLS_C), obj, "message", sizeof("message")-1, (fault_string ? fault_string : "") TSRMLS_CC); if (fault_code != NULL) { int soap_version = SOAP_GLOBAL(soap_version); if (fault_code_ns) { - add_property_string(obj, "faultcode", fault_code, 1); - add_property_string(obj, "faultcodens", fault_code_ns, 1); + add_property_string(obj, "faultcode", fault_code); + add_property_string(obj, "faultcodens", fault_code_ns); } else { if (soap_version == SOAP_1_1) { - add_property_string(obj, "faultcode", fault_code, 1); + add_property_string(obj, "faultcode", fault_code); if (strcmp(fault_code,"Client") == 0 || strcmp(fault_code,"Server") == 0 || strcmp(fault_code,"VersionMismatch") == 0 || strcmp(fault_code,"MustUnderstand") == 0) { - add_property_string(obj, "faultcodens", SOAP_1_1_ENV_NAMESPACE, 1); + add_property_string(obj, "faultcodens", SOAP_1_1_ENV_NAMESPACE); } } else if (soap_version == SOAP_1_2) { if (strcmp(fault_code,"Client") == 0) { - add_property_string(obj, "faultcode", "Sender", 1); - add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE, 1); + add_property_string(obj, "faultcode", "Sender"); + add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE); } else if (strcmp(fault_code,"Server") == 0) { - add_property_string(obj, "faultcode", "Receiver", 1); - add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE, 1); + add_property_string(obj, "faultcode", "Receiver"); + add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE); } else if (strcmp(fault_code,"VersionMismatch") == 0 || strcmp(fault_code,"MustUnderstand") == 0 || strcmp(fault_code,"DataEncodingUnknown") == 0) { - add_property_string(obj, "faultcode", fault_code, 1); - add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE, 1); + add_property_string(obj, "faultcode", fault_code); + add_property_string(obj, "faultcodens", SOAP_1_2_ENV_NAMESPACE); } else { - add_property_string(obj, "faultcode", fault_code, 1); + add_property_string(obj, "faultcode", fault_code); } } } } if (fault_actor != NULL) { - add_property_string(obj, "faultactor", fault_actor, 1); + add_property_string(obj, "faultactor", fault_actor); } if (fault_detail != NULL) { add_property_zval(obj, "detail", fault_detail); } if (name != NULL) { - add_property_string(obj, "_name", name, 1); + add_property_string(obj, "_name", name); } } diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 55d72e6753..763996ad2a 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -721,7 +721,7 @@ PHP_FUNCTION(spl_autoload_functions) if (!EG(autoload_func)) { if ((fptr = zend_hash_str_find_ptr(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1))) { array_init(return_value); - add_next_index_stringl(return_value, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 1); + add_next_index_stringl(return_value, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1); return; } RETURN_FALSE; diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 5188ec5565..79e53c0aa0 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1475,7 +1475,7 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam efree(Z_REF(tmp)); } if (!ZVAL_IS_UNDEF(&retval)) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } /* }}} */ diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index ec74a3cae1..0400332dc4 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2679,8 +2679,8 @@ SPL_METHOD(SplFileObject, getCsvControl) enclosure[0] = intern->u.file.enclosure; enclosure[1] = '\0'; - add_next_index_string(return_value, delimiter, 1); - add_next_index_string(return_value, enclosure, 1); + add_next_index_string(return_value, delimiter); + add_next_index_string(return_value, enclosure); } /* }}} */ diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 0c9041ebfc..ef857d4f41 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -240,7 +240,7 @@ PHP_METHOD(sqlite3, version) array_init(return_value); - add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion(), 1); + add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion()); add_assoc_long(return_value, "versionNumber", sqlite3_libversion_number()); return; diff --git a/ext/standard/array.c b/ext/standard/array.c index bef42feaac..9ddb234186 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1688,7 +1688,7 @@ PHP_FUNCTION(range) goto err; } for (; ch >= *high; ch -= (unsigned int)lstep) { - add_next_index_stringl(return_value, (const char *)&ch, 1, 1); + add_next_index_stringl(return_value, (const char *)&ch, 1); if (((signed int)ch - lstep) < 0) { break; } @@ -1701,13 +1701,13 @@ PHP_FUNCTION(range) goto err; } for (; ch <= *high; ch += (unsigned int)lstep) { - add_next_index_stringl(return_value, (const char *)&ch, 1, 1); + add_next_index_stringl(return_value, (const char *)&ch, 1); if (((signed int)ch + lstep) > 255) { break; } } } else { - add_next_index_stringl(return_value, (const char *)low, 1, 1); + add_next_index_stringl(return_value, (const char *)low, 1); } } else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 0f212a5785..6632e99328 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4766,8 +4766,8 @@ PHP_FUNCTION(error_get_last) if (PG(last_error_message)) { array_init(return_value); add_assoc_long_ex(return_value, "type", sizeof("type")-1, PG(last_error_type)); - add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message), 1); - add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-", 1 ); + add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message)); + add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-"); add_assoc_long_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno)); } } @@ -4788,7 +4788,7 @@ PHP_FUNCTION(call_user_func) fci.retval = &retval; if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } /* }}} */ @@ -4809,7 +4809,7 @@ PHP_FUNCTION(call_user_func_array) fci.retval = &retval; if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } zend_fcall_info_args_clear(&fci, 1); @@ -4842,7 +4842,7 @@ PHP_FUNCTION(call_user_method) if (call_user_function_ex(EG(function_table), object, callback, &retval, n_params, params, 0, NULL TSRMLS_CC) == SUCCESS) { if (Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback)); @@ -4888,7 +4888,7 @@ PHP_FUNCTION(call_user_method_array) if (call_user_function_ex(EG(function_table), object, callback, &retval, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) { if (Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback)); @@ -4922,7 +4922,7 @@ PHP_FUNCTION(forward_static_call) } if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } } /* }}} */ @@ -4948,7 +4948,7 @@ PHP_FUNCTION(forward_static_call_array) } if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - COPY_PZVAL_TO_ZVAL(*return_value, &retval); + ZVAL_COPY_VALUE(return_value, &retval); } zend_fcall_info_args_clear(&fci, 1); @@ -5359,15 +5359,15 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze array_init(&option); if (ini_entry->orig_value) { - add_assoc_stringl(&option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1); + add_assoc_stringl(&option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length); } else if (ini_entry->value) { - add_assoc_stringl(&option, "global_value", ini_entry->value, ini_entry->value_length, 1); + add_assoc_stringl(&option, "global_value", ini_entry->value, ini_entry->value_length); } else { add_assoc_null(&option, "global_value"); } if (ini_entry->value) { - add_assoc_stringl(&option, "local_value", ini_entry->value, ini_entry->value_length, 1); + add_assoc_stringl(&option, "local_value", ini_entry->value, ini_entry->value_length); } else { add_assoc_null(&option, "local_value"); } @@ -5377,7 +5377,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option); } else { if (ini_entry->value) { - add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length, 1); + add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length); } else { add_assoc_null(ini_array, ini_entry->name); } diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 69e17240a7..80a34a4548 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -112,7 +112,7 @@ PHP_FUNCTION(strptime) add_assoc_long(return_value, "tm_year", parsed_time.tm_year); add_assoc_long(return_value, "tm_wday", parsed_time.tm_wday); add_assoc_long(return_value, "tm_yday", parsed_time.tm_yday); - add_assoc_string(return_value, "unparsed", unparsed_part, 1); + add_assoc_string(return_value, "unparsed", unparsed_part); } /* }}} */ diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 377d3123ea..16cc8db054 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -237,7 +237,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", dirname, dir_len, 1); + add_property_stringl(return_value, "path", dirname, dir_len); add_property_resource(return_value, "handle", dirp->res); php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */ } else { @@ -534,7 +534,7 @@ no_results: continue; } } - add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); + add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip); } globfree(&globbuf); diff --git a/ext/standard/dns.c b/ext/standard/dns.c index d0209fed5e..2501a03170 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -248,7 +248,7 @@ PHP_FUNCTION(gethostbynamel) for (i = 0 ; hp->h_addr_list[i] != 0 ; i++) { in = *(struct in_addr *) hp->h_addr_list[i]; - add_next_index_string(return_value, inet_ntoa(in), 1); + add_next_index_string(return_value, inet_ntoa(in)); } } /* }}} */ @@ -446,60 +446,60 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int array_init(subarray); - add_assoc_string(subarray, "host", name, 1); - add_assoc_string(subarray, "class", "IN", 1); + add_assoc_string(subarray, "host", name); + add_assoc_string(subarray, "class", "IN"); add_assoc_long(subarray, "ttl", ttl); if (raw) { add_assoc_long(subarray, "type", type); - add_assoc_stringl(subarray, "data", (char*) cp, (uint) dlen, 1); + add_assoc_stringl(subarray, "data", (char*) cp, (uint) dlen); cp += dlen; return cp; } switch (type) { case DNS_T_A: - add_assoc_string(subarray, "type", "A", 1); + add_assoc_string(subarray, "type", "A"); snprintf(name, sizeof(name), "%d.%d.%d.%d", cp[0], cp[1], cp[2], cp[3]); - add_assoc_string(subarray, "ip", name, 1); + add_assoc_string(subarray, "ip", name); cp += dlen; break; case DNS_T_MX: - add_assoc_string(subarray, "type", "MX", 1); + add_assoc_string(subarray, "type", "MX"); GETSHORT(n, cp); add_assoc_long(subarray, "pri", n); /* no break; */ case DNS_T_CNAME: if (type == DNS_T_CNAME) { - add_assoc_string(subarray, "type", "CNAME", 1); + add_assoc_string(subarray, "type", "CNAME"); } /* no break; */ case DNS_T_NS: if (type == DNS_T_NS) { - add_assoc_string(subarray, "type", "NS", 1); + add_assoc_string(subarray, "type", "NS"); } /* no break; */ case DNS_T_PTR: if (type == DNS_T_PTR) { - add_assoc_string(subarray, "type", "PTR", 1); + add_assoc_string(subarray, "type", "PTR"); } n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); if (n < 0) { return NULL; } cp += n; - add_assoc_string(subarray, "target", name, 1); + add_assoc_string(subarray, "target", name); break; case DNS_T_HINFO: /* See RFC 1010 for values */ - add_assoc_string(subarray, "type", "HINFO", 1); + add_assoc_string(subarray, "type", "HINFO"); n = *cp & 0xFF; cp++; - add_assoc_stringl(subarray, "cpu", (char*)cp, n, 1); + add_assoc_stringl(subarray, "cpu", (char*)cp, n); cp += n; n = *cp & 0xFF; cp++; - add_assoc_stringl(subarray, "os", (char*)cp, n, 1); + add_assoc_stringl(subarray, "os", (char*)cp, n); cp += n; break; case DNS_T_TXT: @@ -507,7 +507,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int int ll = 0; zval entries; - add_assoc_string(subarray, "type", "TXT", 1); + add_assoc_string(subarray, "type", "TXT"); tp = emalloc(dlen + 1); array_init(&entries); @@ -515,30 +515,32 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int while (ll < dlen) { n = cp[ll]; memcpy(tp + ll , cp + ll + 1, n); - add_next_index_stringl(&entries, (char*)cp + ll + 1, n, 1); + add_next_index_stringl(&entries, (char*)cp + ll + 1, n); ll = ll + n + 1; } tp[dlen] = '\0'; cp += dlen; - add_assoc_stringl(subarray, "txt", (char*)tp, (dlen>0)?dlen - 1:0, 0); + // TODO: avoid reallocation ??? + add_assoc_stringl(subarray, "txt", (char*)tp, (dlen>0)?dlen - 1:0); + efree(tp); add_assoc_zval(subarray, "entries", &entries); } break; case DNS_T_SOA: - add_assoc_string(subarray, "type", "SOA", 1); + add_assoc_string(subarray, "type", "SOA"); n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2); if (n < 0) { return NULL; } cp += n; - add_assoc_string(subarray, "mname", name, 1); + add_assoc_string(subarray, "mname", name); n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2); if (n < 0) { return NULL; } cp += n; - add_assoc_string(subarray, "rname", name, 1); + add_assoc_string(subarray, "rname", name); GETLONG(n, cp); add_assoc_long(subarray, "serial", n); GETLONG(n, cp); @@ -580,12 +582,12 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int tp++; } tp[0] = '\0'; - add_assoc_string(subarray, "type", "AAAA", 1); - add_assoc_string(subarray, "ipv6", name, 1); + add_assoc_string(subarray, "type", "AAAA"); + add_assoc_string(subarray, "ipv6", name); break; case DNS_T_A6: p = cp; - add_assoc_string(subarray, "type", "A6", 1); + add_assoc_string(subarray, "type", "A6"); n = ((int)cp[0]) & 0xFF; cp++; add_assoc_long(subarray, "masklen", n); @@ -648,18 +650,18 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int tp++; } tp[0] = '\0'; - add_assoc_string(subarray, "ipv6", name, 1); + add_assoc_string(subarray, "ipv6", name); if (cp < p + dlen) { n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); if (n < 0) { return NULL; } cp += n; - add_assoc_string(subarray, "chain", name, 1); + add_assoc_string(subarray, "chain", name); } break; case DNS_T_SRV: - add_assoc_string(subarray, "type", "SRV", 1); + add_assoc_string(subarray, "type", "SRV"); GETSHORT(n, cp); add_assoc_long(subarray, "pri", n); GETSHORT(n, cp); @@ -671,29 +673,29 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int return NULL; } cp += n; - add_assoc_string(subarray, "target", name, 1); + add_assoc_string(subarray, "target", name); break; case DNS_T_NAPTR: - add_assoc_string(subarray, "type", "NAPTR", 1); + add_assoc_string(subarray, "type", "NAPTR"); GETSHORT(n, cp); add_assoc_long(subarray, "order", n); GETSHORT(n, cp); add_assoc_long(subarray, "pref", n); n = (cp[0] & 0xFF); - add_assoc_stringl(subarray, "flags", (char*)++cp, n, 1); + add_assoc_stringl(subarray, "flags", (char*)++cp, n); cp += n; n = (cp[0] & 0xFF); - add_assoc_stringl(subarray, "services", (char*)++cp, n, 1); + add_assoc_stringl(subarray, "services", (char*)++cp, n); cp += n; n = (cp[0] & 0xFF); - add_assoc_stringl(subarray, "regex", (char*)++cp, n, 1); + add_assoc_stringl(subarray, "regex", (char*)++cp, n); cp += n; n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); if (n < 0) { return NULL; } cp += n; - add_assoc_string(subarray, "replacement", name, 1); + add_assoc_string(subarray, "replacement", name); break; default: zval_ptr_dtor(subarray); @@ -1005,7 +1007,7 @@ PHP_FUNCTION(dns_get_mx) RETURN_FALSE; } cp += i; - add_next_index_string(mx_list, buf, 1); + add_next_index_string(mx_list, buf); if (weight_list) { add_next_index_long(weight_list, weight); } diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index 2dbf3e2e1d..5fd0da0dea 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -75,7 +75,7 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */ continue; } - add_next_index_string(mx_list, pRec->Data.MX.pNameExchange, 1); + add_next_index_string(mx_list, pRec->Data.MX.pNameExchange); if (weight_list) { add_next_index_long(weight_list, srv->wPriority); } @@ -157,13 +157,13 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, ALLOC_INIT_ZVAL(*subarray); array_init(*subarray); - add_assoc_string(*subarray, "host", pRec->pName, 1); - add_assoc_string(*subarray, "class", "IN", 1); + add_assoc_string(*subarray, "host", pRec->pName); + add_assoc_string(*subarray, "class", "IN"); add_assoc_long(*subarray, "ttl", ttl); if (raw) { add_assoc_long(*subarray, "type", type); - add_assoc_stringl(*subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength, 1); + add_assoc_stringl(*subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength); return; } @@ -171,33 +171,33 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, case DNS_TYPE_A: { IN_ADDR ipaddr; ipaddr.S_un.S_addr = (pRec->Data.A.IpAddress); - add_assoc_string(*subarray, "type", "A", 1); - add_assoc_string(*subarray, "ip", inet_ntoa(ipaddr), 1); + add_assoc_string(*subarray, "type", "A"); + add_assoc_string(*subarray, "ip", inet_ntoa(ipaddr)); break; } case DNS_TYPE_MX: - add_assoc_string(*subarray, "type", "MX", 1); + add_assoc_string(*subarray, "type", "MX"); add_assoc_long(*subarray, "pri", pRec->Data.Srv.wPriority); /* no break; */ case DNS_TYPE_CNAME: if (type == DNS_TYPE_CNAME) { - add_assoc_string(*subarray, "type", "CNAME", 1); + add_assoc_string(*subarray, "type", "CNAME"); } /* no break; */ case DNS_TYPE_NS: if (type == DNS_TYPE_NS) { - add_assoc_string(*subarray, "type", "NS", 1); + add_assoc_string(*subarray, "type", "NS"); } /* no break; */ case DNS_TYPE_PTR: if (type == DNS_TYPE_PTR) { - add_assoc_string(*subarray, "type", "PTR", 1); + add_assoc_string(*subarray, "type", "PTR"); } - add_assoc_string(*subarray, "target", pRec->Data.MX.pNameExchange, 1); + add_assoc_string(*subarray, "target", pRec->Data.MX.pNameExchange); break; /* Not available on windows, the query is possible but there is no DNS_HINFO_DATA structure */ @@ -211,7 +211,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, long txt_len = 0; zval *entries; - add_assoc_string(*subarray, "type", "TXT", 1); + add_assoc_string(*subarray, "type", "TXT"); ALLOC_INIT_ZVAL(entries); array_init(entries); @@ -225,11 +225,13 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, for (i = 0; i < count; i++) { int len = strlen(data_txt->pStringArray[i]); memcpy(txt_dst, data_txt->pStringArray[i], len); - add_next_index_stringl(entries, data_txt->pStringArray[i], len, 1); + add_next_index_stringl(entries, data_txt->pStringArray[i], len); txt_dst += len; } - add_assoc_string(*subarray, "txt", txt, 0); + // TODO: avoid reallocation ??? + add_assoc_string(*subarray, "txt", txt); + efree(txt); add_assoc_zval(*subarray, "entries", entries); } break; @@ -238,10 +240,10 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, { DNS_SOA_DATA *data_soa = &pRec->Data.Soa; - add_assoc_string(*subarray, "type", "SOA", 1); + add_assoc_string(*subarray, "type", "SOA"); - add_assoc_string(*subarray, "mname", data_soa->pNamePrimaryServer, 1); - add_assoc_string(*subarray, "rname", data_soa->pNameAdministrator, 1); + add_assoc_string(*subarray, "mname", data_soa->pNamePrimaryServer); + add_assoc_string(*subarray, "rname", data_soa->pNameAdministrator); add_assoc_long(*subarray, "serial", data_soa->dwSerialNo); add_assoc_long(*subarray, "refresh", data_soa->dwRefresh); add_assoc_long(*subarray, "retry", data_soa->dwRetry); @@ -294,8 +296,8 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, } tp[0] = '\0'; - add_assoc_string(*subarray, "type", "AAAA", 1); - add_assoc_string(*subarray, "ipv6", buf, 1); + add_assoc_string(*subarray, "type", "AAAA"); + add_assoc_string(*subarray, "ipv6", buf); } break; @@ -309,11 +311,11 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, { DNS_SRV_DATA *data_srv = &pRec->Data.Srv; - add_assoc_string(*subarray, "type", "SRV", 1); + add_assoc_string(*subarray, "type", "SRV"); add_assoc_long(*subarray, "pri", data_srv->wPriority); add_assoc_long(*subarray, "weight", data_srv->wWeight); add_assoc_long(*subarray, "port", data_srv->wPort); - add_assoc_string(*subarray, "target", data_srv->pNameTarget, 1); + add_assoc_string(*subarray, "target", data_srv->pNameTarget); } break; @@ -322,13 +324,13 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, { DNS_NAPTR_DATA * data_naptr = &pRec->Data.Naptr; - add_assoc_string(*subarray, "type", "NAPTR", 1); + add_assoc_string(*subarray, "type", "NAPTR"); add_assoc_long(*subarray, "order", data_naptr->wOrder); add_assoc_long(*subarray, "pref", data_naptr->wPreference); - add_assoc_string(*subarray, "flags", data_naptr->pFlags, 1); - add_assoc_string(*subarray, "services", data_naptr->pService, 1); - add_assoc_string(*subarray, "regex", data_naptr->pRegularExpression, 1); - add_assoc_string(*subarray, "replacement", data_naptr->pReplacement, 1); + add_assoc_string(*subarray, "flags", data_naptr->pFlags); + add_assoc_string(*subarray, "services", data_naptr->pService); + add_assoc_string(*subarray, "regex", data_naptr->pRegularExpression); + add_assoc_string(*subarray, "replacement", data_naptr->pReplacement); } break; #endif diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 70d0d82dda..3b07e00443 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -120,7 +120,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ bufl = l + 1; buf[bufl] = '\0'; } - add_next_index_stringl(array, buf, bufl, 1); + add_next_index_stringl(array, buf, bufl); } b = buf; } @@ -134,7 +134,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ buf[bufl] = '\0'; } if (type == 2) { - add_next_index_stringl(array, buf, bufl, 1); + add_next_index_stringl(array, buf, bufl); } } diff --git a/ext/standard/file.c b/ext/standard/file.c index 020860873f..b802e2c4e7 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -480,9 +480,9 @@ PHP_FUNCTION(get_meta_tags) /* For BC */ php_strtolower(name, strlen(name)); if (have_content) { - add_assoc_string(return_value, name, value, 1); + add_assoc_string(return_value, name, value); } else { - add_assoc_string(return_value, name, "", 1); + add_assoc_string(return_value, name, ""); } efree(name); @@ -763,7 +763,7 @@ PHP_FUNCTION(file) do { p++; parse_eol: - add_index_stringl(return_value, i++, s, p-s, 1); + add_index_stringl(return_value, i++, s, p-s); s = p; } while ((p = memchr(p, eol_marker, (e-p)))); } else { @@ -776,7 +776,7 @@ parse_eol: s = ++p; continue; } - add_index_stringl(return_value, i++, s, p-s-windows_eol, 1); + add_index_stringl(return_value, i++, s, p-s-windows_eol); s = ++p; } while ((p = memchr(p, eol_marker, (e-p)))); } @@ -2277,7 +2277,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char /* 3. Now pass our field back to php */ *comp_end = '\0'; - add_next_index_stringl(return_value, temp, comp_end - temp, 1); + add_next_index_stringl(return_value, temp, comp_end - temp); } while (inc_len > 0); out: diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 311ca48f1c..4232af4d1c 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -1215,7 +1215,7 @@ PHP_FUNCTION(realpath_cache_get) add_assoc_double(&entry, "key", (double)bucket->key); } add_assoc_bool(&entry, "is_dir", bucket->is_dir); - add_assoc_stringl(&entry, "realpath", bucket->realpath, bucket->realpath_len, 1); + add_assoc_stringl(&entry, "realpath", bucket->realpath, bucket->realpath_len); add_assoc_long(&entry, "expires", bucket->expires); #ifdef PHP_WIN32 add_assoc_bool(&entry, "is_rvalid", bucket->is_rvalid); diff --git a/ext/standard/head.c b/ext/standard/head.c index 120a0615e8..30846215f8 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -265,7 +265,7 @@ static void php_head_apply_header_list_to_hash(void *data, void *arg TSRMLS_DC) sapi_header_struct *sapi_header = (sapi_header_struct *)data; if (arg && sapi_header) { - add_next_index_string((zval *)arg, (char *)(sapi_header->header), 1); + add_next_index_string((zval *)arg, (char *)(sapi_header->header)); } } diff --git a/ext/standard/html.c b/ext/standard/html.c index 57fb9ea899..cc772859a5 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1546,7 +1546,7 @@ static inline void write_s3row_data( size_t l = r->data.ent.entity_len; memcpy(&entity[1], r->data.ent.entity, l); entity[l + 1] = ';'; - add_assoc_stringl_ex(arr, key, written_k1, entity, l + 2, 1); + add_assoc_stringl_ex(arr, key, written_k1, entity, l + 2); } else { unsigned i, num_entries; @@ -1556,7 +1556,7 @@ static inline void write_s3row_data( size_t l = mcpr[0].leading_entry.default_entity_len; memcpy(&entity[1], mcpr[0].leading_entry.default_entity, l); entity[l + 1] = ';'; - add_assoc_stringl_ex(arr, key, written_k1, entity, l + 2, 1); + add_assoc_stringl_ex(arr, key, written_k1, entity, l + 2); } num_entries = mcpr[0].leading_entry.size; for (i = 1; i <= num_entries; i++) { @@ -1579,7 +1579,7 @@ static inline void write_s3row_data( memcpy(&entity[1], mcpr[i].normal_entry.entity, l); entity[l + 1] = ';'; entity[l + 1] = '\0'; - add_assoc_stringl_ex(arr, key, written_k1 + written_k2, entity, l + 1, 1); + add_assoc_stringl_ex(arr, key, written_k1 + written_k2, entity, l + 1); } } } diff --git a/ext/standard/image.c b/ext/standard/image.c index 137f91b79f..caaac77495 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -457,7 +457,7 @@ static int php_read_APP(php_stream * stream, unsigned int marker, zval *info TSR if ((tmp = zend_hash_str_find(Z_ARRVAL_P(info), markername, strlen(markername))) == NULL) { /* XXX we onyl catch the 1st tag of it's kind! */ - add_assoc_stringl(info, markername, buffer, length, 1); + add_assoc_stringl(info, markername, buffer, length); } efree(buffer); @@ -1365,7 +1365,7 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA add_index_long(return_value, 1, result->height); add_index_long(return_value, 2, itype); snprintf(temp, sizeof(temp), "width=\"%d\" height=\"%d\"", result->width, result->height); - add_index_string(return_value, 3, temp, 0); + add_index_string(return_value, 3, temp); if (result->bits != 0) { add_assoc_long(return_value, "bits", result->bits); @@ -1373,7 +1373,7 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA if (result->channels != 0) { add_assoc_long(return_value, "channels", result->channels); } - add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype), 1); + add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype)); efree(result); } else { RETURN_FALSE; diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index e5a17456d4..fa17c95f3c 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -354,7 +354,7 @@ PHP_FUNCTION(iptcparse) element = zend_hash_str_update(Z_ARRVAL_P(return_value), key, strlen(key), &values); } - add_next_index_stringl(element, buffer+inx, len, 1); + add_next_index_stringl(element, buffer+inx, len); inx += len; tagsfound++; } diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 3fffb046d6..53a18c8fec 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -681,7 +681,7 @@ PHP_FUNCTION(unpack) size = len; - add_assoc_stringl(return_value, n, &input[inputpos], len, 1); + add_assoc_stringl(return_value, n, &input[inputpos], len); break; } case 'A': { @@ -707,7 +707,7 @@ PHP_FUNCTION(unpack) break; } - add_assoc_stringl(return_value, n, &input[inputpos], len + 1, 1); + add_assoc_stringl(return_value, n, &input[inputpos], len + 1); break; } /* New option added for Z to remain in-line with the Perl implementation */ @@ -731,7 +731,7 @@ PHP_FUNCTION(unpack) } len = s; - add_assoc_stringl(return_value, n, &input[inputpos], len, 1); + add_assoc_stringl(return_value, n, &input[inputpos], len); break; } @@ -774,7 +774,7 @@ PHP_FUNCTION(unpack) } buf[len] = '\0'; - add_assoc_stringl(return_value, n, buf, len, 1); + add_assoc_stringl(return_value, n, buf, len); efree(buf); break; } diff --git a/ext/standard/password.c b/ext/standard/password.c index de0de3d80d..738bdcc7ac 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -208,7 +208,7 @@ PHP_FUNCTION(password_get_info) array_init(return_value); add_assoc_long(return_value, "algo", algo); - add_assoc_string(return_value, "algoName", algo_name, 1); + add_assoc_string(return_value, "algoName", algo_name); add_assoc_zval(return_value, "options", &options); } diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index fd3e0c2937..c18077a2d5 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -343,7 +343,7 @@ PHP_FUNCTION(proc_get_status) array_init(return_value); - add_assoc_string(return_value, "command", proc->command, 1); + add_assoc_string(return_value, "command", proc->command); add_assoc_long(return_value, "pid", (long) proc->child); #ifdef PHP_WIN32 @@ -899,7 +899,7 @@ PHP_FUNCTION(proc_open) proc->env = env; if (pipes != NULL) { - ZVAL_DEREF_REF(pipes); + ZVAL_DEREF(pipes); zval_dtor(pipes); } diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 4210f11d6b..77f781c49b 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -869,7 +869,7 @@ literal: // Z_SET_REFCOUNT_P(current, refcount); //??? Z_SET_ISREF_PP(current); } else { - add_index_stringl(return_value, objIndex++, string, end-string, 1); + add_index_stringl(return_value, objIndex++, string, end-string); } } string = end; @@ -910,7 +910,7 @@ literal: zval_dtor(Z_REFVAL_P(current)); ZVAL_STRINGL(Z_REFVAL_P(current), string, end-string); } else { - add_index_stringl(return_value, objIndex++, string, end-string, 1); + add_index_stringl(return_value, objIndex++, string, end-string); } } string = end; @@ -931,7 +931,7 @@ literal: zval_dtor(*current); ZVAL_STRINGL( *current, __buf, 1, 1); } else { - add_index_stringl(return_value, objIndex++, &sch, 1, 1); + add_index_stringl(return_value, objIndex++, &sch, 1); } } break; @@ -1064,7 +1064,7 @@ addToInt: zval_dtor(Z_REFVAL_P(current)); ZVAL_STRING(Z_REFVAL_P(current), buf); } else { - add_index_string(return_value, objIndex++, buf, 1); + add_index_string(return_value, objIndex++, buf); } } else { if (numVars && objIndex >= argCount) { diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 4b1411c7b7..360c436be7 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -501,11 +501,11 @@ PHP_FUNCTION(stream_get_meta_data) add_assoc_zval(return_value, "wrapper_data", &stream->wrapperdata); } if (stream->wrapper) { - add_assoc_string(return_value, "wrapper_type", (char *)stream->wrapper->wops->label, 1); + add_assoc_string(return_value, "wrapper_type", (char *)stream->wrapper->wops->label); } - add_assoc_string(return_value, "stream_type", (char *)stream->ops->label, 1); + add_assoc_string(return_value, "stream_type", (char *)stream->ops->label); - add_assoc_string(return_value, "mode", stream->mode, 1); + add_assoc_string(return_value, "mode", stream->mode); #if 0 /* TODO: needs updating for new filter API */ if (stream->filterhead) { @@ -515,7 +515,7 @@ PHP_FUNCTION(stream_get_meta_data) array_init(newval); for (filter = stream->filterhead; filter != NULL; filter = filter->next) { - add_next_index_string(newval, (char *)filter->fops->label, 1); + add_next_index_string(newval, (char *)filter->fops->label); } add_assoc_zval(return_value, "filters", newval); @@ -526,7 +526,7 @@ PHP_FUNCTION(stream_get_meta_data) add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); if (stream->orig_path) { - add_assoc_string(return_value, "uri", stream->orig_path, 1); + add_assoc_string(return_value, "uri", stream->orig_path); } if (!php_stream_populate_meta_data(stream, return_value)) { diff --git a/ext/standard/string.c b/ext/standard/string.c index 463d2b2a73..19a3fda93b 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1017,16 +1017,16 @@ PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit) p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); if (p2 == NULL) { - add_next_index_stringl(return_value, p1, Z_STRLEN_P(str), 1); + add_next_index_stringl(return_value, p1, Z_STRLEN_P(str)); } else { do { - add_next_index_stringl(return_value, p1, p2 - p1, 1); + add_next_index_stringl(return_value, p1, p2 - p1); p1 = p2 + Z_STRLEN_P(delim); } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL && --limit > 1); if (p1 <= endp) - add_next_index_stringl(return_value, p1, endp-p1, 1); + add_next_index_stringl(return_value, p1, endp-p1); } } /* }}} */ @@ -1066,9 +1066,7 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu /* limit is at least -1 therefore no need of bounds checking : i will be always less than found */ for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */ add_next_index_stringl(return_value, positions[i], - (positions[i+1] - Z_STRLEN_P(delim)) - positions[i], - 1 - ); + (positions[i+1] - Z_STRLEN_P(delim)) - positions[i]); } efree(positions); } @@ -1097,7 +1095,7 @@ PHP_FUNCTION(explode) if (str->len == 0) { if (limit >= 0) { - add_next_index_stringl(return_value, "", sizeof("") - 1, 1); + add_next_index_stringl(return_value, "", sizeof("") - 1); } return; } @@ -1109,7 +1107,7 @@ PHP_FUNCTION(explode) } else if (limit < 0) { php_explode_negative_limit(&zdelim, &zstr, return_value, limit); } else { - add_index_stringl(return_value, 0, str->val, str->len, 1); + add_index_stringl(return_value, 0, str->val, str->len); } } /* }}} */ @@ -1539,7 +1537,7 @@ PHP_FUNCTION(pathinfo) dirname = estrndup(path, path_len); php_dirname(dirname, path_len); if (*dirname) { - add_assoc_string(&tmp, "dirname", dirname, 1); + add_assoc_string(&tmp, "dirname", dirname); } efree(dirname); } @@ -1561,7 +1559,7 @@ PHP_FUNCTION(pathinfo) if (p) { idx = p - ret->val; - add_assoc_stringl(&tmp, "extension", ret->val + idx + 1, ret->len - idx - 1, 1); + add_assoc_stringl(&tmp, "extension", ret->val + idx + 1, ret->len - idx - 1); } } @@ -1577,7 +1575,7 @@ PHP_FUNCTION(pathinfo) p = zend_memrchr(ret->val, '.', ret->len); idx = p ? (p - ret->val) : ret->len; - add_assoc_stringl(&tmp, "filename", ret->val, idx, 1); + add_assoc_stringl(&tmp, "filename", ret->val, idx); } if (ret) { @@ -3953,8 +3951,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit if (Z_TYPE_P(subject_entry) != IS_ARRAY && Z_TYPE_P(subject_entry) != IS_OBJECT) { php_str_replace_in_subject(search, replace, subject_entry, &result, case_sensitivity, (argc > 3) ? &count : NULL TSRMLS_CC); } else { - Z_ADDREF_P(subject_entry); - COPY_PZVAL_TO_ZVAL(result, subject_entry); + ZVAL_COPY(&result, subject_entry); } /* Add to return array */ switch (zend_hash_get_current_key(Z_ARRVAL_P(subject), &string_key, @@ -5055,22 +5052,22 @@ PHP_FUNCTION(localeconv) add_index_long(&mon_grouping, i, currlocdata.mon_grouping[i]); } - add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point, 1); - add_assoc_string(return_value, "thousands_sep", currlocdata.thousands_sep, 1); - add_assoc_string(return_value, "int_curr_symbol", currlocdata.int_curr_symbol, 1); - add_assoc_string(return_value, "currency_symbol", currlocdata.currency_symbol, 1); - add_assoc_string(return_value, "mon_decimal_point", currlocdata.mon_decimal_point, 1); - add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep, 1); - add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign, 1); - add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign, 1); - add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits ); - add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits ); - add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes ); - add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space ); - add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes ); - add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space ); - add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn ); - add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn ); + add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point); + add_assoc_string(return_value, "thousands_sep", currlocdata.thousands_sep); + add_assoc_string(return_value, "int_curr_symbol", currlocdata.int_curr_symbol); + add_assoc_string(return_value, "currency_symbol", currlocdata.currency_symbol); + add_assoc_string(return_value, "mon_decimal_point", currlocdata.mon_decimal_point); + add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep); + add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign); + add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign); + add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits); + add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits); + add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes); + add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space); + add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes); + add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space); + add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn); + add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn); } #else /* Ok, it doesn't look like we have locale info floating around, so I guess it @@ -5079,22 +5076,22 @@ PHP_FUNCTION(localeconv) add_index_long(&grouping, 0, -1); add_index_long(&mon_grouping, 0, -1); - add_assoc_string(return_value, "decimal_point", "\x2E", 1); - add_assoc_string(return_value, "thousands_sep", "", 1); - add_assoc_string(return_value, "int_curr_symbol", "", 1); - add_assoc_string(return_value, "currency_symbol", "", 1); - add_assoc_string(return_value, "mon_decimal_point", "\x2E", 1); - add_assoc_string(return_value, "mon_thousands_sep", "", 1); - add_assoc_string(return_value, "positive_sign", "", 1); - add_assoc_string(return_value, "negative_sign", "", 1); - add_assoc_long( return_value, "int_frac_digits", CHAR_MAX ); - add_assoc_long( return_value, "frac_digits", CHAR_MAX ); - add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX ); - add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX ); - add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX ); - add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX ); - add_assoc_long( return_value, "p_sign_posn", CHAR_MAX ); - add_assoc_long( return_value, "n_sign_posn", CHAR_MAX ); + add_assoc_string(return_value, "decimal_point", "\x2E"); + add_assoc_string(return_value, "thousands_sep", ""); + add_assoc_string(return_value, "int_curr_symbol", ""); + add_assoc_string(return_value, "currency_symbol", ""); + add_assoc_string(return_value, "mon_decimal_point", "\x2E"); + add_assoc_string(return_value, "mon_thousands_sep", ""); + add_assoc_string(return_value, "positive_sign", ""); + add_assoc_string(return_value, "negative_sign", ""); + add_assoc_long( return_value, "int_frac_digits", CHAR_MAX); + add_assoc_long( return_value, "frac_digits", CHAR_MAX); + add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX); + add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX); + add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX); + add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX); + add_assoc_long( return_value, "p_sign_posn", CHAR_MAX); + add_assoc_long( return_value, "n_sign_posn", CHAR_MAX); #endif zend_hash_str_update(Z_ARRVAL_P(return_value), "grouping", sizeof("grouping")-1, &grouping); @@ -5408,10 +5405,10 @@ PHP_FUNCTION(str_word_count) switch (type) { case 1: - add_next_index_stringl(return_value, s, p - s, 1); + add_next_index_stringl(return_value, s, p - s); break; case 2: - add_index_stringl(return_value, (s - str), s, p - s, 1); + add_index_stringl(return_value, (s - str), s, p - s); break; default: word_count++; @@ -5491,7 +5488,7 @@ PHP_FUNCTION(str_split) array_init_size(return_value, ((str_len - 1) / split_length) + 1); if (split_length >= str_len) { - add_next_index_stringl(return_value, str, str_len, 1); + add_next_index_stringl(return_value, str, str_len); return; } @@ -5499,12 +5496,12 @@ PHP_FUNCTION(str_split) p = str; while (n_reg_segments-- > 0) { - add_next_index_stringl(return_value, p, split_length, 1); + add_next_index_stringl(return_value, p, split_length); p += split_length; } if (p != (str + str_len)) { - add_next_index_stringl(return_value, p, (str + str_len - p), 1); + add_next_index_stringl(return_value, p, (str + str_len - p)); } } /* }}} */ diff --git a/ext/standard/type.c b/ext/standard/type.c index 6ad6d33ab0..69e3305ea9 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -98,7 +98,7 @@ PHP_FUNCTION(settype) return; } - ZVAL_DEREF_REF(var); + ZVAL_DEREF(var); if (!strcasecmp(type, "integer")) { convert_to_long(var); } else if (!strcasecmp(type, "int")) { diff --git a/ext/standard/url.c b/ext/standard/url.c index 3ce1c568ed..fc49dc3264 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -427,21 +427,21 @@ PHP_FUNCTION(parse_url) /* add the various elements to the array */ if (resource->scheme != NULL) - add_assoc_string(return_value, "scheme", resource->scheme, 1); + add_assoc_string(return_value, "scheme", resource->scheme); if (resource->host != NULL) - add_assoc_string(return_value, "host", resource->host, 1); + add_assoc_string(return_value, "host", resource->host); if (resource->port != 0) add_assoc_long(return_value, "port", resource->port); if (resource->user != NULL) - add_assoc_string(return_value, "user", resource->user, 1); + add_assoc_string(return_value, "user", resource->user); if (resource->pass != NULL) - add_assoc_string(return_value, "pass", resource->pass, 1); + add_assoc_string(return_value, "pass", resource->pass); if (resource->path != NULL) - add_assoc_string(return_value, "path", resource->path, 1); + add_assoc_string(return_value, "path", resource->path); if (resource->query != NULL) - add_assoc_string(return_value, "query", resource->query, 1); + add_assoc_string(return_value, "query", resource->query); if (resource->fragment != NULL) - add_assoc_string(return_value, "fragment", resource->fragment, 1); + add_assoc_string(return_value, "fragment", resource->fragment); done: php_url_free(resource); } @@ -748,10 +748,10 @@ no_name_header: } if ((prev_val = zend_hash_str_find(HASH_OF(return_value), Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr)))) == NULL) { - add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr))), 1); + add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ convert_to_array(prev_val); - add_next_index_stringl(prev_val, s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr))), 1); + add_next_index_stringl(prev_val, s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); } *p = c; diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 00702f0fb9..44b96e3bdd 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -338,7 +338,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername, //??? Z_SET_ISREF_P(obj); /* filtername */ - add_property_string(&obj, "filtername", (char*)filtername, 1); + add_property_string(&obj, "filtername", (char*)filtername); /* and the parameters, if any */ if (filterparams) { @@ -419,7 +419,7 @@ PHP_FUNCTION(stream_bucket_make_writeable) add_property_zval(return_value, "bucket", &zbucket); /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); - add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1); + add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); add_property_long(return_value, "datalen", bucket->buflen); } } @@ -520,7 +520,7 @@ PHP_FUNCTION(stream_bucket_new) add_property_zval(return_value, "bucket", &zbucket); /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); - add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1); + add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); add_property_long(return_value, "datalen", bucket->buflen); } /* }}} */ diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index 73db73e984..d1c7267454 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -2001,11 +2001,11 @@ PHP_FUNCTION(sybase_fetch_field) object_init(return_value); - add_property_string(return_value, "name", result->fields[field_offset].name, 1); + add_property_string(return_value, "name", result->fields[field_offset].name); 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_string(return_value, "column_source", result->fields[field_offset].column_source); add_property_long(return_value, "numeric", result->fields[field_offset].numeric); - add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset])), 1); + add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 86415295d7..b214467632 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -890,7 +890,7 @@ static void tidy_add_default_properties(PHPTidyObj *obj, tidy_obj_type type TSRM name = (char *)tidyAttrName(tempattr); val = (char *)tidyAttrValue(tempattr); if (name && val) { - add_assoc_string(attribute, name, val, TRUE); + add_assoc_string(attribute, name, val); } } while((tempattr = tidyAttrNext(tempattr))); } else { @@ -1425,7 +1425,9 @@ static PHP_FUNCTION(tidy_get_config) opt_value = php_tidy_get_opt_val(obj->ptdoc, opt, &optt TSRMLS_CC); switch (optt) { case TidyString: - add_assoc_string(return_value, opt_name, (char*)opt_value, 0); + // TODO: avoid reallocation ??? + add_assoc_string(return_value, opt_name, (char*)opt_value); + efree(opt_value); break; case TidyInteger: diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index a9830910af..1a5411ca27 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -138,11 +138,11 @@ static void tokenize(zval *return_value TSRMLS_DC) CG(increment_lineno) = 0; } } - add_next_index_stringl(&keyword, (char *)zendtext, zendleng, 1); + add_next_index_stringl(&keyword, (char *)zendtext, zendleng); add_next_index_long(&keyword, token_line); add_next_index_zval(return_value, &keyword); } else { - add_next_index_stringl(return_value, (char *)zendtext, zendleng, 1); + add_next_index_stringl(return_value, (char *)zendtext, zendleng); } if (destroy && Z_TYPE(token) != IS_NULL) { zval_dtor(&token); @@ -159,7 +159,7 @@ static void tokenize(zval *return_value TSRMLS_DC) if (zendcursor != zendlimit) { array_init(&keyword); add_next_index_long(&keyword, T_INLINE_HTML); - add_next_index_stringl(&keyword, (char *)zendcursor, zendlimit - zendcursor, 1); + add_next_index_stringl(&keyword, (char *)zendcursor, zendlimit - zendcursor); add_next_index_long(&keyword, token_line); add_next_index_zval(return_value, &keyword); } diff --git a/ext/xml/xml.c b/ext/xml/xml.c index a881d910b4..845cde426e 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -792,7 +792,9 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch att = _xml_decode_tag(parser, attributes[0]); val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); - add_assoc_stringl(args[2], att, val, val_len, 0); + // TODO: avoid reallocation ??? + add_assoc_stringl(args[2], att, val, val_len); + efree(val); attributes += 2; @@ -817,8 +819,8 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch _xml_add_to_info(parser,((char *) tag_name) + parser->toffset); - add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */ - add_assoc_string(tag,"type","open",1); + add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset); /* cast to avoid gcc-warning */ + add_assoc_string(tag,"type","open"); add_assoc_long(tag,"level",parser->level); parser->ltags[parser->level-1] = estrdup(tag_name); @@ -830,7 +832,9 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch att = _xml_decode_tag(parser, attributes[0]); val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); - add_assoc_stringl(atr,att,val,val_len,0); + // TODO: avoid reallocation ??? + add_assoc_stringl(atr,att,val,val_len); + efree(val); atcnt++; attributes += 2; @@ -880,7 +884,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) zval *tag; if (parser->lastwasopen) { - add_assoc_string(*(parser->ctag),"type","complete",1); + add_assoc_string(*(parser->ctag),"type","complete"); } else { MAKE_STD_ZVAL(tag); @@ -888,8 +892,8 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) _xml_add_to_info(parser,((char *) tag_name) + parser->toffset); - add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */ - add_assoc_string(tag,"type","close",1); + add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset); /* cast to avoid gcc-warning */ + add_assoc_string(tag,"type","close"); add_assoc_long(tag,"level",parser->level); zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); @@ -959,7 +963,9 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) Z_STRLEN_PP(myval) += decoded_len; efree(decoded_value); } else { - add_assoc_string(*(parser->ctag),"value",decoded_value,0); + // TODO: avoid reallocation ??? + add_assoc_string(*(parser->ctag),"value",decoded_value); + efree(decoded_value); } } else { @@ -991,9 +997,11 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset); - add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset,1); - add_assoc_string(tag,"value",decoded_value,0); - add_assoc_string(tag,"type","cdata",1); + add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset); + // TODO: avoid reallocation ??? + add_assoc_string(tag,"value",decoded_value); + efree(decoded_value); + add_assoc_string(tag,"type","cdata"); add_assoc_long(tag,"level",parser->level); zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 799b47b3ef..930b9e151b 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -326,14 +326,14 @@ static int add_double(zval* list, char* id, double num) { else return add_next_index_double(list, num); } -static int add_string(zval* list, char* id, char* string, int duplicate) { - if(id) return add_assoc_string(list, id, string, duplicate); - else return add_next_index_string(list, string, duplicate); +static int add_string(zval* list, char* id, char* string) { + if(id) return add_assoc_string(list, id, string); + else return add_next_index_string(list, string); } -static int add_stringl(zval* list, char* id, char* string, uint length, int duplicate) { - if(id) return add_assoc_stringl(list, id, string, length, duplicate); - else return add_next_index_stringl(list, string, length, duplicate); +static int add_stringl(zval* list, char* id, char* string, uint length) { + if(id) return add_assoc_stringl(list, id, string, length); + else return add_next_index_stringl(list, string, length); } #endif diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 67c90f501f..699475d1f2 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -794,7 +794,8 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) ALLOC_ZVAL(new_string); Z_ADDREF_PP(entry); - COPY_PZVAL_TO_ZVAL(*new_string, *entry); + ZVAL_COPY_VALUE(new_string, *entry); +//??? COPY_PZVAL_TO_ZVAL(*new_string, *entry); zend_hash_update(intern->parameter, string_key, string_key_len, &new_string, sizeof(zval*), NULL); zend_hash_move_forward(Z_ARRVAL_P(array_value)); diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 4b59a68055..e2ddf53bb8 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -437,7 +437,7 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, #define RETURN_SB(sb) \ { \ array_init(return_value); \ - add_ascii_assoc_string(return_value, "name", (char *)(sb)->name, 1); \ + add_ascii_assoc_string(return_value, "name", (char *)(sb)->name); \ add_ascii_assoc_long(return_value, "index", (long) (sb)->index); \ add_ascii_assoc_long(return_value, "crc", (long) (sb)->crc); \ add_ascii_assoc_long(return_value, "size", (long) (sb)->size); \ @@ -620,7 +620,7 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value continue; } } - add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); + add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip); } globfree(&globbuf); @@ -722,7 +722,7 @@ int php_zip_pcre(char *regexp, int regexp_len, char *path, int path_len, zval *r continue; } - add_next_index_string(return_value, fullpath, 1); + add_next_index_string(return_value, fullpath); efree(namelist[i]); } efree(namelist); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 705fb5dd5f..3753f98a67 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -564,7 +564,7 @@ static PHP_FUNCTION(gzfile) memset(buf, 0, sizeof(buf)); while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) { - add_index_string(return_value, i++, buf, 1); + add_index_string(return_value, i++, buf); } php_stream_close(stream); } |