summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2013-08-14 20:36:50 -0700
committerChristopher Jones <sixd@php.net>2013-08-14 20:36:50 -0700
commit9ad97cd48903ea5454853960f2c14de326e0f624 (patch)
tree9607bef3020deb8da37bacdb1c14624f4b5d1d2f
parent9d62807190ebda858acbb09ad832c96570a97c40 (diff)
downloadphp-git-9ad97cd48903ea5454853960f2c14de326e0f624.tar.gz
Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings.
-rw-r--r--ext/date/php_date.c6
-rw-r--r--ext/dba/dba.c1
-rw-r--r--ext/dba/libinifile/inifile.c2
-rw-r--r--ext/dom/xpath.c2
-rw-r--r--ext/gmp/gmp.c2
-rw-r--r--ext/intl/grapheme/grapheme_util.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c4
-rw-r--r--ext/openssl/openssl.c2
-rw-r--r--ext/openssl/xp_ssl.c2
-rw-r--r--ext/session/session.c2
-rw-r--r--ext/simplexml/simplexml.c2
-rw-r--r--ext/snmp/snmp.c2
-rw-r--r--ext/spl/spl_array.c2
-rw-r--r--ext/spl/spl_dllist.c2
-rw-r--r--ext/standard/array.c9
-rw-r--r--ext/standard/html.c6
-rw-r--r--ext/standard/string.c4
-rw-r--r--ext/standard/url_scanner_ex.re2
-rw-r--r--ext/xsl/xsltprocessor.c2
-rw-r--r--ext/zip/php_zip.c2
-rw-r--r--main/php_variables.c2
-rw-r--r--main/rfc1867.c2
-rw-r--r--sapi/cli/php_cli_server.c2
23 files changed, 31 insertions, 33 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 270c05832d..f091fed182 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -997,7 +997,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
static char *date_format(char *format, int format_len, timelib_time *t, int localtime)
{
smart_str string = {0};
- int i, length;
+ int i, length = 0;
char buffer[97];
timelib_time_offset *offset = NULL;
timelib_sll isoweek, isoyear;
@@ -2409,8 +2409,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
timelib_time *now;
timelib_tzinfo *tzi = NULL;
timelib_error_container *err = NULL;
- int type = TIMELIB_ZONETYPE_ID, new_dst;
- char *new_abbr;
+ int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
+ char *new_abbr = NULL;
timelib_sll new_offset;
if (dateobj->time) {
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 5295ab3673..8005101de3 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -538,7 +538,6 @@ PHP_MINFO_FUNCTION(dba)
*/
static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
- char *v;
int val_len;
zval *id;
dba_info *info = NULL;
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index 89373b1e33..3cd97702b3 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.c
@@ -460,7 +460,7 @@ static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRML
*/
static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, int append TSRMLS_DC)
{
- size_t pos_grp_start, pos_grp_next;
+ size_t pos_grp_start = 0, pos_grp_next;
inifile *ini_tmp = NULL;
php_stream *fp_tmp = NULL;
int ret;
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index cf556a3505..d12ef30323 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -74,7 +74,7 @@ const zend_function_entry php_dom_xpath_class_functions[] = {
static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
{
- zval **args;
+ zval **args = NULL;
zval *retval;
int result, i, ret;
int error = 0;
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index f8c3a0773b..e3a3563aac 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1069,7 +1069,7 @@ ZEND_FUNCTION(gmp_powm)
zval **base_arg, **exp_arg, **mod_arg;
mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
int use_ui = 0;
- int temp_base, temp_exp, temp_mod;
+ int temp_base = 0, temp_exp = 0, temp_mod;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ", &base_arg, &exp_arg, &mod_arg) == FAILURE){
return;
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index 883fa0391a..c752b02372 100644
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
@@ -130,7 +130,7 @@ void grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char
/* {{{ grapheme_strpos_utf16 - strrpos using utf16*/
int grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last TSRMLS_DC)
{
- UChar *uhaystack = NULL, *puhaystack, *uneedle = NULL;
+ UChar *uhaystack = NULL, *uneedle = NULL;
int32_t uhaystack_len = 0, uneedle_len = 0, char_pos, ret_pos, offset_pos = 0;
unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE];
UBreakIterator* bi = NULL;
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index a6a73f5f04..7c1a5c28b8 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -162,8 +162,8 @@ PHP_FUNCTION( resourcebundle_create )
/* {{{ resourcebundle_array_fetch */
static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback TSRMLS_DC)
{
- int32_t meindex;
- char * mekey;
+ int32_t meindex = 0;
+ char * mekey = NULL;
long mekeylen;
zend_bool is_numeric = 0;
char *pbuf;
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c32748cb64..68be86f833 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -578,7 +578,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
for (i = 0; i < X509_NAME_entry_count(name); i++) {
unsigned char *to_add;
- int to_add_len;
+ int to_add_len = 0;
ne = X509_NAME_get_entry(name, i);
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index e19e8f098d..6e74d8024f 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -472,7 +472,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream,
do {
struct timeval cur_time,
- elapsed_time;
+ elapsed_time = {0};
if (sslsock->is_client) {
n = SSL_connect(sslsock->ssl_handle);
diff --git a/ext/session/session.c b/ext/session/session.c
index dba3952563..e699cb9b5c 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -281,7 +281,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
PHP_MD5_CTX md5_context;
PHP_SHA1_CTX sha1_context;
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
- void *hash_context;
+ void *hash_context = NULL;
#endif
unsigned char *digest;
int digest_len;
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 692516840b..2358f2be65 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1070,7 +1070,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{
int namelen;
int test;
char use_iter;
- zval *iter_data;
+ zval *iter_data = NULL;
use_iter = 0;
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 727328b407..93c2b21ddc 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -514,7 +514,7 @@ static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS
static void php_snmp_error(zval *object, const char *docref TSRMLS_DC, int type, const char *format, ...)
{
va_list args;
- php_snmp_object *snmp_object;
+ php_snmp_object *snmp_object = NULL;
if (object) {
snmp_object = (php_snmp_object *)zend_object_store_get_object(object TSRMLS_CC);
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 0bfb65890c..552f67b185 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -166,7 +166,7 @@ zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object,
/* {{{ spl_array_object_new_ex */
static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, zval *orig, int clone_orig TSRMLS_DC)
{
- zend_object_value retval;
+ zend_object_value retval = {0};
spl_array_object *intern;
zval *tmp;
zend_class_entry * parent = class_type;
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 215476a724..f7be97d4ce 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -368,7 +368,7 @@ zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object
static zend_object_value spl_dllist_object_new_ex(zend_class_entry *class_type, spl_dllist_object **obj, zval *orig, int clone_orig TSRMLS_DC) /* {{{ */
{
- zend_object_value retval;
+ zend_object_value retval = {0};
spl_dllist_object *intern;
zend_class_entry *parent = class_type;
int inherited = 0;
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 0eaca16618..1deacc7159 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2996,8 +2996,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
char *param_spec;
zend_fcall_info fci1, fci2;
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
- zend_fcall_info *fci_key, *fci_data;
- zend_fcall_info_cache *fci_key_cache, *fci_data_cache;
+ zend_fcall_info *fci_key = NULL, *fci_data;
+ zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache;
PHP_ARRAY_CMP_FUNC_VARS;
int (*intersect_key_compare_func)(const void *, const void * TSRMLS_DC);
@@ -3414,8 +3414,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
char *param_spec;
zend_fcall_info fci1, fci2;
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
- zend_fcall_info *fci_key, *fci_data;
- zend_fcall_info_cache *fci_key_cache, *fci_data_cache;
+ zend_fcall_info *fci_key = NULL, *fci_data;
+ zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache;
PHP_ARRAY_CMP_FUNC_VARS;
int (*diff_key_compare_func)(const void *, const void * TSRMLS_DC);
@@ -4019,7 +4019,6 @@ PHP_FUNCTION(array_sum)
**entry,
entry_n;
HashPosition pos;
- double dval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) {
return;
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 414fa65c91..b4d9ba109d 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1221,8 +1221,8 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size
const enc_to_uni *to_uni_table = NULL;
const entity_ht *inv_map = NULL; /* used for !double_encode */
/* only used if flags includes ENT_HTML_IGNORE_ERRORS or ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS */
- const unsigned char *replacement;
- size_t replacement_len;
+ const unsigned char *replacement = NULL;
+ size_t replacement_len = 0;
if (all) { /* replace with all named entities */
if (CHARSET_PARTIAL_SUPPORT(charset)) {
@@ -1596,7 +1596,7 @@ PHP_FUNCTION(get_html_translation_table)
flags = ENT_COMPAT;
int doctype;
entity_table_opt entity_table;
- const enc_to_uni *to_uni_table;
+ const enc_to_uni *to_uni_table = NULL;
char *charset_hint = NULL;
int charset_hint_len;
enum entity_charset charset;
diff --git a/ext/standard/string.c b/ext/standard/string.c
index b32cc7cd94..c744cb46fc 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3253,7 +3253,7 @@ static void php_similar_str(const char *txt1, int len1, const char *txt2, int le
static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2)
{
int sum;
- int pos1, pos2, max;
+ int pos1 = 0, pos2 = 0, max;
php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max);
if ((sum = max)) {
@@ -4613,7 +4613,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow,
char *tbuf, *buf, *p, *tp, *rp, c, lc;
int br, i=0, depth=0, in_q = 0;
int state = 0, pos;
- char *allow_free;
+ char *allow_free = NULL;
if (stateptr)
state = *stateptr;
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index f0dee8ebc1..ecacb76f94 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -463,7 +463,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC)
{
- char *encoded;
+ char *encoded = NULL;
int encoded_len;
smart_str val;
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 1785519c15..af11104a2e 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -476,7 +476,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC) /* {{{ */
{
- xmlDocPtr newdocp;
+ xmlDocPtr newdocp = NULL;
xmlDocPtr doc = NULL;
xmlNodePtr node = NULL;
xsltTransformContextPtr ctxt;
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 0c033d4e46..d7bd5f49e6 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1654,7 +1654,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
char *path = NULL;
char *remove_path = NULL;
char *add_path = NULL;
- int pattern_len, add_path_len, remove_path_len, path_len = 0;
+ int pattern_len, add_path_len = 0, remove_path_len = 0, path_len = 0;
long remove_all_path = 0;
long flags = 0;
zval *options = NULL;
diff --git a/main/php_variables.c b/main/php_variables.c
index cf2b623d61..4c614692bb 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -56,7 +56,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array TSRMLS_DC)
{
char *p = NULL;
- char *ip; /* index pointer */
+ char *ip = NULL; /* index pointer */
char *index;
char *var, *var_orig;
int var_len, index_len;
diff --git a/main/rfc1867.c b/main/rfc1867.c
index b9007f2cb8..8e4820988d 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -398,7 +398,7 @@ static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC)
static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC)
{
char *line;
- mime_header_entry prev_entry, entry;
+ mime_header_entry prev_entry = {0}, entry;
int prev_len, cur_len;
/* didn't find boundary, abort */
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 335d589a67..5a12134a91 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1325,7 +1325,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque
static const char *index_files[] = { "index.php", "index.html", NULL };
char *buf = safe_pemalloc(1, request->vpath_len, 1 + document_root_len + 1 + sizeof("index.html"), 1);
char *p = buf, *prev_path = NULL, *q, *vpath;
- size_t prev_path_len;
+ size_t prev_path_len = 0;
int is_static_file = 0;
if (!buf) {