@matheusbsbs / matheus-bagliano / commits / 8e24cbaeaf
Fork 0

Fix various dead stores found by the clang static analyzer

http-push.c::finish_request(): request is initialized by the for loop index-pack.c::free_base_data(): b is initialized by the for loop merge-recursive.c::process_renames(): move compare to narrower scope, and remove unused assignments to it remove unused variable renames2 xdiff/xdiffi.c::xdl_recs_cmp(): remove unused variable ec xdiff/xemit.c::xdl_emit_diff(): xche is always overwritten Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Benjamin Kramer committed Mar 15, 2009 at 22:01 UTC 8e24cbaeafc7eed709e251fda1673ffea84edfb1
5 files changed +8 -14
http-push.c
+1 -1
@@ -816,7 +816,7 @@ static void finish_request(struct transfer_request *request)
816 #ifdef USE_CURL_MULTI
817 static int fill_active_slot(void *unused)
818 {
819 - struct transfer_request *request = request_queue_head;
819 + struct transfer_request *request;
820
821 if (aborted)
822 return 0;
index-pack.c
+1 -1
@@ -232,7 +232,7 @@ static void free_base_data(struct base_data *c)
232
233 static void prune_base_data(struct base_data *retain)
234 {
235 - struct base_data *b = base_cache;
235 + struct base_data *b;
236 for (b = base_cache;
237 base_cache_used > delta_base_cache_limit && b;
238 b = b->child) {
merge-recursive.c
+3 -8
@@ -801,22 +801,19 @@ static int process_renames(struct merge_options *o,
801 }
802
803 for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
804 - int compare;
804 char *src;
806 - struct string_list *renames1, *renames2, *renames2Dst;
805 + struct string_list *renames1, *renames2Dst;
806 struct rename *ren1 = NULL, *ren2 = NULL;
807 const char *branch1, *branch2;
808 const char *ren1_src, *ren1_dst;
809
810 if (i >= a_renames->nr) {
812 - compare = 1;
811 ren2 = b_renames->items[j++].util;
812 } else if (j >= b_renames->nr) {
815 - compare = -1;
813 ren1 = a_renames->items[i++].util;
814 } else {
818 - compare = strcmp(a_renames->items[i].string,
819 - b_renames->items[j].string);
815 + int compare = strcmp(a_renames->items[i].string,
816 + b_renames->items[j].string);
817 if (compare <= 0)
818 ren1 = a_renames->items[i++].util;
819 if (compare >= 0)
@@ -826,14 +823,12 @@ static int process_renames(struct merge_options *o,
823 /* TODO: refactor, so that 1/2 are not needed */
824 if (ren1) {
825 renames1 = a_renames;
829 - renames2 = b_renames;
826 renames2Dst = &b_by_dst;
827 branch1 = o->branch1;
828 branch2 = o->branch2;
829 } else {
830 struct rename *tmp;
831 renames1 = b_renames;
836 - renames2 = a_renames;
832 renames2Dst = &a_by_dst;
833 branch1 = o->branch2;
834 branch2 = o->branch1;
xdiff/xdiffi.c
+2 -3
@@ -293,15 +293,14 @@ int xdl_recs_cmp(diffdata_t *dd1, long off1, long lim1,
293 for (; off1 < lim1; off1++)
294 rchg1[rindex1[off1]] = 1;
295 } else {
296 - long ec;
296 xdpsplit_t spl;
297 spl.i1 = spl.i2 = 0;
298
299 /*
300 * Divide ...
301 */
303 - if ((ec = xdl_split(ha1, off1, lim1, ha2, off2, lim2, kvdf, kvdb,
304 - need_min, &spl, xenv)) < 0) {
302 + if (xdl_split(ha1, off1, lim1, ha2, off2, lim2, kvdf, kvdb,
303 + need_min, &spl, xenv) < 0) {
304
305 return -1;
306 }
xdiff/xemit.c
+1 -1
@@ -132,7 +132,7 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
132 if (xecfg->flags & XDL_EMIT_COMMON)
133 return xdl_emit_common(xe, xscr, ecb, xecfg);
134
135 - for (xch = xche = xscr; xch; xch = xche->next) {
135 + for (xch = xscr; xch; xch = xche->next) {
136 xche = xdl_get_hunk(xch, xecfg);
137
138 s1 = XDL_MAX(xch->i1 - xecfg->ctxlen, 0);