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>
This commit is contained in:
		 Brian Downing
					Brian Downing
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							7c4ed8c835
						
					
				
				
					commit
					9ccd0a88ac
				
			| @ -523,6 +523,7 @@ static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o, | |||||||
| 	xdemitconf_t xecfg; | 	xdemitconf_t xecfg; | ||||||
| 	xdemitcb_t ecb; | 	xdemitcb_t ecb; | ||||||
|  |  | ||||||
|  | 	memset(&xpp, 0, sizeof(xpp)); | ||||||
| 	xpp.flags = xdl_opts; | 	xpp.flags = xdl_opts; | ||||||
| 	memset(&xecfg, 0, sizeof(xecfg)); | 	memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 	xecfg.ctxlen = context; | 	xecfg.ctxlen = context; | ||||||
|  | |||||||
| @ -98,6 +98,7 @@ static int diff_two(const char *file1, const char *label1, | |||||||
|  |  | ||||||
| 	printf("--- a/%s\n+++ b/%s\n", label1, label2); | 	printf("--- a/%s\n+++ b/%s\n", label1, label2); | ||||||
| 	fflush(stdout); | 	fflush(stdout); | ||||||
|  | 	memset(&xpp, 0, sizeof(xpp)); | ||||||
| 	xpp.flags = XDF_NEED_MINIMAL; | 	xpp.flags = XDF_NEED_MINIMAL; | ||||||
| 	memset(&xecfg, 0, sizeof(xecfg)); | 	memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 	xecfg.ctxlen = 3; | 	xecfg.ctxlen = 3; | ||||||
|  | |||||||
| @ -213,6 +213,7 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file, | |||||||
|  |  | ||||||
| 	parent_file.ptr = grab_blob(parent, &sz); | 	parent_file.ptr = grab_blob(parent, &sz); | ||||||
| 	parent_file.size = sz; | 	parent_file.size = sz; | ||||||
|  | 	memset(&xpp, 0, sizeof(xpp)); | ||||||
| 	xpp.flags = XDF_NEED_MINIMAL; | 	xpp.flags = XDF_NEED_MINIMAL; | ||||||
| 	memset(&xecfg, 0, sizeof(xecfg)); | 	memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 	memset(&state, 0, sizeof(state)); | 	memset(&state, 0, sizeof(state)); | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								diff.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								diff.c
									
									
									
									
									
								
							| @ -470,6 +470,7 @@ static void diff_words_show(struct diff_words_data *diff_words) | |||||||
| 	mmfile_t minus, plus; | 	mmfile_t minus, plus; | ||||||
| 	int i; | 	int i; | ||||||
|  |  | ||||||
|  | 	memset(&xpp, 0, sizeof(xpp)); | ||||||
| 	memset(&xecfg, 0, sizeof(xecfg)); | 	memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 	minus.size = diff_words->minus.text.size; | 	minus.size = diff_words->minus.text.size; | ||||||
| 	minus.ptr = xmalloc(minus.size); | 	minus.ptr = xmalloc(minus.size); | ||||||
| @ -1585,6 +1586,7 @@ static void builtin_diff(const char *name_a, | |||||||
| 		if (!pe) | 		if (!pe) | ||||||
| 			pe = diff_funcname_pattern(two); | 			pe = diff_funcname_pattern(two); | ||||||
|  |  | ||||||
|  | 		memset(&xpp, 0, sizeof(xpp)); | ||||||
| 		memset(&xecfg, 0, sizeof(xecfg)); | 		memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 		memset(&ecbdata, 0, sizeof(ecbdata)); | 		memset(&ecbdata, 0, sizeof(ecbdata)); | ||||||
| 		ecbdata.label_path = lbl; | 		ecbdata.label_path = lbl; | ||||||
| @ -1658,6 +1660,7 @@ static void builtin_diffstat(const char *name_a, const char *name_b, | |||||||
| 		xdemitconf_t xecfg; | 		xdemitconf_t xecfg; | ||||||
| 		xdemitcb_t ecb; | 		xdemitcb_t ecb; | ||||||
|  |  | ||||||
|  | 		memset(&xpp, 0, sizeof(xpp)); | ||||||
| 		memset(&xecfg, 0, sizeof(xecfg)); | 		memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 		xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts; | 		xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts; | ||||||
| 		xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat, | 		xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat, | ||||||
| @ -1704,6 +1707,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b, | |||||||
| 		xdemitconf_t xecfg; | 		xdemitconf_t xecfg; | ||||||
| 		xdemitcb_t ecb; | 		xdemitcb_t ecb; | ||||||
|  |  | ||||||
|  | 		memset(&xpp, 0, sizeof(xpp)); | ||||||
| 		memset(&xecfg, 0, sizeof(xecfg)); | 		memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 		xecfg.ctxlen = 1; /* at least one context line */ | 		xecfg.ctxlen = 1; /* at least one context line */ | ||||||
| 		xpp.flags = XDF_NEED_MINIMAL; | 		xpp.flags = XDF_NEED_MINIMAL; | ||||||
| @ -3149,6 +3153,7 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1) | |||||||
| 		struct diff_filepair *p = q->queue[i]; | 		struct diff_filepair *p = q->queue[i]; | ||||||
| 		int len1, len2; | 		int len1, len2; | ||||||
|  |  | ||||||
|  | 		memset(&xpp, 0, sizeof(xpp)); | ||||||
| 		memset(&xecfg, 0, sizeof(xecfg)); | 		memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 		if (p->status == 0) | 		if (p->status == 0) | ||||||
| 			return error("internal diff status error"); | 			return error("internal diff status error"); | ||||||
|  | |||||||
| @ -61,6 +61,7 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2) | |||||||
| 	xdemitconf_t xecfg; | 	xdemitconf_t xecfg; | ||||||
| 	xdemitcb_t ecb; | 	xdemitcb_t ecb; | ||||||
|  |  | ||||||
|  | 	memset(&xpp, 0, sizeof(xpp)); | ||||||
| 	xpp.flags = XDF_NEED_MINIMAL; | 	xpp.flags = XDF_NEED_MINIMAL; | ||||||
| 	memset(&xecfg, 0, sizeof(xecfg)); | 	memset(&xecfg, 0, sizeof(xecfg)); | ||||||
| 	xecfg.ctxlen = 3; | 	xecfg.ctxlen = 3; | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user