prefer comment_line_str to comment_line_char for printing
As part of our transition to multi-byte comment characters, we should use the string variable rather than the historical character variable. All of the sites adjusted here are just swapping out "%c" for "%s" in format strings, or strbuf_addch() for strbuf_addstr(). The type system and printf-attribute give the compiler enough information to make sure our formats and variable changes all match (especially important for cases where the format string is defined far away from its use, like prepare_to_commit() in commit.c). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							a1bb146aaf
						
					
				
				
					commit
					f99e1d94f5
				
			
							
								
								
									
										10
									
								
								wt-status.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								wt-status.c
									
									
									
									
									
								
							@ -70,7 +70,7 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,
 | 
			
		||||
	strbuf_vaddf(&sb, fmt, ap);
 | 
			
		||||
	if (!sb.len) {
 | 
			
		||||
		if (s->display_comment_prefix) {
 | 
			
		||||
			strbuf_addch(&sb, comment_line_char);
 | 
			
		||||
			strbuf_addstr(&sb, comment_line_str);
 | 
			
		||||
			if (!trail)
 | 
			
		||||
				strbuf_addch(&sb, ' ');
 | 
			
		||||
		}
 | 
			
		||||
@ -85,7 +85,7 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,
 | 
			
		||||
 | 
			
		||||
		strbuf_reset(&linebuf);
 | 
			
		||||
		if (at_bol && s->display_comment_prefix) {
 | 
			
		||||
			strbuf_addch(&linebuf, comment_line_char);
 | 
			
		||||
			strbuf_addstr(&linebuf, comment_line_str);
 | 
			
		||||
			if (*line != '\n' && *line != '\t')
 | 
			
		||||
				strbuf_addch(&linebuf, ' ');
 | 
			
		||||
		}
 | 
			
		||||
@ -1090,7 +1090,7 @@ size_t wt_status_locate_end(const char *s, size_t len)
 | 
			
		||||
	const char *p;
 | 
			
		||||
	struct strbuf pattern = STRBUF_INIT;
 | 
			
		||||
 | 
			
		||||
	strbuf_addf(&pattern, "\n%c %s", comment_line_char, cut_line);
 | 
			
		||||
	strbuf_addf(&pattern, "\n%s %s", comment_line_str, cut_line);
 | 
			
		||||
	if (starts_with(s, pattern.buf + 1))
 | 
			
		||||
		len = 0;
 | 
			
		||||
	else if ((p = strstr(s, pattern.buf)))
 | 
			
		||||
@ -1214,8 +1214,8 @@ static void wt_longstatus_print_tracking(struct wt_status *s)
 | 
			
		||||
				 "%s%.*s", comment_line_string,
 | 
			
		||||
				 (int)(ep - cp), cp);
 | 
			
		||||
	if (s->display_comment_prefix)
 | 
			
		||||
		color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
 | 
			
		||||
				 comment_line_char);
 | 
			
		||||
		color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%s",
 | 
			
		||||
				 comment_line_str);
 | 
			
		||||
	else
 | 
			
		||||
		fputs("\n", s->fp);
 | 
			
		||||
	strbuf_release(&sb);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user