@matheusbsbs / matheus-bagliano / commits / 9ccd0a88ac
Fork 0

Always initialize xpparam_t to 0

We're going to be adding some parameters to this, so we can't have any uninitialized data in it. Signed-off-by: Brian Downing <bdowning@lavos.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brian Downing committed Oct 25, 2008 at 15:30 UTC 9ccd0a88ac3ea13ac2df4630bfd01c02084f965e
5 files changed +9
builtin-blame.c
+1
@@ -523,6 +523,7 @@ static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o,
523 xdemitconf_t xecfg;
524 xdemitcb_t ecb;
525
526 + memset(&xpp, 0, sizeof(xpp));
527 xpp.flags = xdl_opts;
528 memset(&xecfg, 0, sizeof(xecfg));
529 xecfg.ctxlen = context;
builtin-rerere.c
+1
@@ -98,6 +98,7 @@ static int diff_two(const char *file1, const char *label1,
98
99 printf("--- a/%s\n+++ b/%s\n", label1, label2);
100 fflush(stdout);
101 + memset(&xpp, 0, sizeof(xpp));
102 xpp.flags = XDF_NEED_MINIMAL;
103 memset(&xecfg, 0, sizeof(xecfg));
104 xecfg.ctxlen = 3;
combine-diff.c
+1
@@ -213,6 +213,7 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,
213
214 parent_file.ptr = grab_blob(parent, &sz);
215 parent_file.size = sz;
216 + memset(&xpp, 0, sizeof(xpp));
217 xpp.flags = XDF_NEED_MINIMAL;
218 memset(&xecfg, 0, sizeof(xecfg));
219 memset(&state, 0, sizeof(state));
diff.c
+5
@@ -470,6 +470,7 @@ static void diff_words_show(struct diff_words_data *diff_words)
470 mmfile_t minus, plus;
471 int i;
472
473 + memset(&xpp, 0, sizeof(xpp));
474 memset(&xecfg, 0, sizeof(xecfg));
475 minus.size = diff_words->minus.text.size;
476 minus.ptr = xmalloc(minus.size);
@@ -1585,6 +1586,7 @@ static void builtin_diff(const char *name_a,
1586 if (!pe)
1587 pe = diff_funcname_pattern(two);
1588
1589 + memset(&xpp, 0, sizeof(xpp));
1590 memset(&xecfg, 0, sizeof(xecfg));
1591 memset(&ecbdata, 0, sizeof(ecbdata));
1592 ecbdata.label_path = lbl;
@@ -1658,6 +1660,7 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
1660 xdemitconf_t xecfg;
1661 xdemitcb_t ecb;
1662
1663 + memset(&xpp, 0, sizeof(xpp));
1664 memset(&xecfg, 0, sizeof(xecfg));
1665 xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
1666 xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat,
@@ -1704,6 +1707,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
1707 xdemitconf_t xecfg;
1708 xdemitcb_t ecb;
1709
1710 + memset(&xpp, 0, sizeof(xpp));
1711 memset(&xecfg, 0, sizeof(xecfg));
1712 xecfg.ctxlen = 1; /* at least one context line */
1713 xpp.flags = XDF_NEED_MINIMAL;
@@ -3149,6 +3153,7 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
3153 struct diff_filepair *p = q->queue[i];
3154 int len1, len2;
3155
3156 + memset(&xpp, 0, sizeof(xpp));
3157 memset(&xecfg, 0, sizeof(xecfg));
3158 if (p->status == 0)
3159 return error("internal diff status error");
merge-file.c
+1
@@ -61,6 +61,7 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2)
61 xdemitconf_t xecfg;
62 xdemitcb_t ecb;
63
64 + memset(&xpp, 0, sizeof(xpp));
65 xpp.flags = XDF_NEED_MINIMAL;
66 memset(&xecfg, 0, sizeof(xecfg));
67 xecfg.ctxlen = 3;