]> granicus.if.org Git - php/commitdiff
Move constants into read-only data segment
authorDmitry Stogov <dmitry@zend.com>
Thu, 14 Dec 2017 19:14:36 +0000 (22:14 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 14 Dec 2017 19:14:36 +0000 (22:14 +0300)
64 files changed:
Zend/zend_constants.c
ext/bz2/bz2.c
ext/bz2/bz2_filter.c
ext/bz2/php_bz2.h
ext/calendar/calendar.c
ext/calendar/dow.c
ext/calendar/french.c
ext/calendar/gregor.c
ext/calendar/jewish.c
ext/calendar/sdncal.h
ext/date/php_date.c
ext/iconv/iconv.c
ext/mbstring/mbstring.c
ext/opcache/zend_accelerator_util_funcs.c
ext/openssl/xp_ssl.c
ext/pdo_oci/oci_statement.c
ext/pdo_pgsql/pgsql_driver.c
ext/pdo_pgsql/php_pdo_pgsql_int.h
ext/pgsql/php_pgsql.h
ext/phar/dirstream.c
ext/phar/stream.c
ext/session/mod_files.c
ext/session/mod_files.h
ext/session/mod_mm.c
ext/session/mod_mm.h
ext/session/mod_user.c
ext/session/mod_user.h
ext/session/php_session.h
ext/session/session.c
ext/sqlite3/sqlite3.c
ext/standard/datetime.c
ext/standard/filters.c
ext/standard/formatted_print.c
ext/standard/ftp_fopen_wrapper.c
ext/standard/http_fopen_wrapper.c
ext/standard/metaphone.c
ext/standard/php_fopen_wrapper.c
ext/standard/php_string.h
ext/standard/string.c
ext/standard/user_filters.c
ext/xml/xml.c
ext/zip/zip_stream.c
ext/zlib/php_zlib.h
ext/zlib/zlib_filter.c
ext/zlib/zlib_fopen_wrapper.c
main/SAPI.c
main/SAPI.h
main/php_content_types.c
main/php_memory_streams.h
main/php_network.h
main/php_streams.h
main/snprintf.c
main/streams/filter.c
main/streams/glob_wrapper.c
main/streams/memory.c
main/streams/php_stream_filter_api.h
main/streams/php_stream_glob_wrapper.h
main/streams/php_stream_userspace.h
main/streams/plain_wrapper.c
main/streams/streams.c
main/streams/userspace.c
main/streams/xp_socket.c
sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg.h

index 3fa547bcf0f5b736a9ba1df60f923d9d06d55813..42bccda28f80f6579b8be1aa10bb7c7064d723a0 100644 (file)
@@ -203,7 +203,7 @@ ZEND_API void zend_register_string_constant(const char *name, size_t name_len, c
 static zend_constant *zend_get_special_constant(const char *name, size_t name_len)
 {
        zend_constant *c;
-       static char haltoff[] = "__COMPILER_HALT_OFFSET__";
+       static const char haltoff[] = "__COMPILER_HALT_OFFSET__";
 
        if (!EG(current_execute_data)) {
                return NULL;
index d8445d295fbc164f79d401bbccef15b4889a55ff..5250bf49d3acb0141dcf9559cc0a9f49108b82a9 100644 (file)
@@ -211,7 +211,7 @@ static int php_bz2iop_flush(php_stream *stream)
 }
 /* }}} */
 
-php_stream_ops php_stream_bz2io_ops = {
+const php_stream_ops php_stream_bz2io_ops = {
        php_bz2iop_write, php_bz2iop_read,
        php_bz2iop_close, php_bz2iop_flush,
        "BZip2",
@@ -317,7 +317,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
 
 /* }}} */
 
-static php_stream_wrapper_ops bzip2_stream_wops = {
+static const php_stream_wrapper_ops bzip2_stream_wops = {
        _php_stream_bz2open,
        NULL, /* close */
        NULL, /* fstat */
index 6446e29ad9eb63a876b840354125db21c0e68337..3dfe1b6352144aa0feded2cf6444c39f938f1ca3 100644 (file)
@@ -193,7 +193,7 @@ static void php_bz2_decompress_dtor(php_stream_filter *thisfilter)
        }
 }
 
-static php_stream_filter_ops php_bz2_decompress_ops = {
+static const php_stream_filter_ops php_bz2_decompress_ops = {
        php_bz2_decompress_filter,
        php_bz2_decompress_dtor,
        "bzip2.decompress"
@@ -297,7 +297,7 @@ static void php_bz2_compress_dtor(php_stream_filter *thisfilter)
        }
 }
 
-static php_stream_filter_ops php_bz2_compress_ops = {
+static const php_stream_filter_ops php_bz2_compress_ops = {
        php_bz2_compress_filter,
        php_bz2_compress_dtor,
        "bzip2.compress"
@@ -309,7 +309,7 @@ static php_stream_filter_ops php_bz2_compress_ops = {
 
 static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
 {
-       php_stream_filter_ops *fops = NULL;
+       const php_stream_filter_ops *fops = NULL;
        php_bz2_filter_data *data;
        int status = BZ_OK;
 
@@ -399,7 +399,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
        return php_stream_filter_alloc(fops, data, persistent);
 }
 
-php_stream_filter_factory php_bz2_filter_factory = {
+const php_stream_filter_factory php_bz2_filter_factory = {
        php_bz2_filter_create
 };
 /* }}} */
index e21f1f1c96ae0981da68271903b677ad47a04efa..ac04ba7ce23ee5ce4754151c06ee6b14409520eb 100644 (file)
@@ -56,8 +56,8 @@ PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, const char *
 #define php_stream_bz2open_from_BZFILE(bz, mode, innerstream)  _php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC)
 #define php_stream_bz2open(wrapper, path, mode, options, opened_path)  _php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC)
 
-extern php_stream_filter_factory php_bz2_filter_factory;
-extern php_stream_ops php_stream_bz2io_ops;
+extern const php_stream_filter_factory php_bz2_filter_factory;
+extern const php_stream_ops php_stream_bz2io_ops;
 #define PHP_STREAM_IS_BZIP2    &php_stream_bz2io_ops
 
 /* 400kb */
index a3097f45d8b8d28dfde719b2f847d29e1cab373e..faf17ccbf631e052bd32f45419b4a20c0bbf454f 100644 (file)
@@ -185,17 +185,17 @@ typedef void (*cal_from_jd_func_t) (zend_long jd, int *year, int *month, int *da
 typedef char *(*cal_as_string_func_t) (int year, int month, int day);
 
 struct cal_entry_t {
-       char *name;
-       char *symbol;
+       const char *name;
+       const char *symbol;
        cal_to_jd_func_t to_jd;
        cal_from_jd_func_t from_jd;
        int num_months;
        int max_days_in_month;
-       char **month_name_short;
-       char **month_name_long;
+       const char * const * month_name_short;
+       const char * const * month_name_long;
 };
 
-static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
+static const struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
        {"Gregorian", "CAL_GREGORIAN", GregorianToSdn, SdnToGregorian, 12, 31,
         MonthNameShort, MonthNameLong},
        {"Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31,
@@ -266,7 +266,7 @@ static void _php_cal_info(int cal, zval *ret)
 {
        zval months, smonths;
        int i;
-       struct cal_entry_t *calendar;
+       const struct cal_entry_t *calendar;
 
        calendar = &cal_conversion_table[cal];
        array_init(ret);
@@ -327,7 +327,7 @@ PHP_FUNCTION(cal_info)
 PHP_FUNCTION(cal_days_in_month)
 {
        zend_long cal, month, year;
-       struct cal_entry_t *calendar;
+       const struct cal_entry_t *calendar;
        zend_long sdn_start, sdn_next;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &cal, &month, &year) == FAILURE) {
@@ -396,7 +396,7 @@ PHP_FUNCTION(cal_from_jd)
        zend_long jd, cal;
        int month, day, year, dow;
        char date[16];
-       struct cal_entry_t *calendar;
+       const struct cal_entry_t *calendar;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &jd, &cal) == FAILURE) {
                RETURN_FALSE;
@@ -695,7 +695,7 @@ PHP_FUNCTION(jddayofweek)
 {
        zend_long julday, mode = CAL_DOW_DAYNO;
        int day;
-       char *daynamel, *daynames;
+       const char *daynamel, *daynames;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &julday, &mode) == FAILURE) {
                RETURN_FALSE;
@@ -725,7 +725,7 @@ PHP_FUNCTION(jddayofweek)
 PHP_FUNCTION(jdmonthname)
 {
        zend_long julday, mode;
-       char *monthname = NULL;
+       const char *monthname = NULL;
        int month, day, year;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &julday, &mode) == FAILURE) {
index 44f0490ed1fa0861b79d3f0f87aa0ffaffa717bb..466fb3be926e6c3846f8328c92d9e9fbea2ffd2f 100644 (file)
@@ -44,7 +44,7 @@ int DayOfWeek(
        }
 }
 
-char *DayNameShort[7] =
+const char * const DayNameShort[7] =
 {
        "Sun",
        "Mon",
@@ -55,7 +55,7 @@ char *DayNameShort[7] =
        "Sat"
 };
 
-char *DayNameLong[7] =
+const char * const DayNameLong[7] =
 {
        "Sunday",
        "Monday",
index 4eb0e78021a4e921718d2f172017f61fa8c4ac38..3d52efec8abc180881be4e165efd77a4f6283ce5 100644 (file)
@@ -131,7 +131,7 @@ zend_long FrenchToSdn(
                        + FRENCH_SDN_OFFSET);
 }
 
-char *FrenchMonthName[14] =
+const char * const FrenchMonthName[14] =
 {
        "",
        "Vendemiaire",
index 4c91fa8d540084a6d262ff76798574b5066b037c..dab12e5187df527d8d46914b71ae0c7403fe9099 100644 (file)
@@ -235,7 +235,7 @@ zend_long GregorianToSdn(
                        - GREGOR_SDN_OFFSET);
 }
 
-char *MonthNameShort[13] =
+const char * const MonthNameShort[13] =
 {
        "",
        "Jan",
@@ -252,7 +252,7 @@ char *MonthNameShort[13] =
        "Dec"
 };
 
-char *MonthNameLong[13] =
+const char * const MonthNameLong[13] =
 {
        "",
        "January",
index 53421aa3060dbb630adde7b976de70816bc3c36f..c725ac95ed6a3479ff81ca21a1e629f4ae36749c 100644 (file)
 #define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204)
 #define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589)
 
-int monthsPerYear[19] =
+const int monthsPerYear[19] =
 {
 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13
 };
 
-static int yearOffset[19] =
+static const int yearOffset[19] =
 {
        0, 12, 24, 37, 49, 61, 74, 86, 99, 111, 123,
        136, 148, 160, 173, 185, 197, 210, 222
 };
 
 /* names for leap (13-month) year */
-char *JewishMonthNameLeap[14] =
+const char * const JewishMonthNameLeap[14] =
 {
        "", 
        "Tishri",
@@ -318,7 +318,7 @@ char *JewishMonthNameLeap[14] =
 };
 
 /* names for regular year */
-char *JewishMonthName[14] =
+const char * const JewishMonthName[14] =
 {
        "", 
        "Tishri",
@@ -337,7 +337,7 @@ char *JewishMonthName[14] =
 };
 
 /* names for leap (13-month) year */
-char *JewishMonthHebNameLeap[14] =
+const char * const JewishMonthHebNameLeap[14] =
 {
        "", 
        "úùøé",
@@ -356,7 +356,7 @@ char *JewishMonthHebNameLeap[14] =
 };
 
 /* names for regular year */
-char *JewishMonthHebName[14] =
+const char * const JewishMonthHebName[14] =
 {
        "", 
        "úùøé",
index c76fc0063b58445ad37ba8ba896558e3bfa98f1a..fa3aa7c641a9e947485fecb96bf8f44568bf4fb9 100644 (file)
@@ -70,8 +70,8 @@
 /* Gregorian calendar conversions. */
 void SdnToGregorian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
 zend_long GregorianToSdn(int year, int month, int day);
-extern char *MonthNameShort[13];
-extern char *MonthNameLong[13];
+extern const char * const MonthNameShort[13];
+extern const char * const MonthNameLong[13];
 
 /* Julian calendar conversions. */
 void SdnToJulian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
@@ -80,23 +80,23 @@ zend_long JulianToSdn(int year, int month, int day);
 /* Jewish calendar conversions. */
 void SdnToJewish(zend_long sdn, int *pYear, int *pMonth, int *pDay);
 zend_long JewishToSdn(int year, int month, int day);
-extern char *JewishMonthName[14];
-extern char *JewishMonthNameLeap[14];
-extern char *JewishMonthHebName[14];
-extern char *JewishMonthHebNameLeap[14];
-extern int monthsPerYear[19];
+extern const char * const JewishMonthName[14];
+extern const char * const JewishMonthNameLeap[14];
+extern const char * const JewishMonthHebName[14];
+extern const char * const JewishMonthHebNameLeap[14];
+extern const int monthsPerYear[19];
 
 /* French republic calendar conversions. */
 void SdnToFrench(zend_long sdn, int *pYear, int *pMonth, int *pDay);
 zend_long FrenchToSdn(int inputYear, int inputMonth, int inputDay);
-extern char *FrenchMonthName[14];
+extern const char * const FrenchMonthName[14];
 
 /* Islamic calendar conversions. */
 /* Not implemented yet. */
 
 /* Day of week conversion.  0=Sunday, 6=Saturday */
 int DayOfWeek(zend_long sdn);
-extern char *DayNameShort[7];
-extern char *DayNameLong[7];
+extern const char * const DayNameShort[7];
+extern const char * const DayNameLong[7];
 
 #endif /* SDNCAL_H */
index 3715e53ddbca31780aafc6046eb9ed8b7a43ba8a..77cad2d4156f6544eb779a48f2b4a3e679c459b8 100644 (file)
@@ -1041,21 +1041,21 @@ PHPAPI timelib_tzinfo *get_timezone_info(void)
 /* {{{ date() and gmdate() data */
 #include "zend_smart_str.h"
 
-static char *mon_full_names[] = {
+static const char * const mon_full_names[] = {
        "January", "February", "March", "April",
        "May", "June", "July", "August",
        "September", "October", "November", "December"
 };
 
-static char *mon_short_names[] = {
+static const char * const mon_short_names[] = {
        "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 };
 
-static char *day_full_names[] = {
+static const char * const day_full_names[] = {
        "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
 };
 
-static char *day_short_names[] = {
+static const char * const day_short_names[] = {
        "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
 };
 
@@ -1075,7 +1075,7 @@ static char *english_suffix(timelib_sll number)
 /* }}} */
 
 /* {{{ day of week helpers */
-char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
+static const char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
 {
        timelib_sll day_of_week = timelib_day_of_week(y, m, d);
        if (day_of_week < 0) {
@@ -1084,7 +1084,7 @@ char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
        return day_full_names[day_of_week];
 }
 
-char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
+static const char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
 {
        timelib_sll day_of_week = timelib_day_of_week(y, m, d);
        if (day_of_week < 0) {
index 7a5e846444d4029057ddf638572ffa0448a7a318..d2f6f3377e40959ed4e4da9f1c1da43a103664c9 100644 (file)
@@ -221,7 +221,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
 /* }}} */
 
 /* {{{ static globals */
-static char _generic_superset_name[] = ICONV_UCS4_ENCODING;
+static const char _generic_superset_name[] = ICONV_UCS4_ENCODING;
 #define GENERIC_SUPERSET_NAME _generic_superset_name
 #define GENERIC_SUPERSET_NBYTES 4
 /* }}} */
@@ -2828,7 +2828,7 @@ static void php_iconv_stream_filter_cleanup(php_stream_filter *filter)
 }
 /* }}} */
 
-static php_stream_filter_ops php_iconv_stream_filter_ops = {
+static const php_stream_filter_ops php_iconv_stream_filter_ops = {
        php_iconv_stream_filter_do_filter,
        php_iconv_stream_filter_cleanup,
        "convert.iconv.*"
@@ -2880,7 +2880,7 @@ static php_stream_filter *php_iconv_stream_filter_factory_create(const char *nam
 /* {{{ php_iconv_stream_register_factory */
 static php_iconv_err_t php_iconv_stream_filter_register_factory(void)
 {
-       static php_stream_filter_factory filter_factory = {
+       static const php_stream_filter_factory filter_factory = {
                php_iconv_stream_filter_factory_create
        };
 
index dbb6bf9373143aac349528bc5296f4b8f4694b09..086920846b6a43fdc971fa24ff2c47a1c0521c1c 100644 (file)
@@ -588,7 +588,7 @@ zend_module_entry mbstring_module_entry = {
 /* }}} */
 
 /* {{{ static sapi_post_entry php_post_entries[] */
-static sapi_post_entry php_post_entries[] = {
+static const sapi_post_entry php_post_entries[] = {
        { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
        { MULTIPART_CONTENT_TYPE,    sizeof(MULTIPART_CONTENT_TYPE)-1,    NULL,                         rfc1867_post_handler },
        { NULL, 0, NULL, NULL }
@@ -678,7 +678,7 @@ static mbfl_allocators _php_mb_allocators = {
 /* }}} */
 
 /* {{{ static sapi_post_entry mbstr_post_entries[] */
-static sapi_post_entry mbstr_post_entries[] = {
+static const sapi_post_entry mbstr_post_entries[] = {
        { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mb_post_handler },
        { MULTIPART_CONTENT_TYPE,    sizeof(MULTIPART_CONTENT_TYPE)-1,    NULL,                         rfc1867_post_handler },
        { NULL, 0, NULL, NULL }
index 8d4634d005ec22a50692a82768891d191c08963b..a83b3f8b55e3c78ce0c1d02de9737304c9a8b30f 100644 (file)
@@ -713,7 +713,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
                if (persistent_script->compiler_halt_offset != 0 &&
                    persistent_script->script.filename) {
                        zend_string *name;
-                       char haltoff[] = "__COMPILER_HALT_OFFSET__";
+                       static const char haltoff[] = "__COMPILER_HALT_OFFSET__";
 
                        name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, ZSTR_VAL(persistent_script->script.filename), ZSTR_LEN(persistent_script->script.filename), 0);
                        if (!zend_hash_exists(EG(zend_constants), name)) {
index 9f7773039fb891879ed857c94f56185f5127f1a4..d38540013618fe45458ee751d91646afb876ec7a 100644 (file)
@@ -106,7 +106,7 @@ static struct timeval php_openssl_subtract_timeval(struct timeval a, struct time
 static int php_openssl_compare_timeval(struct timeval a, struct timeval b);
 static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count);
 
-php_stream_ops php_openssl_socket_ops;
+const php_stream_ops php_openssl_socket_ops;
 
 /* Certificate contexts used for server-side SNI selection */
 typedef struct _php_openssl_sni_cert_t {
@@ -2539,7 +2539,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret)
 }
 /* }}} */
 
-php_stream_ops php_openssl_socket_ops = {
+const php_stream_ops php_openssl_socket_ops = {
        php_openssl_sockop_write, php_openssl_sockop_read,
        php_openssl_sockop_close, php_openssl_sockop_flush,
        "tcp_socket/ssl",
index 2d64e242aa15ace446b3b283d55894e5b97830fa..02c8df161cf111ca1129852bb3e5aa57f8e94d2b 100644 (file)
@@ -719,7 +719,7 @@ static int oci_blob_seek(php_stream *stream, zend_off_t offset, int whence, zend
        }
 }
 
-static php_stream_ops oci_blob_stream_ops = {
+static const php_stream_ops oci_blob_stream_ops = {
        oci_blob_write,
        oci_blob_read,
        oci_blob_close,
index 93e73e8b383f0b76957eab5bcd87b6c6e908418e..5cfe229bc157a85f48d7f59086c4d7446e1d2099 100644 (file)
@@ -176,7 +176,7 @@ static int pgsql_lob_seek(php_stream *stream, zend_off_t offset, int whence,
        return pos >= 0 ? 0 : -1;
 }
 
-php_stream_ops pdo_pgsql_lob_stream_ops = {
+const php_stream_ops pdo_pgsql_lob_stream_ops = {
        pgsql_lob_write,
        pgsql_lob_read,
        pgsql_lob_close,
index 916b35c6b660291c30677a1c4a12fa5e8c755bc7..8a0d96420eaac97f1246b0d38b067ed36b371a46 100644 (file)
@@ -109,7 +109,7 @@ enum pdo_pgsql_specific_constants {
 };
 
 php_stream *pdo_pgsql_create_lob_stream(zval *pdh, int lfd, Oid oid);
-extern php_stream_ops pdo_pgsql_lob_stream_ops;
+extern const php_stream_ops pdo_pgsql_lob_stream_ops;
 
 #endif /* PHP_PDO_PGSQL_INT_H */
 
index ea656dbc86e52bf964320c119d9edc10245b12f7..d65acdbf939e09e9581febefe685bb54531d0d93 100644 (file)
@@ -298,7 +298,7 @@ typedef struct _php_pgsql_notice {
        size_t len;
 } php_pgsql_notice;
 
-static php_stream_ops php_stream_pgsql_fd_ops = {
+static const php_stream_ops php_stream_pgsql_fd_ops = {
        php_pgsql_fd_write,
        php_pgsql_fd_read,
        php_pgsql_fd_close,
index 25374e9fa7a104085cf65f423ab15dc58c64fec0..a87997fbc600c6c56e2f5f9420bbcdc7da9be587 100644 (file)
@@ -25,7 +25,7 @@ BEGIN_EXTERN_C()
 void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, zend_bool is_dir);
 END_EXTERN_C()
 
-php_stream_ops phar_dir_ops = {
+const php_stream_ops phar_dir_ops = {
        phar_dir_write, /* write */
        phar_dir_read,  /* read  */
        phar_dir_close, /* close */
index 65eabd901b7ed6aa0de65e8d8b245df00c43704d..3ef49529c273288b1a3abc1d3a034b4863beaeb0 100644 (file)
@@ -22,7 +22,7 @@
 #include "stream.h"
 #include "dirstream.h"
 
-php_stream_ops phar_ops = {
+const php_stream_ops phar_ops = {
        phar_stream_write, /* write */
        phar_stream_read,  /* read */
        phar_stream_close, /* close */
@@ -34,7 +34,7 @@ php_stream_ops phar_ops = {
        NULL, /* set option */
 };
 
-php_stream_wrapper_ops phar_stream_wops = {
+const php_stream_wrapper_ops phar_stream_wops = {
        phar_wrapper_open_url,
        NULL,                  /* phar_wrapper_close */
        NULL,                  /* phar_wrapper_stat, */
index 38cc80236e2f34d998c85eef2b9b4fd71178d63c..6e86149de59175107a48556176258b4a32ca4fd1 100644 (file)
@@ -100,7 +100,7 @@ typedef struct {
        int fd;
 } ps_files;
 
-ps_module ps_mod_files = {
+const ps_module ps_mod_files = {
        /* New save handlers MUST use PS_MOD_UPDATE_TIMESTAMP macro */
        PS_MOD_UPDATE_TIMESTAMP(files)
 };
index 0813325601033989be222afbc8255acac1de02fe..474295caded424acac89966f7ad58d0a3420982d 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef MOD_FILES_H
 #define MOD_FILES_H
 
-extern ps_module ps_mod_files;
+extern const ps_module ps_mod_files;
 #define ps_files_ptr &ps_mod_files
 
 PS_FUNCS_UPDATE_TIMESTAMP(files);
index 2b54b3fad9ca6be8f2bab0c0e40df81add3b0243..f076adcbf98d6e3e9279d9cb4ef1632d42f0e815 100644 (file)
@@ -219,7 +219,7 @@ static int ps_mm_key_exists(ps_mm *data, const char *key)
        return FAILURE;
 }
 
-ps_module ps_mod_mm = {
+const ps_module ps_mod_mm = {
        PS_MOD_SID(mm)
 };
 
index 30f4bf8278df14370607ca0be402bcd32c999486..10d60942d652d985026d2d561d2dd1cb44492539 100644 (file)
@@ -28,7 +28,7 @@
 PHP_MINIT_FUNCTION(ps_mm);
 PHP_MSHUTDOWN_FUNCTION(ps_mm);
 
-extern ps_module ps_mod_mm;
+extern const ps_module ps_mod_mm;
 #define ps_mm_ptr &ps_mod_mm
 
 PS_FUNCS(mm);
index 2424049b19e4843a781f54f7d94fb592018c9ba3..b6337b9cde287eba154962829085fafea2f1bce5 100644 (file)
@@ -22,7 +22,7 @@
 #include "php_session.h"
 #include "mod_user.h"
 
-ps_module ps_mod_user = {
+const ps_module ps_mod_user = {
        PS_MOD_UPDATE_TIMESTAMP(user)
 };
 
index 474b3b64e04a523558a827f1f506fe83a971d170..2bcc03ef8f0871cd2d1ea3333672da78af379476 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef MOD_USER_H
 #define MOD_USER_H
 
-extern ps_module ps_mod_user;
+extern const ps_module ps_mod_user;
 #define ps_user_ptr &ps_mod_user
 
 PS_FUNCS_UPDATE_TIMESTAMP(user);
index 5e1e4f07736a7eb0c9f355341aca1703227dc50f..c9ab6ea7e0dcef4de3aecd13aa9e1cfd990ce9b1 100644 (file)
@@ -157,8 +157,8 @@ typedef struct _php_ps_globals {
        char *cookie_domain;
        zend_bool  cookie_secure;
        zend_bool  cookie_httponly;
-       ps_module *mod;
-       ps_module *default_mod;
+       const ps_module *mod;
+       const ps_module *default_mod;
        void *mod_data;
        php_session_status session_status;
        zend_long gc_probability;
@@ -260,7 +260,7 @@ PHPAPI void php_add_session_var(zend_string *name);
 PHPAPI zval *php_set_session_var(zend_string *name, zval *state_val, php_unserialize_data_t *var_hash);
 PHPAPI zval *php_get_session_var(zend_string *name);
 
-PHPAPI int php_session_register_module(ps_module *);
+PHPAPI int php_session_register_module(const ps_module *);
 
 PHPAPI int php_session_register_serializer(const char *name,
                zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS),
@@ -270,7 +270,7 @@ PHPAPI void php_session_set_id(char *id);
 PHPAPI int php_session_start(void);
 PHPAPI int php_session_flush(int write);
 
-PHPAPI ps_module *_php_find_ps_module(char *name);
+PHPAPI const ps_module *_php_find_ps_module(char *name);
 PHPAPI const ps_serializer *_php_find_ps_serializer(char *name);
 
 PHPAPI int php_session_valid_key(const char *key);
index fc666fc655a2a8ba70ab1f0c740e01376bd6acee..1477ef951ba863399865fdeed2d50567a056ae38 100644 (file)
@@ -533,7 +533,7 @@ static void php_session_normalize_vars() /* {{{ */
 
 static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
 {
-       ps_module *tmp;
+       const ps_module *tmp;
 
        SESSION_CHECK_ACTIVE_STATE;
        SESSION_CHECK_OUTPUT_STATE;
@@ -1059,12 +1059,12 @@ PHPAPI int php_session_register_serializer(const char *name, zend_string *(*enco
 #define MAX_MODULES 32
 #define PREDEFINED_MODULES 2
 
-static ps_module *ps_modules[MAX_MODULES + 1] = {
+static const ps_module *ps_modules[MAX_MODULES + 1] = {
        ps_files_ptr,
        ps_user_ptr
 };
 
-PHPAPI int php_session_register_module(ps_module *ptr) /* {{{ */
+PHPAPI int php_session_register_module(const ps_module *ptr) /* {{{ */
 {
        int ret = FAILURE;
        int i;
@@ -1208,7 +1208,7 @@ CACHE_LIMITER_FUNC(nocache) /* {{{ */
 }
 /* }}} */
 
-static php_session_cache_limiter_t php_session_cache_limiters[] = {
+static const php_session_cache_limiter_t php_session_cache_limiters[] = {
        CACHE_LIMITER_ENTRY(public)
        CACHE_LIMITER_ENTRY(private)
        CACHE_LIMITER_ENTRY(private_no_expire)
@@ -1218,7 +1218,7 @@ static php_session_cache_limiter_t php_session_cache_limiters[] = {
 
 static int php_session_cache_limiter(void) /* {{{ */
 {
-       php_session_cache_limiter_t *lim;
+       const php_session_cache_limiter_t *lim;
 
        if (PS(cache_limiter)[0] == '\0') return 0;
        if (PS(session_status) != php_session_active) return -1;
@@ -1374,10 +1374,10 @@ static int php_session_send_cookie(void) /* {{{ */
 }
 /* }}} */
 
-PHPAPI ps_module *_php_find_ps_module(char *name) /* {{{ */
+PHPAPI const ps_module *_php_find_ps_module(char *name) /* {{{ */
 {
-       ps_module *ret = NULL;
-       ps_module **mod;
+       const ps_module *ret = NULL;
+       const ps_module **mod;
        int i;
 
        for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++) {
@@ -2913,7 +2913,7 @@ static PHP_MSHUTDOWN_FUNCTION(session) /* {{{ */
 
 static PHP_MINFO_FUNCTION(session) /* {{{ */
 {
-       ps_module **mod;
+       const ps_module **mod;
        ps_serializer *ser;
        smart_str save_handlers = {0};
        smart_str ser_handlers = {0};
index f659445bbd1510a4417fbb70ce7808ab3dbb610c..edaf253c67251e5b358ab3e0cc9eccf4c2553137 100644 (file)
@@ -1205,7 +1205,7 @@ static int php_sqlite3_stream_stat(php_stream *stream, php_stream_statbuf *ssb)
        return 0;
 }
 
-static php_stream_ops php_stream_sqlite3_ops = {
+static const php_stream_ops php_stream_sqlite3_ops = {
        php_sqlite3_stream_write,
        php_sqlite3_stream_read,
        php_sqlite3_stream_close,
index 059d42bb58ad0180f2bae9bc64e185c9e1b00077..07ae1201b61f1bf452ea43a12b9805d632b8acbc 100644 (file)
 #endif
 #include <stdio.h>
 
-char *mon_full_names[] = {
+static const char * const mon_full_names[] = {
        "January", "February", "March", "April",
        "May", "June", "July", "August",
        "September", "October", "November", "December"
 };
 
-char *mon_short_names[] = {
+static const char * const mon_short_names[] = {
        "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 };
 
-char *day_full_names[] = {
+static const char * const day_full_names[] = {
        "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
 };
 
-char *day_short_names[] = {
+static const char * const day_short_names[] = {
        "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
 };
 
index 3a9daf293e2af7a95267bc1bdbd8fbfecc0f146c..15123db90e0ff93b48add48d12f153fecf2a527c 100644 (file)
@@ -30,8 +30,8 @@
 #include "zend_smart_str.h"
 
 /* {{{ rot13 stream filter implementation */
-static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
+static const char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static const char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
 
 static php_stream_filter_status_t strfilter_rot13_filter(
        php_stream *stream,
@@ -61,7 +61,7 @@ static php_stream_filter_status_t strfilter_rot13_filter(
        return PSFS_PASS_ON;
 }
 
-static php_stream_filter_ops strfilter_rot13_ops = {
+static const php_stream_filter_ops strfilter_rot13_ops = {
        strfilter_rot13_filter,
        NULL,
        "string.rot13"
@@ -72,14 +72,14 @@ static php_stream_filter *strfilter_rot13_create(const char *filtername, zval *f
        return php_stream_filter_alloc(&strfilter_rot13_ops, NULL, persistent);
 }
 
-static php_stream_filter_factory strfilter_rot13_factory = {
+static const php_stream_filter_factory strfilter_rot13_factory = {
        strfilter_rot13_create
 };
 /* }}} */
 
 /* {{{ string.toupper / string.tolower stream filter implementation */
-static char lowercase[] = "abcdefghijklmnopqrstuvwxyz";
-static char uppercase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static const char lowercase[] = "abcdefghijklmnopqrstuvwxyz";
+static const char uppercase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
 static php_stream_filter_status_t strfilter_toupper_filter(
        php_stream *stream,
@@ -137,13 +137,13 @@ static php_stream_filter_status_t strfilter_tolower_filter(
        return PSFS_PASS_ON;
 }
 
-static php_stream_filter_ops strfilter_toupper_ops = {
+static const php_stream_filter_ops strfilter_toupper_ops = {
        strfilter_toupper_filter,
        NULL,
        "string.toupper"
 };
 
-static php_stream_filter_ops strfilter_tolower_ops = {
+static const php_stream_filter_ops strfilter_tolower_ops = {
        strfilter_tolower_filter,
        NULL,
        "string.tolower"
@@ -159,11 +159,11 @@ static php_stream_filter *strfilter_tolower_create(const char *filtername, zval
        return php_stream_filter_alloc(&strfilter_tolower_ops, NULL, persistent);
 }
 
-static php_stream_filter_factory strfilter_toupper_factory = {
+static const php_stream_filter_factory strfilter_toupper_factory = {
        strfilter_toupper_create
 };
 
-static php_stream_filter_factory strfilter_tolower_factory = {
+static const php_stream_filter_factory strfilter_tolower_factory = {
        strfilter_tolower_create
 };
 /* }}} */
@@ -236,7 +236,7 @@ static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter)
        pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent);
 }
 
-static php_stream_filter_ops strfilter_strip_tags_ops = {
+static const php_stream_filter_ops strfilter_strip_tags_ops = {
        strfilter_strip_tags_filter,
        strfilter_strip_tags_dtor,
        "string.strip_tags"
@@ -278,7 +278,7 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv
        return php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent);
 }
 
-static php_stream_filter_factory strfilter_strip_tags_factory = {
+static const php_stream_filter_factory strfilter_strip_tags_factory = {
        strfilter_strip_tags_create
 };
 
@@ -1688,7 +1688,7 @@ static void strfilter_convert_dtor(php_stream_filter *thisfilter)
        pefree(Z_PTR(thisfilter->abstract), ((php_convert_filter *)Z_PTR(thisfilter->abstract))->persistent);
 }
 
-static php_stream_filter_ops strfilter_convert_ops = {
+static const php_stream_filter_ops strfilter_convert_ops = {
        strfilter_convert_filter,
        strfilter_convert_dtor,
        "convert.*"
@@ -1739,7 +1739,7 @@ out:
        return retval;
 }
 
-static php_stream_filter_factory strfilter_convert_factory = {
+static const php_stream_filter_factory strfilter_convert_factory = {
        strfilter_convert_create
 };
 /* }}} */
@@ -1791,7 +1791,7 @@ static void consumed_filter_dtor(php_stream_filter *thisfilter)
        }
 }
 
-static php_stream_filter_ops consumed_filter_ops = {
+static const php_stream_filter_ops consumed_filter_ops = {
        consumed_filter_filter,
        consumed_filter_dtor,
        "consumed"
@@ -1799,7 +1799,7 @@ static php_stream_filter_ops consumed_filter_ops = {
 
 static php_stream_filter *consumed_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
 {
-       php_stream_filter_ops *fops = NULL;
+       const php_stream_filter_ops *fops = NULL;
        php_consumed_filter_data *data;
 
        if (strcasecmp(filtername, "consumed")) {
@@ -1816,7 +1816,7 @@ static php_stream_filter *consumed_filter_create(const char *filtername, zval *f
        return php_stream_filter_alloc(fops, data, persistent);
 }
 
-php_stream_filter_factory consumed_filter_factory = {
+const const php_stream_filter_factory consumed_filter_factory = {
        consumed_filter_create
 };
 
@@ -1995,7 +1995,7 @@ static void php_chunked_dtor(php_stream_filter *thisfilter)
        }
 }
 
-static php_stream_filter_ops chunked_filter_ops = {
+static const php_stream_filter_ops chunked_filter_ops = {
        php_chunked_filter,
        php_chunked_dtor,
        "dechunk"
@@ -2003,7 +2003,7 @@ static php_stream_filter_ops chunked_filter_ops = {
 
 static php_stream_filter *chunked_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
 {
-       php_stream_filter_ops *fops = NULL;
+       const php_stream_filter_ops *fops = NULL;
        php_chunked_filter_data *data;
 
        if (strcasecmp(filtername, "dechunk")) {
@@ -2020,14 +2020,14 @@ static php_stream_filter *chunked_filter_create(const char *filtername, zval *fi
        return php_stream_filter_alloc(fops, data, persistent);
 }
 
-static php_stream_filter_factory chunked_filter_factory = {
+static const php_stream_filter_factory chunked_filter_factory = {
        chunked_filter_create
 };
 /* }}} */
 
 static const struct {
-       php_stream_filter_ops *ops;
-       php_stream_filter_factory *factory;
+       const php_stream_filter_ops *ops;
+       const php_stream_filter_factory *factory;
 } standard_filters[] = {
        { &strfilter_rot13_ops, &strfilter_rot13_factory },
        { &strfilter_toupper_ops, &strfilter_toupper_factory },
index 596a98045e62f1d9e851fb4f142cb366c5d333ca..2b49568e0425790f983be67702f77f152d652fbe 100644 (file)
@@ -52,8 +52,8 @@
 # define PRINTF_DEBUG(arg)
 #endif
 
-static char hexchars[] = "0123456789abcdef";
-static char HEXCHARS[] = "0123456789ABCDEF";
+static const char hexchars[] = "0123456789abcdef";
+static const char HEXCHARS[] = "0123456789ABCDEF";
 
 /* php_spintf_appendchar() {{{ */
 inline static void
@@ -309,7 +309,7 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
 inline static void
 php_sprintf_append2n(zend_string **buffer, size_t *pos, zend_long number,
                                         size_t width, char padding, size_t alignment, int n,
-                                        char *chartable, int expprec)
+                                        const char *chartable, int expprec)
 {
        char numbuf[NUM_BUF_SIZE];
        register zend_ulong num;
index dfa011c8911fcf3b2255705b361b05d4c418c6ec..f8491ccd059f09d662d75fce807cac9fb7a2d97a 100644 (file)
@@ -669,7 +669,7 @@ static int php_ftp_dirstream_close(php_stream *stream, int close_handle)
 
 /* ftp dirstreams only need to support read and close operations,
    They can't be rewound because the underlying ftp stream can't be rewound. */
-static php_stream_ops php_ftp_dirstream_ops = {
+static const php_stream_ops php_ftp_dirstream_ops = {
        NULL, /* write */
        php_ftp_dirstream_read, /* read */
        php_ftp_dirstream_close, /* close */
@@ -1170,7 +1170,7 @@ rmdir_errexit:
 }
 /* }}} */
 
-static php_stream_wrapper_ops ftp_stream_wops = {
+static const php_stream_wrapper_ops ftp_stream_wops = {
        php_stream_url_wrap_ftp,
        php_stream_ftp_stream_close, /* stream_close */
        php_stream_ftp_stream_stat,
index ae0e23ff1fbc5db72f8c2e341e1863f4979f00fd..c9cb03518d6ddcb505d78631923948e7ecc876bf 100644 (file)
@@ -1003,7 +1003,7 @@ static int php_stream_http_stream_stat(php_stream_wrapper *wrapper, php_stream *
 }
 /* }}} */
 
-static php_stream_wrapper_ops http_stream_wops = {
+static const php_stream_wrapper_ops http_stream_wops = {
        php_stream_url_wrap_http,
        NULL, /* stream_close */
        php_stream_http_stream_stat,
index c1b338942705c53424b0d492a90945220403fb1c..3ff933d3ff484587736c160a7de3e02dcff7c524 100644 (file)
@@ -78,7 +78,7 @@ PHP_FUNCTION(metaphone)
 /* Metachar.h ... little bits about characters for metaphone */
 /*-- Character encoding array & accessing macros --*/
 /* Stolen directly out of the book... */
-char _codes[26] =
+static const char _codes[26] =
 {
        1, 16, 4, 16, 9, 2, 4, 16, 9, 2, 0, 2, 2, 2, 1, 4, 0, 2, 4, 4, 1, 0, 0, 0, 8, 0
 /*  a  b c  d e f g  h i j k l m n o p q r s t u v w x y z */
index 613c21ac34f875fbd678936fd3cf1f462d5cd80c..9ac006b01ab4ab764795e216edf43069442bbea8 100644 (file)
@@ -52,7 +52,7 @@ static int php_stream_output_close(php_stream *stream, int close_handle) /* {{{
 }
 /* }}} */
 
-php_stream_ops php_stream_output_ops = {
+const php_stream_ops php_stream_output_ops = {
        php_stream_output_write,
        php_stream_output_read,
        php_stream_output_close,
@@ -137,7 +137,7 @@ static int php_stream_input_seek(php_stream *stream, zend_off_t offset, int when
 }
 /* }}} */
 
-php_stream_ops php_stream_input_ops = {
+const php_stream_ops php_stream_input_ops = {
        php_stream_input_write,
        php_stream_input_read,
        php_stream_input_close,
@@ -423,7 +423,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
 }
 /* }}} */
 
-static php_stream_wrapper_ops php_stdio_wops = {
+static const php_stream_wrapper_ops php_stdio_wops = {
        php_stream_url_wrap_php,
        NULL, /* close */
        NULL, /* fstat */
index d5d3e09f814ce0245775c9ca6a0bdf53bb3d7e76..7c6b10638de8584556d460e2a1321509721ec395 100644 (file)
@@ -124,7 +124,7 @@ PHPAPI char *php_strtoupper(char *s, size_t len);
 PHPAPI char *php_strtolower(char *s, size_t len);
 PHPAPI zend_string *php_string_toupper(zend_string *s);
 PHPAPI zend_string *php_string_tolower(zend_string *s);
-PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen);
+PHPAPI char *php_strtr(char *str, size_t len, const char *str_from, const char *str_to, size_t trlen);
 PHPAPI zend_string *php_addslashes(zend_string *str, int should_free);
 PHPAPI zend_string *php_addcslashes(zend_string *str, int freeit, char *what, size_t what_len);
 PHPAPI void php_stripslashes(zend_string *str);
index 2526dae144f590327320771228d897e1d6cc6ff3..1146f170c0958e889d77cefb7af89a2419c456a2 100644 (file)
@@ -2889,7 +2889,7 @@ PHP_FUNCTION(ucwords)
 
 /* {{{ php_strtr
  */
-PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen)
+PHPAPI char *php_strtr(char *str, size_t len, const char *str_from, const char *str_to, size_t trlen)
 {
        size_t i;
 
@@ -2924,7 +2924,7 @@ PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size
 
 /* {{{ php_strtr_ex
  */
-static zend_string *php_strtr_ex(zend_string *str, char *str_from, char *str_to, size_t trlen)
+static zend_string *php_strtr_ex(zend_string *str, const char *str_from, const char *str_to, size_t trlen)
 {
        zend_string *new_str = NULL;
        size_t i;
@@ -5443,8 +5443,8 @@ PHP_FUNCTION(sscanf)
 }
 /* }}} */
 
-static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
+static const char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static const char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
 
 /* {{{ proto string str_rot13(string str)
    Perform the rot13 transform on a string */
index 1f39464a97bb51515db8c6bd1a59a1f41e143179..7408113cf5cfc8cf0cdab02df7a2c631848749f8 100644 (file)
@@ -254,7 +254,7 @@ php_stream_filter_status_t userfilter_filter(
        return ret;
 }
 
-static php_stream_filter_ops userfilter_ops = {
+static const php_stream_filter_ops userfilter_ops = {
        userfilter_filter,
        userfilter_dtor,
        "user-filter"
@@ -380,7 +380,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
        return filter;
 }
 
-static php_stream_filter_factory user_filter_factory = {
+static const php_stream_filter_factory user_filter_factory = {
        user_filter_factory_create
 };
 
index bbfb7e20c1fba26af070cd61d2ef53d964f17582..4f753beb94fa8db4fdc611d8125189e1933ed441 100644 (file)
@@ -270,7 +270,7 @@ zend_module_entry xml_module_entry = {
 /* All the encoding functions are set to NULL right now, since all
  * the encoding is currently done internally by expat/xmltok.
  */
-xml_encoding xml_encodings[] = {
+const xml_encoding xml_encodings[] = {
        { (XML_Char *)"ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
        { (XML_Char *)"US-ASCII",   xml_decode_us_ascii,   xml_encode_us_ascii   },
        { (XML_Char *)"UTF-8",      NULL,                  NULL                  },
@@ -537,9 +537,9 @@ inline static char xml_decode_us_ascii(unsigned short c)
 /* }}} */
 
 /* {{{ xml_get_encoding() */
-static xml_encoding *xml_get_encoding(const XML_Char *name)
+static const xml_encoding *xml_get_encoding(const XML_Char *name)
 {
-       xml_encoding *enc = &xml_encodings[0];
+       const xml_encoding *enc = &xml_encodings[0];
 
        while (enc && enc->name) {
                if (strcasecmp((char *)name, (char *)enc->name) == 0) {
@@ -558,7 +558,7 @@ PHP_XML_API zend_string *xml_utf8_encode(const char *s, size_t len, const XML_Ch
        zend_string *str;
        unsigned int c;
        unsigned short (*encoder)(unsigned char) = NULL;
-       xml_encoding *enc = xml_get_encoding(encoding);
+       const xml_encoding *enc = xml_get_encoding(encoding);
 
        if (enc) {
                encoder = enc->encoding_function;
@@ -608,7 +608,7 @@ PHP_XML_API zend_string *xml_utf8_decode(const XML_Char *s, size_t len, const XM
        size_t pos = 0;
        unsigned int c;
        char (*decoder)(unsigned short) = NULL;
-       xml_encoding *enc = xml_get_encoding(encoding);
+       const xml_encoding *enc = xml_get_encoding(encoding);
        zend_string *str;
 
        if (enc) {
@@ -1602,7 +1602,7 @@ PHP_FUNCTION(xml_parser_set_option)
                        parser->skipwhite = zval_get_long(val);
                        break;
                case PHP_XML_OPTION_TARGET_ENCODING: {
-                       xml_encoding *enc;
+                       const xml_encoding *enc;
                        convert_to_string_ex(val);
                        enc = xml_get_encoding((XML_Char*)Z_STRVAL_P(val));
                        if (enc == NULL) {
index fca18540b12c4f140d6432c577e1c31bf0ebe08d..d4c9d9394b72fcf5833a639423537af3bf7c7457 100644 (file)
@@ -199,7 +199,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{
 }
 /* }}} */
 
-php_stream_ops php_stream_zipio_ops = {
+const php_stream_ops php_stream_zipio_ops = {
        php_zip_ops_write, php_zip_ops_read,
        php_zip_ops_close, php_zip_ops_flush,
        "zip",
@@ -348,7 +348,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
 }
 /* }}} */
 
-static php_stream_wrapper_ops zip_stream_wops = {
+static const php_stream_wrapper_ops zip_stream_wops = {
        php_stream_zip_opener,
        NULL,   /* close */
        NULL,   /* fstat */
index 01a08cc998c632e9bd6dfce86b8e72a6c195e886..cf79ccd9c189710e545a02fb67238797fba31c9f 100644 (file)
@@ -67,9 +67,9 @@ ZEND_END_MODULE_GLOBALS(zlib);
 #define ZLIBG(v) ZEND_MODULE_GLOBALS_ACCESSOR(zlib, v)
 
 php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
-extern php_stream_ops php_stream_gzio_ops;
+extern const php_stream_ops php_stream_gzio_ops;
 extern php_stream_wrapper php_stream_gzip_wrapper;
-extern php_stream_filter_factory php_zlib_filter_factory;
+extern const php_stream_filter_factory php_zlib_filter_factory;
 extern zend_module_entry php_zlib_module_entry;
 #define zlib_module_ptr &php_zlib_module_entry
 #define phpext_zlib_ptr zlib_module_ptr
index e321d1546af6825ed916298eebcd2420ebaa70ec..ad5b4772925389f1e6d587c7434601d8d4ceceb3 100644 (file)
@@ -167,7 +167,7 @@ static void php_zlib_inflate_dtor(php_stream_filter *thisfilter)
        }
 }
 
-static php_stream_filter_ops php_zlib_inflate_ops = {
+static const php_stream_filter_ops php_zlib_inflate_ops = {
        php_zlib_inflate_filter,
        php_zlib_inflate_dtor,
        "zlib.inflate"
@@ -276,7 +276,7 @@ static void php_zlib_deflate_dtor(php_stream_filter *thisfilter)
        }
 }
 
-static php_stream_filter_ops php_zlib_deflate_ops = {
+static const php_stream_filter_ops php_zlib_deflate_ops = {
        php_zlib_deflate_filter,
        php_zlib_deflate_dtor,
        "zlib.deflate"
@@ -288,7 +288,7 @@ static php_stream_filter_ops php_zlib_deflate_ops = {
 
 static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
 {
-       php_stream_filter_ops *fops = NULL;
+       const php_stream_filter_ops *fops = NULL;
        php_zlib_filter_data *data;
        int status;
 
@@ -421,7 +421,7 @@ factory_setlevel:
        return php_stream_filter_alloc(fops, data, persistent);
 }
 
-php_stream_filter_factory php_zlib_filter_factory = {
+const php_stream_filter_factory php_zlib_filter_factory = {
        php_zlib_filter_create
 };
 /* }}} */
index 60147999fe16d30cc18166eb5eea9ebe9b4f3a9d..aea7d2def2163f9188dca334aeb5956c65b8880a 100644 (file)
@@ -100,7 +100,7 @@ static int php_gziop_flush(php_stream *stream)
        return gzflush(self->gz_file, Z_SYNC_FLUSH);
 }
 
-php_stream_ops php_stream_gzio_ops = {
+const php_stream_ops php_stream_gzio_ops = {
        php_gziop_write, php_gziop_read,
        php_gziop_close, php_gziop_flush,
        "ZLIB",
@@ -167,7 +167,7 @@ php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, con
        return NULL;
 }
 
-static php_stream_wrapper_ops gzip_stream_wops = {
+static const php_stream_wrapper_ops gzip_stream_wops = {
        php_stream_gzopen,
        NULL, /* close */
        NULL, /* stat */
index ed5aac072c37dfebd064ba84d2053d4e55b69155..835bddab642bd275d1f08a07380b24c2dc394b80 100644 (file)
@@ -932,9 +932,9 @@ SAPI_API int sapi_send_headers(void)
 }
 
 
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries)
+SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
 {
-       sapi_post_entry *p=post_entries;
+       const sapi_post_entry *p=post_entries;
 
        while (p->content_type) {
                if (sapi_register_post_entry(p) == FAILURE) {
@@ -946,7 +946,7 @@ SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries)
 }
 
 
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry)
+SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry)
 {
        int ret;
        zend_string *key;
@@ -961,7 +961,7 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry)
        return ret;
 }
 
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry)
+SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry)
 {
        if (SG(sapi_started) && EG(current_execute_data)) {
                return;
index 1516702edfaf1c134c172d68823ea62437cfd576..e72f1bbb4e7c897583265e126ac9a802d37750d5 100644 (file)
@@ -190,9 +190,9 @@ SAPI_API int sapi_send_headers(void);
 SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
 SAPI_API void sapi_handle_post(void *arg);
 SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen);
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry);
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry);
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry);
+SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entry);
+SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry);
+SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry);
 SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void));
 SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
 SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));
index 37da97a395dc875848dd17c4288f6113ae1bba40..602061f4170aaf9518e15beff10add33c4a658bb 100644 (file)
@@ -26,7 +26,7 @@
 
 /* {{{ php_post_entries[]
  */
-static sapi_post_entry php_post_entries[] = {
+static const sapi_post_entry php_post_entries[] = {
        { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
        { MULTIPART_CONTENT_TYPE,    sizeof(MULTIPART_CONTENT_TYPE)-1,    NULL,                         rfc1867_post_handler },
        { NULL, 0, NULL, NULL }
index 271a9276e0f3b1b0eb6407aa6a4c97e91035abe4..b7f0ce8488418f065498abc0d381c8d8e178f6e7 100644 (file)
@@ -56,9 +56,9 @@ PHPAPI const char *_php_stream_mode_to_str(int mode);
 
 END_EXTERN_C()
 
-extern PHPAPI php_stream_ops php_stream_memory_ops;
-extern PHPAPI php_stream_ops php_stream_temp_ops;
-extern PHPAPI php_stream_ops php_stream_rfc2397_ops;
+extern PHPAPI const php_stream_ops php_stream_memory_ops;
+extern PHPAPI const php_stream_ops php_stream_temp_ops;
+extern PHPAPI const php_stream_ops php_stream_rfc2397_ops;
 extern PHPAPI php_stream_wrapper php_stream_rfc2397_wrapper;
 
 #define PHP_STREAM_IS_MEMORY &php_stream_memory_ops
index ee02fd19fd0571718b468fc7dcf96786ea5c06db..c5a297e2ecb271cd85751bd99ba2656d07cec8bb 100644 (file)
@@ -299,8 +299,8 @@ struct _php_netstream_data_t        {
        size_t ownsize;
 };
 typedef struct _php_netstream_data_t php_netstream_data_t;
-PHPAPI extern php_stream_ops php_stream_socket_ops;
-extern php_stream_ops php_stream_generic_socket_ops;
+PHPAPI extern const php_stream_ops php_stream_socket_ops;
+extern const php_stream_ops php_stream_generic_socket_ops;
 #define PHP_STREAM_IS_SOCKET   (&php_stream_socket_ops)
 
 BEGIN_EXTERN_C()
index c268295933896e38cba56b9969c315b786414cd2..ecc63cae429ea4710eccf782d5c633910807950c 100644 (file)
@@ -161,7 +161,7 @@ typedef struct _php_stream_wrapper_ops {
 } php_stream_wrapper_ops;
 
 struct _php_stream_wrapper     {
-       php_stream_wrapper_ops *wops;   /* operations the wrapper can perform */
+       const php_stream_wrapper_ops *wops;     /* operations the wrapper can perform */
        void *abstract;                                 /* context for the wrapper */
        int is_url;                                             /* so that PG(allow_url_fopen) can be respected */
 };
@@ -188,7 +188,7 @@ struct _php_stream_wrapper  {
 #define PHP_STREAM_FLAG_WAS_WRITTEN                                    0x80000000
 
 struct _php_stream  {
-       php_stream_ops *ops;
+       const php_stream_ops *ops;
        void *abstract;                 /* convenience pointer for abstraction */
 
        php_stream_filter_chain readfilters, writefilters;
@@ -246,7 +246,7 @@ struct _php_stream  {
 
 /* allocate a new stream for a particular ops */
 BEGIN_EXTERN_C()
-PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract,
+PHPAPI php_stream *_php_stream_alloc(const php_stream_ops *ops, void *abstract,
                const char *persistent_id, const char *mode STREAMS_DC);
 END_EXTERN_C()
 #define php_stream_alloc(ops, thisptr, persistent_id, mode)    _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC)
@@ -593,7 +593,7 @@ PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash_global(void);
 PHPAPI HashTable *_php_get_stream_filters_hash(void);
 #define php_get_stream_filters_hash()  _php_get_stream_filters_hash()
 PHPAPI HashTable *php_get_stream_filters_hash_global(void);
-extern php_stream_wrapper_ops *php_stream_user_wrapper_ops;
+extern const php_stream_wrapper_ops *php_stream_user_wrapper_ops;
 END_EXTERN_C()
 #endif
 
index a6788c7f79d09668beef146233330908280eae79..d71b732e3f35470d18cf8a7a948c714d100cd6a1 100644 (file)
@@ -487,9 +487,9 @@ PHPAPI char * ap_php_conv_p2(register u_wide_int num, register int nbits, char f
 {
        register int mask = (1 << nbits) - 1;
        register char *p = buf_end;
-       static char low_digits[] = "0123456789abcdef";
-       static char upper_digits[] = "0123456789ABCDEF";
-       register char *digits = (format == 'X') ? upper_digits : low_digits;
+       static const char low_digits[] = "0123456789abcdef";
+       static const char upper_digits[] = "0123456789ABCDEF";
+       register const char *digits = (format == 'X') ? upper_digits : low_digits;
 
        do {
                *--p = digits[num & mask];
index 16c99998f9b668593e0514f64869051a6af75eb9..a09b9104c9624971ef846c584b75c2e42dc49108 100644 (file)
@@ -44,11 +44,11 @@ PHPAPI HashTable *_php_get_stream_filters_hash(void)
 }
 
 /* API for registering GLOBAL filters */
-PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory)
+PHPAPI int php_stream_filter_register_factory(const char *filterpattern, const php_stream_filter_factory *factory)
 {
        int ret;
        zend_string *str = zend_string_init_interned(filterpattern, strlen(filterpattern), 1);
-       ret = zend_hash_add_ptr(&stream_filters_hash, str, factory) ? SUCCESS : FAILURE;
+       ret = zend_hash_add_ptr(&stream_filters_hash, str, (void*)factory) ? SUCCESS : FAILURE;
        zend_string_release(str);
        return ret;
 }
@@ -59,7 +59,7 @@ PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern)
 }
 
 /* API for registering VOLATILE wrappers */
-PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, php_stream_filter_factory *factory)
+PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, const php_stream_filter_factory *factory)
 {
        if (!FG(stream_filters)) {
                ALLOC_HASHTABLE(FG(stream_filters));
@@ -67,7 +67,7 @@ PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpatter
                zend_hash_copy(FG(stream_filters), &stream_filters_hash, NULL);
        }
 
-       return zend_hash_add_ptr(FG(stream_filters), filterpattern, factory) ? SUCCESS : FAILURE;
+       return zend_hash_add_ptr(FG(stream_filters), filterpattern, (void*)factory) ? SUCCESS : FAILURE;
 }
 
 /* Buckets */
@@ -224,7 +224,7 @@ PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket)
 PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
 {
        HashTable *filter_hash = (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash);
-       php_stream_filter_factory *factory = NULL;
+       const php_stream_filter_factory *factory = NULL;
        php_stream_filter *filter = NULL;
        size_t n;
        char *period;
@@ -264,7 +264,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
        return filter;
 }
 
-PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC)
+PHPAPI php_stream_filter *_php_stream_filter_alloc(const php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC)
 {
        php_stream_filter *filter;
 
index 13509628377f116364af8cead8998e6c0e4e281a..0b992a1a239e7c0d007a558cd1c294caa676d3f2 100644 (file)
@@ -195,7 +195,7 @@ static int php_glob_stream_rewind(php_stream *stream, zend_off_t offset, int whe
 }
 /* }}} */
 
-php_stream_ops  php_glob_stream_ops = {
+const php_stream_ops  php_glob_stream_ops = {
        NULL, php_glob_stream_read,
        php_glob_stream_close, NULL,
        "glob",
@@ -261,7 +261,7 @@ static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, const cha
 }
 /* }}} */
 
-static php_stream_wrapper_ops  php_glob_stream_wrapper_ops = {
+static const php_stream_wrapper_ops  php_glob_stream_wrapper_ops = {
        NULL,
        NULL,
        NULL,
index d6b0e5604b9847babb4c2d4d462e1e674467c80d..c1ef32f88bffdad68baef513eefecd778c24e768 100644 (file)
@@ -264,7 +264,7 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu
 }
 /* }}} */
 
-PHPAPI php_stream_ops  php_stream_memory_ops = {
+PHPAPI const php_stream_ops    php_stream_memory_ops = {
        php_stream_memory_write, php_stream_memory_read,
        php_stream_memory_close, php_stream_memory_flush,
        "MEMORY",
@@ -560,7 +560,7 @@ static int php_stream_temp_set_option(php_stream *stream, int option, int value,
 }
 /* }}} */
 
-PHPAPI php_stream_ops  php_stream_temp_ops = {
+PHPAPI const php_stream_ops    php_stream_temp_ops = {
        php_stream_temp_write, php_stream_temp_read,
        php_stream_temp_close, php_stream_temp_flush,
        "TEMP",
@@ -622,7 +622,7 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char
 }
 /* }}} */
 
-PHPAPI php_stream_ops php_stream_rfc2397_ops = {
+PHPAPI const php_stream_ops php_stream_rfc2397_ops = {
        php_stream_temp_write, php_stream_temp_read,
        php_stream_temp_close, php_stream_temp_flush,
        "RFC2397",
@@ -772,7 +772,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
        return stream;
 }
 
-PHPAPI php_stream_wrapper_ops php_stream_rfc2397_wops = {
+PHPAPI const php_stream_wrapper_ops php_stream_rfc2397_wops = {
        php_stream_url_wrap_rfc2397,
        NULL, /* close */
        NULL, /* fstat */
index ad9c541f1de4a7b26a91df628480f5c9d3612b0a..061f8720d95ebebb96f32c89831538360c894ab6 100644 (file)
@@ -106,7 +106,7 @@ typedef struct _php_stream_filter_chain {
 } php_stream_filter_chain;
 
 struct _php_stream_filter {
-       php_stream_filter_ops *fops;
+       const php_stream_filter_ops *fops;
        zval abstract; /* for use by filter implementation */
        php_stream_filter *next;
        php_stream_filter *prev;
@@ -131,7 +131,7 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea
 PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish);
 PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, int call_dtor);
 PHPAPI void php_stream_filter_free(php_stream_filter *filter);
-PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC);
+PHPAPI php_stream_filter *_php_stream_filter_alloc(const php_stream_filter_ops *fops, void *abstract, uint8_t persistent STREAMS_DC);
 END_EXTERN_C()
 #define php_stream_filter_alloc(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_CC)
 #define php_stream_filter_alloc_rel(fops, thisptr, persistent) _php_stream_filter_alloc((fops), (thisptr), (persistent) STREAMS_REL_CC)
@@ -146,9 +146,9 @@ typedef struct _php_stream_filter_factory {
 } php_stream_filter_factory;
 
 BEGIN_EXTERN_C()
-PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory);
+PHPAPI int php_stream_filter_register_factory(const char *filterpattern, const php_stream_filter_factory *factory);
 PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern);
-PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, php_stream_filter_factory *factory);
+PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpattern, const php_stream_filter_factory *factory);
 PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval *filterparams, uint8_t persistent);
 END_EXTERN_C()
 
index cf3492cf6fd880cee639854be1aee93457560470..1eb2d8b0ca26d70ff2c6449becca44f8a3fc23c6 100644 (file)
@@ -18,8 +18,8 @@
 
 /* $Id$ */
 
-PHPAPI extern php_stream_wrapper  php_glob_stream_wrapper;
-PHPAPI extern php_stream_ops      php_glob_stream_ops;
+PHPAPI extern php_stream_wrapper    php_glob_stream_wrapper;
+PHPAPI extern const php_stream_ops  php_glob_stream_ops;
 
 BEGIN_EXTERN_C()
 
index 8a8834dfba5a7654dad514e3477c6d33f3d91c39..951f8764a69115d3155030ea2a366a55538ae7a6 100644 (file)
@@ -20,8 +20,8 @@
 
 
 /* for user-space streams */
-PHPAPI extern php_stream_ops php_stream_userspace_ops;
-PHPAPI extern php_stream_ops php_stream_userspace_dir_ops;
+PHPAPI extern const php_stream_ops php_stream_userspace_ops;
+PHPAPI extern const php_stream_ops php_stream_userspace_dir_ops;
 #define PHP_STREAM_IS_USERSPACE        &php_stream_userspace_ops
 #define PHP_STREAM_IS_USERSPACE_DIR    &php_stream_userspace_dir_ops
 
index a5429138f3853593f75d297f617b545852274be9..33f425f812760ed2a735445e9986fc26a876f244 100644 (file)
@@ -881,6 +881,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
        }
 }
 
+/* This should be "const", but phpdbg overwrite it */
 PHPAPI php_stream_ops  php_stream_stdio_ops = {
        php_stdiop_write, php_stdiop_read,
        php_stdiop_close, php_stdiop_flush,
@@ -923,7 +924,7 @@ static int php_plain_files_dirstream_rewind(php_stream *stream, zend_off_t offse
        return 0;
 }
 
-static php_stream_ops  php_plain_files_dirstream_ops = {
+static const php_stream_ops    php_plain_files_dirstream_ops = {
        NULL, php_plain_files_dirstream_read,
        php_plain_files_dirstream_close, NULL,
        "dir",
@@ -1409,7 +1410,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
 }
 
 
-static php_stream_wrapper_ops php_plain_files_wrapper_ops = {
+static const php_stream_wrapper_ops php_plain_files_wrapper_ops = {
        php_plain_files_stream_opener,
        NULL,
        NULL,
index c97ebd02397eea8edc8111d29462d154d6886214..cf334cb4df9df69cf76f507c64166fc9c19ee2dd 100644 (file)
@@ -267,7 +267,7 @@ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int option
 /* }}} */
 
 /* allocate a new stream for a particular ops */
-PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract, const char *persistent_id, const char *mode STREAMS_DC) /* {{{ */
+PHPAPI php_stream *_php_stream_alloc(const php_stream_ops *ops, void *abstract, const char *persistent_id, const char *mode STREAMS_DC) /* {{{ */
 {
        php_stream *ret;
 
index 59dddfd42d4f65046c6f7b50ed2376ec49d55eb9..893820cb9008938d5501c675a5b18960af9bfd7d 100644 (file)
@@ -55,7 +55,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i
 static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode,
                int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
 
-static php_stream_wrapper_ops user_stream_wops = {
+static const php_stream_wrapper_ops user_stream_wops = {
        user_wrapper_opener,
        NULL, /* close - the streams themselves know how */
        NULL, /* stat - the streams themselves know how */
@@ -1542,7 +1542,7 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr)
        return ret;
 }
 
-php_stream_ops php_stream_userspace_ops = {
+const php_stream_ops php_stream_userspace_ops = {
        php_userstreamop_write, php_userstreamop_read,
        php_userstreamop_close, php_userstreamop_flush,
        "user-space",
@@ -1552,7 +1552,7 @@ php_stream_ops php_stream_userspace_ops = {
        php_userstreamop_set_option,
 };
 
-php_stream_ops php_stream_userspace_dir_ops = {
+const php_stream_ops php_stream_userspace_dir_ops = {
        NULL, /* write */
        php_userstreamop_readdir,
        php_userstreamop_closedir,
index 57e2f22fba86ae55e53083a01f6ca4e5b2502f14..bca06d0bc8216d4386ec32d506c4a376e0aec627 100644 (file)
 # define XP_SOCK_BUF_SIZE(sz) (sz)
 #endif
 
-php_stream_ops php_stream_generic_socket_ops;
-PHPAPI php_stream_ops php_stream_socket_ops;
-php_stream_ops php_stream_udp_socket_ops;
+const php_stream_ops php_stream_generic_socket_ops;
+PHPAPI const php_stream_ops php_stream_socket_ops;
+const php_stream_ops php_stream_udp_socket_ops;
 #ifdef AF_UNIX
-php_stream_ops php_stream_unix_socket_ops;
-php_stream_ops php_stream_unixdg_socket_ops;
+const php_stream_ops php_stream_unix_socket_ops;
+const php_stream_ops php_stream_unixdg_socket_ops;
 #endif
 
 
@@ -484,7 +484,7 @@ static int php_sockop_cast(php_stream *stream, int castas, void **ret)
  * A "useful" side-effect is that the user's scripts can then
  * make similar decisions using stream_get_meta_data.
  * */
-php_stream_ops php_stream_generic_socket_ops = {
+const php_stream_ops php_stream_generic_socket_ops = {
        php_sockop_write, php_sockop_read,
        php_sockop_close, php_sockop_flush,
        "generic_socket",
@@ -495,7 +495,7 @@ php_stream_ops php_stream_generic_socket_ops = {
 };
 
 
-php_stream_ops php_stream_socket_ops = {
+const php_stream_ops php_stream_socket_ops = {
        php_sockop_write, php_sockop_read,
        php_sockop_close, php_sockop_flush,
        "tcp_socket",
@@ -505,7 +505,7 @@ php_stream_ops php_stream_socket_ops = {
        php_tcp_sockop_set_option,
 };
 
-php_stream_ops php_stream_udp_socket_ops = {
+const php_stream_ops php_stream_udp_socket_ops = {
        php_sockop_write, php_sockop_read,
        php_sockop_close, php_sockop_flush,
        "udp_socket",
@@ -516,7 +516,7 @@ php_stream_ops php_stream_udp_socket_ops = {
 };
 
 #ifdef AF_UNIX
-php_stream_ops php_stream_unix_socket_ops = {
+const php_stream_ops php_stream_unix_socket_ops = {
        php_sockop_write, php_sockop_read,
        php_sockop_close, php_sockop_flush,
        "unix_socket",
@@ -525,7 +525,7 @@ php_stream_ops php_stream_unix_socket_ops = {
        php_sockop_stat,
        php_tcp_sockop_set_option,
 };
-php_stream_ops php_stream_unixdg_socket_ops = {
+const php_stream_ops php_stream_unixdg_socket_ops = {
        php_sockop_write, php_sockop_read,
        php_sockop_close, php_sockop_flush,
        "udg_socket",
@@ -883,7 +883,7 @@ PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t p
 {
        php_stream *stream = NULL;
        php_netstream_data_t *sock;
-       php_stream_ops *ops;
+       const php_stream_ops *ops;
 
        /* which type of socket ? */
        if (strncmp(proto, "tcp", protolen) == 0) {
index f47951bb16532a978f2c4ad6613f99391bfac0eb..7c465618be72a3fa39828a2d3ce9a39f3b460a9d 100644 (file)
@@ -1356,7 +1356,7 @@ php_stream *phpdbg_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *
                return stream;
        }
 
-       return PHPDBG_G(orig_url_wrap_php)(wrapper, path, mode, options, opened_path, context STREAMS_CC);
+       return PHPDBG_G(orig_url_wrap_php)->stream_opener(wrapper, path, mode, options, opened_path, context STREAMS_CC);
 } /* }}} */
 
 int main(int argc, char **argv) /* {{{ */
@@ -1399,6 +1399,7 @@ int main(int argc, char **argv) /* {{{ */
        void* (*_malloc)(size_t);
        void (*_free)(void*);
        void* (*_realloc)(void*, size_t);
+       php_stream_wrapper_ops wops;
 
 
 #ifndef _WIN32
@@ -1868,8 +1869,10 @@ phpdbg_main:
 
                {
                        php_stream_wrapper *wrapper = zend_hash_str_find_ptr(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
-                       PHPDBG_G(orig_url_wrap_php) = wrapper->wops->stream_opener;
-                       wrapper->wops->stream_opener = phpdbg_stream_url_wrap_php;
+                       PHPDBG_G(orig_url_wrap_php) = wrapper->wops;
+                       memcpy(&wops, wrapper->wops, sizeof(wops));
+                       wops.stream_opener = phpdbg_stream_url_wrap_php;
+                       wrapper->wops = &wops;
                }
 
                /* Make stdin, stdout and stderr accessible from PHP scripts */
@@ -2149,7 +2152,7 @@ phpdbg_out:
 
                {
                        php_stream_wrapper *wrapper = zend_hash_str_find_ptr(php_stream_get_url_stream_wrappers_hash(), ZEND_STRL("php"));
-                       wrapper->wops->stream_opener = PHPDBG_G(orig_url_wrap_php);
+                       wrapper->wops = PHPDBG_G(orig_url_wrap_php);
                }
 
                zend_hash_destroy(&PHPDBG_G(file_sources));
index ef3b017b6d8a3ff516b548b5a15ba874142f9c47..0975ec8de2b54266facff300d16419ee73a4f4cc 100644 (file)
@@ -308,7 +308,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
        zend_bool last_was_newline;                  /* check if we don't need to output a newline upon next phpdbg_error or phpdbg_notice */
 
        FILE *stdin_file;                            /* FILE pointer to stdin source file */
-       php_stream *(*orig_url_wrap_php)(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
+       const php_stream_wrapper_ops *orig_url_wrap_php;
 
        char input_buffer[PHPDBG_MAX_CMD];           /* stdin input buffer */
        int input_buflen;                            /* length of stdin input buffer */