mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	A little tidying in style_parse.
This commit is contained in:
		
							
								
								
									
										23
									
								
								style.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								style.c
									
									
									
									
									
								
							| @@ -39,8 +39,7 @@ static struct style style_default = { | |||||||
| int | int | ||||||
| style_parse(struct style *sy, const struct grid_cell *base, const char *in) | style_parse(struct style *sy, const struct grid_cell *base, const char *in) | ||||||
| { | { | ||||||
| 	struct grid_cell	*gc = &sy->gc; | 	struct style	 saved; | ||||||
| 	struct grid_cell	 saved; |  | ||||||
| 	const char	 delimiters[] = " ,"; | 	const char	 delimiters[] = " ,"; | ||||||
| 	char		 tmp[32]; | 	char		 tmp[32]; | ||||||
| 	int		 value, fg, bg, attr, flags; | 	int		 value, fg, bg, attr, flags; | ||||||
| @@ -50,12 +49,12 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in) | |||||||
| 		return (0); | 		return (0); | ||||||
| 	if (strchr(delimiters, in[strlen(in) - 1]) != NULL) | 	if (strchr(delimiters, in[strlen(in) - 1]) != NULL) | ||||||
| 		return (-1); | 		return (-1); | ||||||
| 	memcpy(&saved, base, sizeof saved); | 	style_copy(&saved, sy); | ||||||
|  |  | ||||||
| 	fg = gc->fg; | 	fg = sy->gc.fg; | ||||||
| 	bg = gc->bg; | 	bg = sy->gc.bg; | ||||||
| 	attr = gc->attr; | 	attr = sy->gc.attr; | ||||||
| 	flags = gc->flags; | 	flags = sy->gc.flags; | ||||||
|  |  | ||||||
| 	do { | 	do { | ||||||
| 		end = strcspn(in, delimiters); | 		end = strcspn(in, delimiters); | ||||||
| @@ -99,15 +98,15 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in) | |||||||
| 		in += end + strspn(in + end, delimiters); | 		in += end + strspn(in + end, delimiters); | ||||||
| 	} while (*in != '\0'); | 	} while (*in != '\0'); | ||||||
|  |  | ||||||
| 	gc->fg = fg; | 	sy->gc.fg = fg; | ||||||
| 	gc->bg = bg; | 	sy->gc.bg = bg; | ||||||
| 	gc->attr = attr; | 	sy->gc.attr = attr; | ||||||
| 	gc->flags = flags; | 	sy->gc.flags = flags; | ||||||
|  |  | ||||||
| 	return (0); | 	return (0); | ||||||
|  |  | ||||||
| error: | error: | ||||||
| 	memcpy(gc, &saved, sizeof *gc); | 	style_copy(sy, &saved); | ||||||
| 	return (-1); | 	return (-1); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm