Browse Source

clean some dead code (with static analysis help)

PECL
Nuno Lopes 18 years ago
parent
commit
8a77e55566
  1. 1
      Zend/zend_constants.c
  2. 1
      ext/iconv/iconv.c
  3. 1
      ext/pcre/php_pcre.c
  4. 1
      ext/standard/array.c
  5. 2
      ext/standard/base64.c
  6. 2
      ext/standard/image.c
  7. 12
      ext/standard/versioning.c
  8. 5
      main/rfc1867.c
  9. 7
      main/streams/glob_wrapper.c

1
Zend/zend_constants.c

@ -379,7 +379,6 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
name = constant_name;
name_len = const_name_len;
efree(class_name);
retval = 1;
return zend_get_constant(name, name_len, result TSRMLS_CC);
}
if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {

1
ext/iconv/iconv.c

@ -1295,7 +1295,6 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
char_cnt -= 3;
}
}
prev_in_left = in_left;
smart_str_appendl(pretval, "?=", sizeof("?=") - 1);
char_cnt -= 2;

1
ext/pcre/php_pcre.c

@ -894,7 +894,6 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
} else {
esc_match = "";
esc_match_len = 0;
match_len = 0;
}
smart_str_appendl(&code, esc_match, esc_match_len);

1
ext/standard/array.c

@ -3347,7 +3347,6 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
} else if (behavior & DIFF_ASSOC) { /* triggered also if DIFF_KEY */
/* DIFF_KEY is subset of DIFF_ASSOC. When having the former
* no comparison of the data is done (part of DIFF_ASSOC) */
diff_key_compare_func = php_array_key_compare;
if (data_compare_type == DIFF_COMP_DATA_INTERNAL && key_compare_type == DIFF_COMP_KEY_INTERNAL) {
/* array_diff_assoc() or array_diff_key() */

2
ext/standard/base64.c

@ -190,7 +190,7 @@ PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, int length,
case 2:
k++;
case 3:
result[k++] = 0;
result[k] = 0;
}
}
if(ret_length) {

2
ext/standard/image.c

@ -653,7 +653,7 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream TSRMLS_DC)
}
/* Collect bit depth info */
highest_bit_depth = bit_depth = 0;
highest_bit_depth = 0;
for (i = 0; i < result->channels; i++) {
bit_depth = php_stream_getc(stream); /* Ssiz[i] */
bit_depth++;

12
ext/standard/versioning.c

@ -45,7 +45,7 @@ php_canonicalize_version(const char *version)
p = version;
q = buf;
*q++ = lp = *p++;
lq = '\0';
while (*p) {
/* s/[-_+]/./g;
* s/([^\d\.])([^\D\.])/$1.$2/g;
@ -55,22 +55,22 @@ php_canonicalize_version(const char *version)
#define isndig(x) (!isdigit(x)&&(x)!='.')
#define isspecialver(x) ((x)=='-'||(x)=='_'||(x)=='+')
lq = *(q - 1);
lq = *(q - 1);
if (isspecialver(*p)) {
if (lq != '.') {
lq = *q++ = '.';
*q++ = '.';
}
} else if ((isndig(lp) && isdig(*p)) || (isdig(lp) && isndig(*p))) {
if (lq != '.') {
*q++ = '.';
}
lq = *q++ = *p;
*q++ = *p;
} else if (!isalnum(*p)) {
if (lq != '.') {
lq = *q++ = '.';
*q++ = '.';
}
} else {
lq = *q++ = *p;
*q++ = *p;
}
lp = *p++;
}

5
main/rfc1867.c

@ -203,7 +203,8 @@ static void normalize_protected_variable(char *varname TSRMLS_DC)
index = NULL;
}
}
*s++='\0';
*s = '\0';
}
@ -610,7 +611,7 @@ static char *substring_conf(char *start, int len, char quote TSRMLS_DC)
}
}
*resp++ = '\0';
*resp = '\0';
return result;
}

7
main/streams/glob_wrapper.c

@ -209,7 +209,7 @@ static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, char *pat
int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
{
glob_s_t *pglob;
int ret, path_len;
int ret;
char *tmp, *pos;
if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) {
@ -218,12 +218,9 @@ static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, char *pat
if (!strncmp(path, "glob://", sizeof("glob://")-1)) {
path += sizeof("glob://")-1;
path_len = strlen(path);
if (opened_path) {
*opened_path = estrndup(path, path_len);
*opened_path = estrdup(path);
}
} else {
path_len = strlen(path);
}
pglob = ecalloc(sizeof(*pglob), 1);

Loading…
Cancel
Save