From aacbe6aa75ca07853bf88d5b3647f67f107d1af7 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 10 Jan 2012 14:27:19 +0000 Subject: [PATCH] header cleanups; fix IDE warnings --- php_http.c | 1 - php_http.h | 9 --------- php_http_api.h | 18 +++++++++++++++++- php_http_cookie.c | 2 -- php_http_curl.c | 4 +--- php_http_env_response.c | 4 ---- php_http_filter.c | 3 +++ php_http_message.c | 4 ---- php_http_message_body.c | 1 - php_http_misc.c | 1 - php_http_negotiate.c | 2 -- php_http_neon.c | 2 -- php_http_params.c | 6 +++--- php_http_property_proxy.c | 2 +- php_http_querystring.c | 1 - php_http_request.c | 1 - php_http_request_datashare.c | 2 -- php_http_request_factory.c | 1 - php_http_request_pool.c | 2 -- php_http_url.c | 5 +---- php_http_url.h | 2 ++ 21 files changed, 28 insertions(+), 45 deletions(-) diff --git a/php_http.c b/php_http.c index cd95f48..1fc0513 100644 --- a/php_http.c +++ b/php_http.c @@ -13,7 +13,6 @@ #include "php_http_api.h" #include -#include #include #include diff --git a/php_http.h b/php_http.h index 94ed04e..e8d5e40 100644 --- a/php_http.h +++ b/php_http.h @@ -20,15 +20,6 @@ extern zend_module_entry http_module_entry; extern int http_module_number; -#if PHP_DEBUG -# define _DPF_STR 0 -# define _DPF_IN 1 -# define _DPF_OUT 2 -extern void _dpf(int type, const char *data, size_t length); -#else -# define _dpf(t,s,l); -#endif - #endif /* PHP_EXT_HTTP_H */ /* diff --git a/php_http_api.h b/php_http_api.h index 5cf64c9..47b6869 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -17,9 +17,14 @@ #include "config.h" #endif -#include #include +#include #include + +#include +#include +#include + #include #if defined(PHP_WIN32) @@ -61,6 +66,8 @@ typedef int STATUS; #define PHP_HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c)) #define PHP_HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c)) +#include "php_http.h" + #include "php_http_buffer.h" #include "php_http_strlist.h" #include "php_http_misc.h" @@ -117,6 +124,15 @@ ZEND_EXTERN_MODULE_GLOBALS(php_http); # define PHP_HTTP_G (&php_http_globals) #endif +#if PHP_DEBUG +# define _DPF_STR 0 +# define _DPF_IN 1 +# define _DPF_OUT 2 +extern void _dpf(int type, const char *data, size_t length); +#else +# define _dpf(t,s,l); +#endif + #endif /* PHP_HTTP_API_H */ diff --git a/php_http_cookie.c b/php_http_cookie.c index 8066f82..a92bb5e 100644 --- a/php_http_cookie.c +++ b/php_http_cookie.c @@ -12,8 +12,6 @@ #include "php_http_api.h" -#include - PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_init(php_http_cookie_list_t *list TSRMLS_DC) { if (!list) { diff --git a/php_http_curl.c b/php_http_curl.c index 5e58828..91b476c 100644 --- a/php_http_curl.c +++ b/php_http_curl.c @@ -21,9 +21,6 @@ # include #endif -#include - - typedef struct php_http_curl_request { CURL *handle; @@ -512,6 +509,7 @@ static int php_http_curl_request_pool_socket_callback(CURL *easy, curl_socket_t case CURL_POLL_REMOVE: efree(ev); + /* no break */ case CURL_POLL_NONE: return 0; diff --git a/php_http_env_response.c b/php_http_env_response.c index bc30b3c..2ddcb71 100644 --- a/php_http_env_response.c +++ b/php_http_env_response.c @@ -12,10 +12,6 @@ #include "php_http_api.h" -#include -#include - - static void set_option(zval *options, const char *name_str, size_t name_len, int type, const void *value_ptr, size_t value_len TSRMLS_DC) { if (Z_TYPE_P(options) == IS_OBJECT) { diff --git a/php_http_filter.c b/php_http_filter.c index 9b1c8db..121966b 100644 --- a/php_http_filter.c +++ b/php_http_filter.c @@ -401,13 +401,16 @@ static php_stream_filter *http_filter_create(const char *name, zval *params, int if (SUCCESS != zend_hash_find(HASH_OF(params), "flags", sizeof("flags"), (void *) &tmp)) { break; } + /* no break */ default: { zval *num = php_http_ztyp(IS_LONG, *tmp); flags |= (Z_LVAL_P(num) & 0x0fffffff); zval_ptr_dtor(&num); + } + break; } } if ((b = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_deflate_ops(), flags TSRMLS_CC))) { diff --git a/php_http_message.c b/php_http_message.c index 07f793b..d6a7f75 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -12,10 +12,6 @@ #include "php_http_api.h" -#include -#include -#include - PHP_HTTP_API zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info TSRMLS_DC) { php_http_message_t *old = *message; diff --git a/php_http_message_body.c b/php_http_message_body.c index cfe0f48..4ff36b5 100644 --- a/php_http_message_body.c +++ b/php_http_message_body.c @@ -13,7 +13,6 @@ #include "php_http_api.h" #include -#include #define BOUNDARY_OPEN(body) \ do {\ diff --git a/php_http_misc.c b/php_http_misc.c index 4df85cf..2860caa 100644 --- a/php_http_misc.c +++ b/php_http_misc.c @@ -13,7 +13,6 @@ #include "php_http_api.h" #include -#include #include /* SLEEP */ diff --git a/php_http_negotiate.c b/php_http_negotiate.c index 928a31d..aeb9521 100644 --- a/php_http_negotiate.c +++ b/php_http_negotiate.c @@ -12,8 +12,6 @@ #include "php_http_api.h" -#include - static int php_http_negotiate_sort(const void *a, const void *b TSRMLS_DC) { zval result, *first, *second; diff --git a/php_http_neon.c b/php_http_neon.c index 7bf1069..8a65237 100644 --- a/php_http_neon.c +++ b/php_http_neon.c @@ -16,8 +16,6 @@ #include "php_http_request.h" -#include - #include #include #include diff --git a/php_http_params.c b/php_http_params.c index 4b0e3f4..5f11ee4 100644 --- a/php_http_params.c +++ b/php_http_params.c @@ -12,9 +12,6 @@ #include "php_http_api.h" -#include -#include - static php_http_params_token_t def_param_sep = {",", 1}, *def_param_sep_ptr[] = {&def_param_sep, NULL}; static php_http_params_token_t def_arg_sep = {";", 1}, *def_arg_sep_ptr[] = {&def_arg_sep, NULL}; static php_http_params_token_t def_val_sep = {"=", 1}, *def_val_sep_ptr[] = {&def_val_sep, NULL}; @@ -288,10 +285,13 @@ PHP_METHOD(HttpParams, __construct) switch (ZEND_NUM_ARGS()) { case 4: zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), param_sep TSRMLS_CC); + /* no break */ case 3: zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), arg_sep TSRMLS_CC); + /* no break */ case 2: zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), val_sep TSRMLS_CC); + /* no break */ } if (zparams) { diff --git a/php_http_property_proxy.c b/php_http_property_proxy.c index ff768ba..fc75f6d 100644 --- a/php_http_property_proxy.c +++ b/php_http_property_proxy.c @@ -159,7 +159,7 @@ static void php_http_property_proxy_object_write_dimension(zval *object, zval *o switch (Z_TYPE_P(property)) { case IS_NULL: array_init(property); - /* fallthrough */ + /* no break */ case IS_ARRAY: Z_ADDREF_P(value); if (!offset) { diff --git a/php_http_querystring.c b/php_http_querystring.c index eeeeb20..ead598b 100644 --- a/php_http_querystring.c +++ b/php_http_querystring.c @@ -14,7 +14,6 @@ #include #include -#include #ifdef PHP_HTTP_HAVE_ICONV # undef PHP_ATOM_INC diff --git a/php_http_request.c b/php_http_request.c index 9bd820c..ea4d4dd 100644 --- a/php_http_request.c +++ b/php_http_request.c @@ -13,7 +13,6 @@ #include "php_http_api.h" #include -#include PHP_HTTP_API php_http_request_t *php_http_request_init(php_http_request_t *h, php_http_request_ops_t *ops, php_http_resource_factory_t *rf, void *init_arg TSRMLS_DC) { diff --git a/php_http_request_datashare.c b/php_http_request_datashare.c index 8bbaeb9..8312943 100644 --- a/php_http_request_datashare.c +++ b/php_http_request_datashare.c @@ -13,8 +13,6 @@ #include "php_http_api.h" #include -#include -#include static int php_http_request_datashare_compare_handles(void *h1, void *h2); diff --git a/php_http_request_factory.c b/php_http_request_factory.c index e69f6d1..b1655f6 100644 --- a/php_http_request_factory.c +++ b/php_http_request_factory.c @@ -12,7 +12,6 @@ #include "php_http_api.h" -#include #include /* diff --git a/php_http_request_pool.c b/php_http_request_pool.c index 0876809..4930122 100644 --- a/php_http_request_pool.c +++ b/php_http_request_pool.c @@ -12,8 +12,6 @@ #include "php_http_api.h" -#include - PHP_HTTP_API php_http_request_pool_t *php_http_request_pool_init(php_http_request_pool_t *h, php_http_request_pool_ops_t *ops, php_http_resource_factory_t *rf, void *init_arg TSRMLS_DC) { php_http_request_pool_t *free_h = NULL; diff --git a/php_http_url.c b/php_http_url.c index 7fe1664..b55b7d7 100644 --- a/php_http_url.c +++ b/php_http_url.c @@ -12,9 +12,6 @@ #include "php_http_api.h" -#include -#include - static inline char *localhostname(void) { char hostname[1024] = {0}; @@ -246,7 +243,7 @@ PHP_HTTP_API void php_http_url(int flags, const php_url *old_url, const php_url /* .. at the end */ ptr[1] = '\0'; } - /* fallthrough */ + /* no break */ default: /* something else */ diff --git a/php_http_url.h b/php_http_url.h index 02535d8..3216403 100644 --- a/php_http_url.h +++ b/php_http_url.h @@ -113,9 +113,11 @@ static inline HashTable *php_http_url_to_struct(php_url *url, zval *strct TSRMLS default: zval_dtor(strct); array_init(strct); + /* no break */ case IS_ARRAY: case IS_OBJECT: INIT_PZVAL_ARRAY((&arr), HASH_OF(strct)); + break; } } else { INIT_PZVAL(&arr); -- 2.30.2