Skip to content

Commit dc29937

Browse files
committed
Merge pull request #5 from weltling/string_size_refactor_take_2
String size refactor take 2, partial fixes to ext/standard
2 parents 221b9d4 + 91ceb29 commit dc29937

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+317
-166
lines changed

Zend/zend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
10981098
if(DTRACE_ERROR_ENABLED()) {
10991099
char *dtrace_error_buffer;
11001100
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
1101-
DTRACE_ERROR(dtrace_error_buffer, error_filename, error_lineno);
1101+
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
11021102
efree(dtrace_error_buffer);
11031103
}
11041104
#endif /* HAVE_DTRACE */

Zend/zend_dtrace.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#ifdef HAVE_DTRACE
2626
/* PHP DTrace probes {{{ */
27-
static inline char *dtrace_get_executed_filename(TSRMLS_D)
27+
static inline const char *dtrace_get_executed_filename(TSRMLS_D)
2828
{
2929
if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
3030
return EG(current_execute_data)->op_array->filename;
@@ -36,9 +36,9 @@ static inline char *dtrace_get_executed_filename(TSRMLS_D)
3636
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
3737
{
3838
zend_op_array *res;
39-
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, file_handle->filename);
39+
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, (char *)file_handle->filename);
4040
res = compile_file(file_handle, type TSRMLS_CC);
41-
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, file_handle->filename);
41+
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, (char *)file_handle->filename);
4242

4343
return res;
4444
}
@@ -47,7 +47,7 @@ ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int t
4747
ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
4848
{
4949
int lineno;
50-
char *scope, *filename, *funcname, *classname;
50+
const char *scope, *filename, *funcname, *classname;
5151
scope = filename = funcname = classname = NULL;
5252

5353
/* we need filename and lineno for both execute and function probes */
@@ -65,41 +65,41 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
6565
}
6666

6767
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
68-
DTRACE_EXECUTE_ENTRY(filename, lineno);
68+
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
6969
}
7070

7171
if (DTRACE_FUNCTION_ENTRY_ENABLED() && funcname != NULL) {
72-
DTRACE_FUNCTION_ENTRY(funcname, filename, lineno, classname, scope);
72+
DTRACE_FUNCTION_ENTRY((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
7373
}
7474

7575
execute_ex(execute_data TSRMLS_CC);
7676

7777
if (DTRACE_FUNCTION_RETURN_ENABLED() && funcname != NULL) {
78-
DTRACE_FUNCTION_RETURN(funcname, filename, lineno, classname, scope);
78+
DTRACE_FUNCTION_RETURN((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
7979
}
8080

8181
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
82-
DTRACE_EXECUTE_RETURN(filename, lineno);
82+
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
8383
}
8484
}
8585

8686
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC)
8787
{
8888
int lineno;
89-
char *filename;
89+
const char *filename;
9090
if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
9191
filename = dtrace_get_executed_filename(TSRMLS_C);
9292
lineno = zend_get_executed_lineno(TSRMLS_C);
9393
}
9494

9595
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
96-
DTRACE_EXECUTE_ENTRY(filename, lineno);
96+
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
9797
}
9898

9999
execute_internal(execute_data_ptr, fci, return_value_used TSRMLS_CC);
100100

101101
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
102-
DTRACE_EXECUTE_RETURN(filename, lineno);
102+
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
103103
}
104104
}
105105

Zend/zend_exceptions.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
8585
{
8686
#ifdef HAVE_DTRACE
8787
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
88-
char *classname;
89-
zend_str_size name_len;
88+
const char *classname;
89+
zend_str_size_uint name_len;
9090

9191
if (exception != NULL) {
9292
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
93-
DTRACE_EXCEPTION_THROWN(classname);
93+
DTRACE_EXCEPTION_THROWN((char *)classname);
9494
} else {
9595
DTRACE_EXCEPTION_THROWN(NULL);
9696
}

Zend/zend_operators.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static inline zend_uchar is_numeric_string(const char *str, zend_str_size_int le
269269
return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
270270
}
271271

272-
static inline char *
272+
static inline const char *
273273
zend_memnstr(const char *haystack, const char *needle, zend_str_size_int needle_len, char *end)
274274
{
275275
const char *p = haystack;

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3015,7 +3015,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
30153015

30163016
#ifdef HAVE_DTRACE
30173017
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
3018-
DTRACE_EXCEPTION_CAUGHT(ce->name);
3018+
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
30193019
}
30203020
#endif /* HAVE_DTRACE */
30213021

Zend/zend_vm_execute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7127,7 +7127,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
71277127

71287128
#ifdef HAVE_DTRACE
71297129
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
7130-
DTRACE_EXCEPTION_CAUGHT(ce->name);
7130+
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
71317131
}
71327132
#endif /* HAVE_DTRACE */
71337133

ext/date/php_date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
10411041
static char *date_format(char *format, zend_str_size_int format_len, timelib_time *t, int localtime)
10421042
{
10431043
smart_str string = {0};
1044-
zend_str_size i, length;
1044+
zend_str_size_int i, length = 0;
10451045
char buffer[97];
10461046
timelib_time_offset *offset = NULL;
10471047
timelib_sll isoweek, isoyear;
@@ -2539,8 +2539,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
25392539
timelib_time *now;
25402540
timelib_tzinfo *tzi = NULL;
25412541
timelib_error_container *err = NULL;
2542-
int type = TIMELIB_ZONETYPE_ID, new_dst;
2543-
char *new_abbr;
2542+
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
2543+
char *new_abbr = NULL;
25442544
timelib_sll new_offset;
25452545

25462546
if (dateobj->time) {

ext/dom/xpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const zend_function_entry php_dom_xpath_class_functions[] = {
7474

7575
static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
7676
{
77-
zval **args;
77+
zval **args = NULL;
7878
zval *retval;
7979
int result, i, ret;
8080
int error = 0;

ext/gd/gd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
24422442
fflush(fp);
24432443
}
24442444

2445-
register_im:
2445+
/* register_im: */
24462446
if (im) {
24472447
ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
24482448
php_stream_close(stream);

ext/gd/libgd/gd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3011,7 +3011,6 @@ void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P)
30113011
int gdImagePaletteToTrueColor(gdImagePtr src)
30123012
{
30133013
unsigned int y;
3014-
unsigned char alloc_y = 0;
30153014
unsigned int yy;
30163015

30173016
if (src == NULL) {

0 commit comments

Comments
 (0)