From 81e2cf03ac62c29c6bb365c31b9229aa3b4deff8 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Wed, 6 Jun 2001 13:06:12 +0000 Subject: Fix folding and clean up some extensions --- main/SAPI.c | 3 +- main/alloca.c | 3 +- main/fopen_wrappers.c | 51 +++++++++++--- main/internal_functions_win32.c | 10 ++- main/main.c | 147 ++++++++++++++++++++++++++++++---------- main/mergesort.c | 12 ++-- main/network.c | 15 +++- main/output.c | 66 +++++++++++------- main/php.h | 3 +- main/php_content_types.c | 14 +++- main/php_ini.c | 60 +++++++++++----- main/php_logos.c | 3 +- main/php_open_temporary_file.c | 3 +- main/php_sprintf.c | 3 +- main/php_streams.h | 8 ++- main/php_ticks.c | 3 +- main/php_variables.c | 3 +- main/reentrancy.c | 3 +- main/rfc1867.c | 3 +- main/safe_mode.c | 3 +- main/snprintf.c | 3 +- main/streams.c | 3 +- main/strlcat.c | 3 +- main/strlcpy.c | 3 +- 24 files changed, 312 insertions(+), 116 deletions(-) (limited to 'main') diff --git a/main/SAPI.c b/main/SAPI.c index d38e70e73f..499a2f682d 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -598,5 +598,6 @@ SAPI_API char *sapi_getenv(char *name, size_t name_len) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/alloca.c b/main/alloca.c index ff553f3541..faba929ef8 100644 --- a/main/alloca.c +++ b/main/alloca.c @@ -494,5 +494,6 @@ i00afunc (long address) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 208a39eebb..f76ae1f88a 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -18,6 +18,8 @@ */ /* $Id$ */ +/* {{{ includes + */ #include "php.h" #include "php_globals.h" #include "SAPI.h" @@ -78,6 +80,7 @@ #if defined(AF_UNIX) #include #endif +/* }}} */ typedef FILE * (*php_fopen_url_wrapper_t) (const char *, char *, int, int *, int *, char **) ; @@ -88,6 +91,8 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path); HashTable fopen_url_wrappers_hash; +/* {{{ php_register_url_wrapper + */ PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)) { PLS_FETCH(); @@ -98,7 +103,10 @@ PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path return FAILURE; } } +/* }}} */ +/* {{{ php_unregister_url_wrapper + */ PHPAPI int php_unregister_url_wrapper(char *protocol) { PLS_FETCH(); @@ -109,7 +117,10 @@ PHPAPI int php_unregister_url_wrapper(char *protocol) return SUCCESS; } } +/* }}} */ +/* {{{ php_init_fopen_wrappers + */ int php_init_fopen_wrappers(void) { PLS_FETCH(); @@ -119,7 +130,10 @@ int php_init_fopen_wrappers(void) return SUCCESS; } +/* }}} */ +/* {{{ php_shutdown_fopen_wrappers + */ int php_shutdown_fopen_wrappers(void) { PLS_FETCH(); @@ -130,9 +144,9 @@ int php_shutdown_fopen_wrappers(void) return SUCCESS; } +/* }}} */ - -/* +/* {{{ php_check_specific_open_basedir When open_basedir is not NULL, check if the given filename is located in open_basedir. Returns -1 if error or not in the open_basedir, else 0 @@ -182,7 +196,10 @@ PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC) return -1; } } +/* }}} */ +/* {{{ php_check_open_basedir + */ PHPAPI int php_check_open_basedir(char *path) { PLS_FETCH(); @@ -224,7 +241,10 @@ PHPAPI int php_check_open_basedir(char *path) /* Nothing to check... */ return 0; } +/* }}} */ +/* {{{ php_fopen_and_set_opened_path + */ static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char **opened_path) { FILE *fp; @@ -238,7 +258,10 @@ static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char ** } return fp; } +/* }}} */ +/* {{{ php_fopen_wrapper + */ PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) { PLS_FETCH(); @@ -265,8 +288,10 @@ PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock, return php_fopen_and_set_opened_path(path, mode, opened_path); } } +/* }}} */ - +/* {{{ php_fopen_primary_script + */ PHPAPI FILE *php_fopen_primary_script(void) { FILE *fp; @@ -355,9 +380,9 @@ PHPAPI FILE *php_fopen_primary_script(void) return fp; } +/* }}} */ - -/* +/* {{{ php_fopen_with_path * Tries to open a file with a PATH-style list of directories. * If the filename starts with "." or "/", the path is ignored. */ @@ -421,9 +446,10 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char ** efree(pathbuf); return NULL; } - +/* }}} */ - +/* {{{ php_fopen_url_wrapper + */ static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) { FILE *fp = NULL; @@ -481,7 +507,10 @@ static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, in php_error(E_WARNING, "Invalid URL specified, %s", path); return NULL; } +/* }}} */ +/* {{{ php_strip_url_passwd + */ PHPAPI char *php_strip_url_passwd(char *url) { register char *p = url, *url_start; @@ -512,8 +541,10 @@ PHPAPI char *php_strip_url_passwd(char *url) } return url; } +/* }}} */ - +/* {{{ expand_filepath + */ PHPAPI char *expand_filepath(const char *filepath, char *real_path) { cwd_state new_state; @@ -544,11 +575,13 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path) return real_path; } +/* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c index 98583f7ca6..61c42a9ca1 100644 --- a/main/internal_functions_win32.c +++ b/main/internal_functions_win32.c @@ -20,7 +20,8 @@ /* $Id$ */ - +/* {{{ includes + */ #include "php.h" #include "php_main.h" #include "zend_modules.h" @@ -60,7 +61,10 @@ #include "ext/xml/php_xml.h" #include "ext/wddx/php_wddx.h" #include "ext/mysql/php_mysql.h" +/* }}} */ +/* {{{ php_builtin_extensions[] + */ zend_module_entry *php_builtin_extensions[] = { phpext_standard_ptr, #if WITH_BCMATH @@ -77,6 +81,7 @@ zend_module_entry *php_builtin_extensions[] = { phpext_xml_ptr, phpext_wddx_ptr }; +/* }}} */ #define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *)) @@ -102,5 +107,6 @@ int php_global_shutdown_internal_extensions(void) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/main.c b/main/main.c index 10a8d98064..46587980f4 100644 --- a/main/main.c +++ b/main/main.c @@ -18,10 +18,10 @@ +----------------------------------------------------------------------+ */ - /* $Id$ */ - +/* {{{ includes + */ #include #include "php.h" #ifdef PHP_WIN32 @@ -75,18 +75,20 @@ #include "php_logos.h" #include "SAPI.h" +/* }}} */ #ifndef ZTS php_core_globals core_globals; #else PHPAPI int core_globals_id; #endif - static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC); #define SAFE_FILENAME(f) ((f)?(f):"-") +/* {{{ PHP_INI_MH + */ static PHP_INI_MH(OnSetPrecision) { ELS_FETCH(); @@ -94,9 +96,11 @@ static PHP_INI_MH(OnSetPrecision) EG(precision) = atoi(new_value); return SUCCESS; } - +/* }}} */ #if MEMORY_LIMIT +/* {{{ PHP_INI_MH + */ static PHP_INI_MH(OnChangeMemoryLimit) { int new_limit; @@ -108,9 +112,11 @@ static PHP_INI_MH(OnChangeMemoryLimit) } return zend_set_memory_limit(new_limit); } +/* }}} */ #endif - +/* {{{ PHP_INI_MH + */ static PHP_INI_MH(OnUpdateErrorReporting) { ELS_FETCH(); @@ -122,8 +128,10 @@ static PHP_INI_MH(OnUpdateErrorReporting) } return SUCCESS; } +/* }}} */ - +/* {{{ php_disable_functions + */ static void php_disable_functions() { char *func; @@ -137,8 +145,10 @@ static void php_disable_functions() func = strtok(NULL, ", "); } } +/* }}} */ - +/* {{{ PHP_INI_MH + */ static PHP_INI_MH(OnUpdateTimeout) { ELS_FETCH(); @@ -152,7 +162,7 @@ static PHP_INI_MH(OnUpdateTimeout) zend_set_timeout(EG(timeout_seconds)); return SUCCESS; } - +/* }}} */ /* Need to convert to strings and make use of: * PHP_SAFE_MODE @@ -174,6 +184,8 @@ static PHP_INI_MH(OnUpdateTimeout) #else # define DEFAULT_SENDMAIL_PATH NULL #endif +/* {{{ PHP_INI + */ PHP_INI_BEGIN() PHP_INI_ENTRY_EX("define_syslog_variables", "0", PHP_INI_ALL, NULL, php_ini_boolean_displayer_cb) PHP_INI_ENTRY_EX("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) @@ -245,12 +257,13 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) PHP_INI_END() - - +/* }}} */ /* True global (no need for thread safety */ static int module_initialized = 0; +/* {{{ php_log_err + */ PHPAPI void php_log_err(char *log_message) { FILE *log_file; @@ -285,17 +298,21 @@ PHPAPI void php_log_err(char *log_message) sapi_module.log_message(log_message); } } - +/* }}} */ /* is 4K big enough? */ #define PRINTF_BUFFER_SIZE 1024*4 -/* wrapper for modules to use PHPWRITE */ +/* {{{ php_write + wrapper for modules to use PHPWRITE */ PHPAPI int php_write(void *buf, uint size) { return PHPWRITE(buf, size); } +/* }}} */ +/* {{{ php_printf + */ PHPAPI int php_printf(const char *format, ...) { va_list args; @@ -313,9 +330,10 @@ PHPAPI int php_printf(const char *format, ...) return ret; } +/* }}} */ - -/* extended error handling function */ +/* {{{ php_error_cb + extended error handling function */ static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) { char buffer[1024]; @@ -442,8 +460,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL); } } - - +/* }}} */ /* {{{ proto void set_time_limit(int seconds) Sets the maximum time a script can run */ @@ -467,6 +484,8 @@ PHP_FUNCTION(set_time_limit) } /* }}} */ +/* {{{ php_fopen_wrapper_for_zend + */ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path) { int issock=0, socketd=0; @@ -482,8 +501,10 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path } return retval; } +/* }}} */ - +/* {{{ php_get_configuration_directive_for_zend + */ static int php_get_configuration_directive_for_zend(char *name, uint name_length, zval *contents) { zval *retval = cfg_get_entry(name, name_length); @@ -495,8 +516,10 @@ static int php_get_configuration_directive_for_zend(char *name, uint name_length return FAILURE; } } +/* }}} */ - +/* {{{ php_message_handler_for_zend + */ static void php_message_handler_for_zend(long message, void *data) { switch (message) { @@ -564,19 +587,24 @@ static void php_message_handler_for_zend(long message, void *data) break; } } - +/* }}} */ #if PHP_SIGCHILD +/* {{{ sigchld_handler + */ static void sigchld_handler(int apar) { while (waitpid(-1, NULL, WNOHANG) > 0) ; signal(SIGCHLD,sigchld_handler); } +/* }}} */ #endif static int php_hash_environment(ELS_D SLS_DC PLS_DC); +/* {{{ php_request_startup + */ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) { #if PHP_SIGCHILD @@ -624,16 +652,20 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) return SUCCESS; } +/* }}} */ - +/* {{{ php_request_shutdown_for_exec + */ void php_request_shutdown_for_exec(void *dummy) { /* used to close fd's in the 3..255 range here, but it's problematic */ shutdown_memory_manager(1, 1); } +/* }}} */ - +/* {{{ php_request_shutdown + */ void php_request_shutdown(void *dummy) { CLS_FETCH(); @@ -671,29 +703,36 @@ void php_request_shutdown(void *dummy) zend_unset_timeout(); } } +/* }}} */ - +/* {{{ php_config_ini_shutdown + */ static void php_config_ini_shutdown(void) { php_shutdown_config(); } +/* }}} */ - +/* {{{ php_body_write_wrapper + */ static int php_body_write_wrapper(const char *str, uint str_length) { return php_body_write(str, str_length); } - +/* }}} */ #ifdef ZTS +/* {{{ core_globals_ctor + */ static void core_globals_ctor(php_core_globals *core_globals) { memset(core_globals,0,sizeof(*core_globals)); } - +/* }}} */ #endif - +/* {{{ php_startup_extensions + */ int php_startup_extensions(zend_module_entry **ptr, int count) { zend_module_entry **end = ptr+count; @@ -708,7 +747,10 @@ int php_startup_extensions(zend_module_entry **ptr, int count) } return SUCCESS; } +/* }}} */ +/* {{{ php_global_startup_extensions + */ int php_global_startup_extensions(zend_module_entry **ptr, int count) { zend_module_entry **end = ptr+count; @@ -724,7 +766,10 @@ int php_global_startup_extensions(zend_module_entry **ptr, int count) } return SUCCESS; } +/* }}} */ +/* {{{ php_global_shutdown_extensions + */ int php_global_shutdown_extensions(zend_module_entry **ptr, int count) { zend_module_entry **end = ptr+count; @@ -740,7 +785,10 @@ int php_global_shutdown_extensions(zend_module_entry **ptr, int count) } return SUCCESS; } +/* }}} */ +/* {{{ php_module_startup + */ int php_module_startup(sapi_module_struct *sf) { zend_utility_functions zuf; @@ -896,22 +944,24 @@ int php_module_startup(sapi_module_struct *sf) /* we're done */ return SUCCESS; } - - +/* }}} */ void php_module_shutdown_for_exec() { /* used to close fd's in the range 3.255 here, but it's problematic */ } - +/* {{{ php_module_shutdown_wrapper + */ int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals) { php_module_shutdown(); return SUCCESS; } +/* }}} */ - +/* {{{ php_module_shutdown + */ void php_module_shutdown() { int module_number=0; /* for UNREGISTER_INI_ENTRIES() */ @@ -942,8 +992,10 @@ void php_module_shutdown() shutdown_memory_manager(0, 1); module_initialized = 0; } +/* }}} */ - +/* {{{ php_register_server_variables + */ static inline void php_register_server_variables(ELS_D SLS_DC PLS_DC) { zval *array_ptr=NULL; @@ -971,8 +1023,10 @@ static inline void php_register_server_variables(ELS_D SLS_DC PLS_DC) php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr ELS_CC PLS_CC); } } +/* }}} */ - +/* {{{ php_hash_environment + */ static int php_hash_environment(ELS_D SLS_DC PLS_DC) { char *p; @@ -1077,8 +1131,10 @@ static int php_hash_environment(ELS_D SLS_DC PLS_DC) } return SUCCESS; } +/* }}} */ - +/* {{{ php_build_argv + */ static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC) { pval *arr, *argc, *tmp; @@ -1134,8 +1190,10 @@ static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC) zend_hash_update(track_vars_array->value.ht, "argv", sizeof("argv"), &arr, sizeof(pval *), NULL); zend_hash_update(track_vars_array->value.ht, "argc", sizeof("argc"), &argc, sizeof(pval *), NULL); } +/* }}} */ - +/* {{{ php_handle_special_queries + */ PHPAPI int php_handle_special_queries(SLS_D PLS_DC) { if (SG(request_info).query_string && SG(request_info).query_string[0]=='=' @@ -1149,7 +1207,10 @@ PHPAPI int php_handle_special_queries(SLS_D PLS_DC) } return 0; } +/* }}} */ +/* {{{ php_execute_script + */ PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC) { zend_file_handle *prepend_file_p, *append_file_p; @@ -1209,7 +1270,10 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_D return EG(exit_status); } +/* }}} */ +/* {{{ php_handle_aborted_connection + */ PHPAPI void php_handle_aborted_connection(void) { PLS_FETCH(); @@ -1220,7 +1284,10 @@ PHPAPI void php_handle_aborted_connection(void) zend_bailout(); } } +/* }}} */ +/* {{{ php_handle_auth_data + */ PHPAPI int php_handle_auth_data(const char *auth SLS_DC) { int ret = -1; @@ -1249,7 +1316,10 @@ PHPAPI int php_handle_auth_data(const char *auth SLS_DC) return ret; } +/* }}} */ +/* {{{ php_lint_script + */ PHPAPI int php_lint_script(zend_file_handle *file CLS_DC ELS_DC PLS_DC) { zend_op_array *op_array; @@ -1278,20 +1348,23 @@ PHPAPI int php_lint_script(zend_file_handle *file CLS_DC ELS_DC PLS_DC) return retval; } +/* }}} */ #ifdef PHP_WIN32 -/* just so that this symbol gets exported... */ +/* {{{ dummy_indent + just so that this symbol gets exported... */ PHPAPI void dummy_indent() { zend_indent(); } +/* }}} */ #endif - /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/mergesort.c b/main/mergesort.c index b73b67773b..73c65c5100 100644 --- a/main/mergesort.c +++ b/main/mergesort.c @@ -97,7 +97,7 @@ static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const voi ((u_char *)0 + \ (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1))) -/* +/* {{{ php_mergesort * Arguments are as for qsort. */ int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *)) @@ -233,6 +233,7 @@ COPY: b = t; free(list2); return (0); } +/* }}} */ #define swap(a, b) { \ s = b; \ @@ -253,7 +254,7 @@ COPY: b = t; } while(bot < s); \ } -/* +/* {{{ setup * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of * increasing order, list2 in a corresponding linked list. Checks for runs * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL @@ -324,8 +325,9 @@ static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp } #endif /* NATURAL */ } +/* }}} */ -/* +/* {{{ insertionsort * This is to avoid out-of-bounds addresses in sorting the * last 4 elements. */ @@ -342,11 +344,13 @@ static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const voi swap(u, t); } } +/* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/network.c b/main/network.c index ff0d6e7f9b..b2fb94b3b5 100644 --- a/main/network.c +++ b/main/network.c @@ -68,6 +68,8 @@ int inet_aton(const char *, struct in_addr *); # define PHP_GAI_STRERROR(x) (gai_strerror(x)) #else # define PHP_GAI_STRERROR(x) (php_gai_strerror(x)) +/* {{{ php_gai_strerror + */ static char *php_gai_strerror(int code) { static struct { @@ -101,9 +103,12 @@ static char *php_gai_strerror(int code) return "Unknown error"; } +/* }}} */ #endif #endif +/* {{{ php_network_freeaddresses + */ static void php_network_freeaddresses(struct sockaddr **sal) { struct sockaddr **sap; @@ -114,7 +119,10 @@ static void php_network_freeaddresses(struct sockaddr **sal) efree(*sap); efree(sal); } +/* }}} */ +/* {{{ php_network_getaddresses + */ static int php_network_getaddresses(const char *host, struct sockaddr ***sal) { struct sockaddr **sap; @@ -184,6 +192,7 @@ static int php_network_getaddresses(const char *host, struct sockaddr ***sal) *sap = NULL; return 0; } +/* }}} */ /* {{{ php_connect_nonb */ PHPAPI int php_connect_nonb(int sockfd, @@ -262,7 +271,7 @@ ok: } /* }}} */ -/* +/* {{{ php_hostconnect * Creates a socket of type socktype and connects to the given host and * port, returns the created socket on success, else returns -1. * timeout gives timeout in seconds, 0 means blocking mode. @@ -326,11 +335,13 @@ int php_hostconnect(char *host, unsigned short port, int socktype, int timeout) php_network_freeaddresses(psal); return s; } +/* }}} */ /* * Local variables: * tab-width: 8 * c-basic-offset: 8 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/output.c b/main/output.c index 1f3f5f9f17..26f95af2e4 100644 --- a/main/output.c +++ b/main/output.c @@ -102,7 +102,8 @@ PHPAPI int php_header_write(const char *str, uint str_length) return OG(php_header_write)(str, str_length); } -/* Start output buffering */ +/* {{{ php_start_ob_buffer + * Start output buffering */ PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size) { OLS_FETCH(); @@ -118,9 +119,10 @@ PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size) OG(php_body_write) = php_b_body_write; return SUCCESS; } +/* }}} */ - -/* End output buffering (one level) */ +/* {{{ php_end_ob_buffer + * End output buffering (one level) */ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush) { char *final_buffer=NULL; @@ -243,9 +245,10 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush) efree(to_be_destroyed_handled_output[1]); } } +/* }}} */ - -/* End output buffering (all buffers) */ +/* {{{ php_end_ob_buffers + * End output buffering (all buffers) */ PHPAPI void php_end_ob_buffers(zend_bool send_buffer) { OLS_FETCH(); @@ -254,8 +257,10 @@ PHPAPI void php_end_ob_buffers(zend_bool send_buffer) php_end_ob_buffer(send_buffer, 0); } } +/* }}} */ - +/* {{{ php_start_implicit_flush + */ PHPAPI void php_start_implicit_flush() { OLS_FETCH(); @@ -263,16 +268,20 @@ PHPAPI void php_start_implicit_flush() php_end_ob_buffer(1, 0); /* Switch out of output buffering if we're in it */ OG(implicit_flush)=1; } +/* }}} */ - +/* {{{ php_end_implicit_flush + */ PHPAPI void php_end_implicit_flush() { OLS_FETCH(); OG(implicit_flush)=0; } +/* }}} */ - +/* {{{ php_ob_set_internal_handler + */ PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size) { OLS_FETCH(); @@ -285,12 +294,14 @@ PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_outpu OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size); OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size; } - +/* }}} */ /* * Output buffering - implementation */ +/* {{{ php_ob_allocate + */ static inline void php_ob_allocate(void) { OLS_FETCH(); @@ -303,8 +314,10 @@ static inline void php_ob_allocate(void) OG(active_ob_buffer).buffer = (char *) erealloc(OG(active_ob_buffer).buffer, OG(active_ob_buffer).size+1); } } +/* }}} */ - +/* {{{ php_ob_init + */ static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size) { OLS_FETCH(); @@ -325,8 +338,10 @@ static void php_ob_init(uint initial_size, uint block_size, zval *output_handler OG(active_ob_buffer).status = 0; OG(active_ob_buffer).internal_output_handler = NULL; } +/* }}} */ - +/* {{{ php_ob_append + */ static void php_ob_append(const char *text, uint text_length) { char *target; @@ -352,6 +367,7 @@ static void php_ob_append(const char *text, uint text_length) return; } } +/* }}} */ #if 0 static void php_ob_prepend(const char *text, uint text_length) @@ -375,7 +391,8 @@ static void php_ob_prepend(const char *text, uint text_length) #endif -/* Return the current output buffer */ +/* {{{ php_ob_get_buffer + * Return the current output buffer */ int php_ob_get_buffer(pval *p) { OLS_FETCH(); @@ -388,9 +405,10 @@ int php_ob_get_buffer(pval *p) p->value.str.len = OG(active_ob_buffer).text_length; return SUCCESS; } +/* }}} */ - -/* Return the size of the current output buffer */ +/* {{{ php_ob_get_length + * Return the size of the current output buffer */ int php_ob_get_length(pval *p) { OLS_FETCH(); @@ -402,6 +420,7 @@ int php_ob_get_length(pval *p) p->value.lval = OG(active_ob_buffer).text_length; return SUCCESS; } +/* }}} */ /* * Wrapper functions - implementation @@ -415,7 +434,8 @@ static int php_b_body_write(const char *str, uint str_length) return str_length; } - +/* {{{ php_ub_body_write_no_header + */ static int php_ub_body_write_no_header(const char *str, uint str_length) { char *newstr = NULL; @@ -441,8 +461,10 @@ static int php_ub_body_write_no_header(const char *str, uint str_length) return result; } +/* }}} */ - +/* {{{ php_ub_body_write + */ static int php_ub_body_write(const char *str, uint str_length) { int result = 0; @@ -472,13 +494,12 @@ static int php_ub_body_write(const char *str, uint str_length) return result; } - +/* }}} */ /* * HEAD support */ - /* {{{ proto void ob_start([ string user_function [, int chunk_size]]) Turn on Output Buffering (specifying an optional output handler). */ PHP_FUNCTION(ob_start) @@ -526,7 +547,6 @@ PHP_FUNCTION(ob_start) } /* }}} */ - /* {{{ proto void ob_end_flush(void) Flush (send) the output buffer, and turn off output buffering */ PHP_FUNCTION(ob_end_flush) @@ -535,7 +555,6 @@ PHP_FUNCTION(ob_end_flush) } /* }}} */ - /* {{{ proto void ob_end_clean(void) Clean (erase) the output buffer, and turn off output buffering */ PHP_FUNCTION(ob_end_clean) @@ -544,7 +563,6 @@ PHP_FUNCTION(ob_end_clean) } /* }}} */ - /* {{{ proto string ob_get_contents(void) Return the contents of the output buffer */ PHP_FUNCTION(ob_get_contents) @@ -555,7 +573,6 @@ PHP_FUNCTION(ob_get_contents) } /* }}} */ - /* {{{ proto string ob_get_length(void) Return the length of the output buffer */ PHP_FUNCTION(ob_get_length) @@ -566,7 +583,6 @@ PHP_FUNCTION(ob_get_length) } /* }}} */ - /* {{{ proto void ob_implicit_flush([int flag]) Turn implicit flush on/off and is equivalent to calling flush() after every output call */ PHP_FUNCTION(ob_implicit_flush) @@ -597,7 +613,6 @@ PHP_FUNCTION(ob_implicit_flush) } /* }}} */ - PHPAPI char *php_get_output_start_filename() { OLS_FETCH(); @@ -618,5 +633,6 @@ PHPAPI int php_get_output_start_lineno() * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php.h b/main/php.h index e7f0f114ee..f99d2c3007 100644 --- a/main/php.h +++ b/main/php.h @@ -343,5 +343,6 @@ PHPAPI PHP_FUNCTION(warn_not_available); * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php_content_types.c b/main/php_content_types.c index 81ca39882b..a9c8b1d781 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -24,13 +24,17 @@ #include "php_content_types.h" +/* {{{ php_post_entries[] + */ static 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, sapi_read_standard_form_data, rfc1867_post_handler }, { NULL, 0, NULL } }; +/* }}} */ - +/* {{{ SAPI_POST_READER_FUNC + */ SAPI_POST_READER_FUNC(php_default_post_reader) { char *data; @@ -40,19 +44,23 @@ SAPI_POST_READER_FUNC(php_default_post_reader) data = estrndup(SG(request_info).post_data,SG(request_info).post_data_length); SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, SG(request_info).post_data_length); } +/* }}} */ - +/* {{{ php_startup_sapi_content_types + */ int php_startup_sapi_content_types(void) { sapi_register_post_entries(php_post_entries); sapi_register_default_post_reader(php_default_post_reader); return SUCCESS; } +/* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php_ini.c b/main/php_ini.c index c4b9abb13a..b705971cd4 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -39,7 +39,8 @@ static HashTable configuration_hash; PHPAPI char *php_ini_opened_path=NULL; static php_extension_lists extension_lists; - +/* {{{ php_ini_displayer_cb + */ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) { if (ini_entry->displayer) { @@ -72,8 +73,10 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) } } } +/* }}} */ - +/* {{{ php_ini_displayer + */ static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number) { if (ini_entry->module_number != module_number) { @@ -90,8 +93,10 @@ static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number) PUTS("\n"); return 0; } +/* }}} */ - +/* {{{ display_ini_entries + */ PHPAPI void display_ini_entries(zend_module_entry *module) { int module_number; @@ -107,8 +112,7 @@ PHPAPI void display_ini_entries(zend_module_entry *module) zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (long) module_number); php_info_print_table_end(); } - - +/* }}} */ /* php.ini support */ @@ -126,14 +130,18 @@ PHPAPI void display_ini_entries(zend_module_entry *module) # endif #endif - +/* {{{ pvalue_config_destructor + */ static void pvalue_config_destructor(zval *pvalue) { if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) { free(pvalue->value.str.val); } } +/* }}} */ +/* {{{ php_config_ini_parser_cb + */ static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg) { switch (callback_type) { @@ -164,8 +172,10 @@ static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, break; } } +/* }}} */ - +/* {{{ php_load_function_extension_cb + */ static void php_load_function_extension_cb(void *arg) { zval *extension = (zval *) arg; @@ -173,14 +183,18 @@ static void php_load_function_extension_cb(void *arg) php_dl(extension, MODULE_PERSISTENT, &zval); } +/* }}} */ - +/* {{{ php_load_zend_extension_cb + */ static void php_load_zend_extension_cb(void *arg) { zend_load_extension(*((char **) arg)); } +/* }}} */ - +/* {{{ php_init_config + */ int php_init_config(char *php_ini_path_override) { char *env_location, *php_ini_search_path; @@ -264,8 +278,10 @@ int php_init_config(char *php_ini_path_override) return SUCCESS; } +/* }}} */ - +/* {{{ php_shutdown_config + */ int php_shutdown_config(void) { zend_hash_destroy(&configuration_hash); @@ -274,8 +290,10 @@ int php_shutdown_config(void) } return SUCCESS; } +/* }}} */ - +/* {{{ php_ini_delayed_modules_startup + */ void php_ini_delayed_modules_startup(void) { zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb); @@ -284,8 +302,10 @@ void php_ini_delayed_modules_startup(void) zend_llist_destroy(&extension_lists.engine); zend_llist_destroy(&extension_lists.functions); } +/* }}} */ - +/* {{{ cfg_get_entry + */ zval *cfg_get_entry(char *name, uint name_length) { zval *tmp; @@ -296,8 +316,10 @@ zval *cfg_get_entry(char *name, uint name_length) return NULL; } } +/* }}} */ - +/* {{{ cfg_get_long + */ PHPAPI int cfg_get_long(char *varname,long *result) { zval *tmp,var; @@ -312,8 +334,10 @@ PHPAPI int cfg_get_long(char *varname,long *result) *result = var.value.lval; return SUCCESS; } +/* }}} */ - +/* {{{ cfg_get_double + */ PHPAPI int cfg_get_double(char *varname,double *result) { zval *tmp,var; @@ -328,8 +352,10 @@ PHPAPI int cfg_get_double(char *varname,double *result) *result = var.value.dval; return SUCCESS; } +/* }}} */ - +/* {{{ cfg_get_string + */ PHPAPI int cfg_get_string(char *varname, char **result) { zval *tmp; @@ -341,6 +367,7 @@ PHPAPI int cfg_get_string(char *varname, char **result) *result = tmp->value.str.val; return SUCCESS; } +/* }}} */ /* * Local variables: @@ -348,5 +375,6 @@ PHPAPI int cfg_get_string(char *varname, char **result) * c-basic-offset: 4 * indent-tabs-mode: t * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php_logos.c b/main/php_logos.c index f236dc011f..c9eb588911 100644 --- a/main/php_logos.c +++ b/main/php_logos.c @@ -93,5 +93,6 @@ int php_info_logos(const char *logo_string) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index 9cce838814..de4aacc998 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -199,5 +199,6 @@ PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **op * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php_sprintf.c b/main/php_sprintf.c index c91d4da6c5..ecbd6b0238 100644 --- a/main/php_sprintf.c +++ b/main/php_sprintf.c @@ -46,5 +46,6 @@ php_sprintf (char*s, const char* format, ...) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php_streams.h b/main/php_streams.h index 640aebe11f..5083b5ba29 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -96,12 +96,14 @@ PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int sho #define php_stream_is(stream, anops) (stream->ops == anops) #endif /* HAVE_PHP_STREAM */ + +#endif + /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ - -#endif diff --git a/main/php_ticks.c b/main/php_ticks.c index 5e66bfdd37..95e63df322 100644 --- a/main/php_ticks.c +++ b/main/php_ticks.c @@ -76,5 +76,6 @@ void php_run_ticks(int count) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/php_variables.c b/main/php_variables.c index b5a2e8d50e..bb577fa609 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -333,5 +333,6 @@ void php_import_environment_variables(zval *array_ptr ELS_DC PLS_DC) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/reentrancy.c b/main/reentrancy.c index e1ff8266d5..80d169baed 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -436,5 +436,6 @@ cont: * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/rfc1867.c b/main/rfc1867.c index 1347f9d829..899bfb66dd 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -479,5 +479,6 @@ SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/safe_mode.c b/main/safe_mode.c index 18b2f752c3..f14f7df0fa 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -169,5 +169,6 @@ PHPAPI char *php_get_current_user() * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/snprintf.c b/main/snprintf.c index 238cf2cf2e..5fe1860d86 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -944,5 +944,6 @@ int ap_php_vsnprintf(char *buf, size_t len, const char *format, va_list ap) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/streams.c b/main/streams.c index d4ac991c69..6b3cd0f472 100755 --- a/main/streams.c +++ b/main/streams.c @@ -355,5 +355,6 @@ exit_success: * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/strlcat.c b/main/strlcat.c index 7e4cd9feb0..e6bc017cc0 100644 --- a/main/strlcat.c +++ b/main/strlcat.c @@ -81,5 +81,6 @@ PHPAPI size_t php_strlcat(dst, src, siz) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ diff --git a/main/strlcpy.c b/main/strlcpy.c index 6b51ca3a86..9c1f4da01d 100644 --- a/main/strlcpy.c +++ b/main/strlcpy.c @@ -78,5 +78,6 @@ PHPAPI size_t php_strlcpy(dst, src, siz) * tab-width: 4 * c-basic-offset: 4 * End: - * vim: sw=4 ts=4 tw=78 fdm=marker + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 */ -- cgit v1.2.1