Skip to content

Commit b6f9ade

Browse files
Fabien Villepintecmb69
Fabien Villepinte
authored andcommitted
Remove unused variables
1 parent eabca6f commit b6f9ade

File tree

7 files changed

+23
-30
lines changed

7 files changed

+23
-30
lines changed

ext/fileinfo/libmagic.patch

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,17 +2840,16 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
28402840
{
28412841
- int rv;
28422842
va_list ap;
2843-
+ size_t len;
28442843
+ char *buf = NULL, *newstr;
28452844

28462845
va_start(ap, fmt);
28472846
- rv = file_vprintf(ms, fmt, ap);
2848-
+ len = vspprintf(&buf, 0, fmt, ap);
2847+
+ vspprintf(&buf, 0, fmt, ap);
28492848
va_end(ap);
28502849
- return rv;
28512850
+
28522851
+ if (ms->o.buf != NULL) {
2853-
+ len = spprintf(&newstr, 0, "%s%s", ms->o.buf, (buf ? buf : ""));
2852+
+ spprintf(&newstr, 0, "%s%s", ms->o.buf, (buf ? buf : ""));
28542853
+ if (buf) {
28552854
+ efree(buf);
28562855
+ }
@@ -2904,15 +2903,15 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
29042903
ms->event_flags |= EVENT_HAD_ERR;
29052904
ms->error = error;
29062905
}
2907-
@@ -160,7 +158,6 @@
2906+
@@ -160,7 +157,6 @@
29082907
file_error(ms, errno, "error reading");
29092908
}
29102909

29112910
-#ifndef COMPILE_ONLY
29122911

29132912
static int
29142913
checkdone(struct magic_set *ms, int *rv)
2915-
@@ -174,8 +171,8 @@
2914+
@@ -174,8 +170,8 @@
29162915

29172916
/*ARGSUSED*/
29182917
protected int
@@ -2923,7 +2922,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
29232922
{
29242923
int m = 0, rv = 0, looks_text = 0;
29252924
const char *code = NULL;
2926-
@@ -184,7 +181,8 @@
2925+
@@ -184,7 +180,8 @@
29272926
const char *def = "data";
29282927
const char *ftype = NULL;
29292928
struct buffer b;
@@ -2933,7 +2932,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
29332932
buffer_init(&b, fd, buf, nb);
29342933

29352934
if (nb == 0) {
2936-
@@ -216,8 +214,8 @@
2935+
@@ -216,8 +213,8 @@
29372936
}
29382937
}
29392938
#endif
@@ -2944,7 +2943,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
29442943
if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
29452944
m = file_zmagic(ms, &b, inname);
29462945
if ((ms->flags & MAGIC_DEBUG) != 0)
2947-
@@ -239,13 +237,22 @@
2946+
@@ -239,13 +236,22 @@
29482947
}
29492948

29502949
/* Check if we have a CDF file */
@@ -2974,7 +2973,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
29742973
}
29752974
}
29762975

2977-
@@ -315,7 +322,7 @@
2976+
@@ -315,7 +321,7 @@
29782977
if (file_printf(ms, "%s", code_mime) == -1)
29792978
rv = -1;
29802979
}
@@ -2983,15 +2982,15 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
29832982
done_encoding:
29842983
#endif
29852984
buffer_fini(&b);
2986-
@@ -324,7 +331,6 @@
2985+
@@ -324,7 +330,6 @@
29872986

29882987
return m;
29892988
}
29902989
-#endif
29912990

29922991
protected int
29932992
file_reset(struct magic_set *ms, int checkloaded)
2994-
@@ -334,11 +340,11 @@
2993+
@@ -334,11 +339,11 @@
29952994
return -1;
29962995
}
29972996
if (ms->o.buf) {
@@ -3005,7 +3004,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
30053004
ms->o.pbuf = NULL;
30063005
}
30073006
ms->event_flags &= ~EVENT_HAD_ERR;
3008-
@@ -376,7 +382,7 @@
3007+
@@ -376,7 +381,7 @@
30093008
return NULL;
30103009
}
30113010
psize = len * 4 + 1;
@@ -3014,7 +3013,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
30143013
file_oomem(ms, psize);
30153014
return NULL;
30163015
}
3017-
@@ -440,8 +446,8 @@
3016+
@@ -440,8 +445,8 @@
30183017
if (level >= ms->c.len) {
30193018
len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
30203019
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
@@ -3025,7 +3024,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
30253024
if (ms->c.li == NULL) {
30263025
file_oomem(ms, len);
30273026
return -1;
3028-
@@ -464,76 +470,41 @@
3027+
@@ -464,76 +469,41 @@
30293028
protected int
30303029
file_replace(struct magic_set *ms, const char *pat, const char *rep)
30313030
{
@@ -3131,7 +3130,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
31313130
}
31323131

31333132
protected file_pushbuf_t *
3134-
@@ -544,7 +515,7 @@
3133+
@@ -544,7 +514,7 @@
31353134
if (ms->event_flags & EVENT_HAD_ERR)
31363135
return NULL;
31373136

@@ -3140,7 +3139,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
31403139
return NULL;
31413140

31423141
pb->buf = ms->o.buf;
3143-
@@ -562,8 +533,8 @@
3142+
@@ -562,8 +532,8 @@
31443143
char *rbuf;
31453144

31463145
if (ms->event_flags & EVENT_HAD_ERR) {
@@ -3151,7 +3150,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
31513150
return NULL;
31523151
}
31533152

3154-
@@ -572,7 +543,7 @@
3153+
@@ -572,7 +542,7 @@
31553154
ms->o.buf = pb->buf;
31563155
ms->offset = pb->offset;
31573156

ext/fileinfo/libmagic/funcs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,14 @@ protected int
6060
file_printf(struct magic_set *ms, const char *fmt, ...)
6161
{
6262
va_list ap;
63-
size_t len;
6463
char *buf = NULL, *newstr;
6564

6665
va_start(ap, fmt);
67-
len = vspprintf(&buf, 0, fmt, ap);
66+
vspprintf(&buf, 0, fmt, ap);
6867
va_end(ap);
6968

7069
if (ms->o.buf != NULL) {
71-
len = spprintf(&newstr, 0, "%s%s", ms->o.buf, (buf ? buf : ""));
70+
spprintf(&newstr, 0, "%s%s", ms->o.buf, (buf ? buf : ""));
7271
if (buf) {
7372
efree(buf);
7473
}

ext/gd/gd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
25922592
FILE *fp;
25932593
size_t file_len = 0;
25942594
int argc = ZEND_NUM_ARGS();
2595-
int q = -1, i, t = 1;
2595+
int q = -1, t = 1;
25962596

25972597
/* The quality parameter for Wbmp stands for the foreground when called from image2wbmp() */
25982598
/* The quality parameter for gd2 stands for chunk size */

ext/gd/libgd/gd_gif_in.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
139139
unsigned char ColorMap[3][MAXCOLORMAPSIZE];
140140
unsigned char localColorMap[3][MAXCOLORMAPSIZE];
141141
int imw, imh, screen_width, screen_height;
142-
int gif87a, useGlobalColormap;
142+
int useGlobalColormap;
143143
int bitPixel;
144144
int i;
145145
/*1.4//int imageCount = 0; */
@@ -160,9 +160,9 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
160160
}
161161

162162
if (memcmp((char *)buf+3, "87a", 3) == 0) {
163-
gif87a = 1;
163+
/* GIF87a */
164164
} else if (memcmp((char *)buf+3, "89a", 3) == 0) {
165-
gif87a = 0;
165+
/* GIF89a */
166166
} else {
167167
return 0;
168168
}

ext/gd/libgd/gdhelpers.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ char *
1515
gd_strtok_r (char *s, char *sep, char **state)
1616
{
1717
char separators[256];
18-
char *start;
1918
char *result = 0;
2019
memset (separators, 0, sizeof (separators));
2120
while (*sep)
@@ -28,7 +27,6 @@ gd_strtok_r (char *s, char *sep, char **state)
2827
/* Pick up where we left off */
2928
s = *state;
3029
}
31-
start = s;
3230
/* 1. EOS */
3331
if (!(*s))
3432
{

ext/standard/formatted_print.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ php_sprintf_getnumber(char **buffer, size_t *len)
363363

364364
if (endptr != NULL) {
365365
i = (endptr - *buffer);
366-
*len -= endptr - *buffer;
366+
*len -= i;
367367
*buffer = endptr;
368368
}
369369
PRINTF_DEBUG(("sprintf_getnumber: number was %d bytes long\n", i));

ext/zip/php_zip.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
619619
{
620620
#ifdef ZTS
621621
char cwd[MAXPATHLEN];
622-
int cwd_skip = 0;
623622
char work_path[MAXPATHLEN];
624623
char *result;
625624
#endif
@@ -638,8 +637,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
638637
cwd[2] = '\0';
639638
}
640639
#endif
641-
cwd_skip = strlen(cwd)+1;
642-
643640
snprintf(work_path, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, path);
644641
path = work_path;
645642
}

0 commit comments

Comments
 (0)