Skip to content

Commit f7eff9c

Browse files
committed
Make message and format arguments const char * to avoid
build warning about invalid cast.
1 parent a92a350 commit f7eff9c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Zend/zend_exceptions.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ ZEND_METHOD(exception, getPrevious)
560560
RETURN_ZVAL(previous, 1, 0);
561561
}
562562

563-
int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */
563+
int zend_spprintf(char **message, int max_len, const char *format, ...) /* {{{ */
564564
{
565565
va_list arg;
566566
int len;
@@ -732,7 +732,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
732732
}
733733
/* }}} */
734734

735-
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC) /* {{{ */
735+
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
736736
{
737737
zval *ex;
738738

@@ -760,7 +760,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *messa
760760
}
761761
/* }}} */
762762

763-
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...) /* {{{ */
763+
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
764764
{
765765
va_list arg;
766766
char *message;
@@ -775,7 +775,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod
775775
}
776776
/* }}} */
777777

778-
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) /* {{{ */
778+
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
779779
{
780780
zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
781781
zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);

Zend/zend_exceptions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ ZEND_API void zend_register_default_classes(TSRMLS_D);
4040

4141
/* exception_ce NULL or zend_exception_get_default() or a derived class
4242
* message NULL or the message of the exception */
43-
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC);
44-
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...);
43+
ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC);
44+
ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...);
4545
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
4646
ZEND_API void zend_clear_exception(TSRMLS_D);
4747

48-
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC);
48+
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC);
4949

5050
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
5151

5252
/* show an exception using zend_error(severity,...), severity should be E_ERROR */
5353
ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC);
5454

5555
/* do not export, in php it's available thru spprintf directly */
56-
int zend_spprintf(char **message, int max_len, char *format, ...);
56+
int zend_spprintf(char **message, int max_len, const char *format, ...);
5757

5858
END_EXTERN_C()
5959

0 commit comments

Comments
 (0)