mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Most of the utf8_data is fixed so simplify utf8_set to use a memcpy.
This commit is contained in:
		
							
								
								
									
										10
									
								
								utf8.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								utf8.c
									
									
									
									
									
								
							@@ -32,16 +32,10 @@ static int	utf8_width(wchar_t);
 | 
			
		||||
void
 | 
			
		||||
utf8_set(struct utf8_data *ud, u_char ch)
 | 
			
		||||
{
 | 
			
		||||
	u_int	i;
 | 
			
		||||
	static const struct utf8_data empty = { { 0 }, 1, 1, 1 };
 | 
			
		||||
 | 
			
		||||
	memcpy(ud, &empty, sizeof *ud);
 | 
			
		||||
	*ud->data = ch;
 | 
			
		||||
	ud->have = 1;
 | 
			
		||||
	ud->size = 1;
 | 
			
		||||
 | 
			
		||||
	ud->width = 1;
 | 
			
		||||
 | 
			
		||||
	for (i = ud->size; i < sizeof ud->data; i++)
 | 
			
		||||
		ud->data[i] = '\0';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Copy UTF-8 character. */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user