mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Simplify args_set, from Tiago Cunha.
This commit is contained in:
		
							
								
								
									
										14
									
								
								arguments.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								arguments.c
									
									
									
									
									
								
							@@ -205,19 +205,15 @@ args_set(struct args *args, u_char ch, const char *value)
 | 
			
		||||
	/* Replace existing argument. */
 | 
			
		||||
	if ((entry = args_find(args, ch)) != NULL) {
 | 
			
		||||
		free(entry->value);
 | 
			
		||||
		if (value != NULL)
 | 
			
		||||
			entry->value = xstrdup(value);
 | 
			
		||||
		else
 | 
			
		||||
			entry->value = NULL;
 | 
			
		||||
		return;
 | 
			
		||||
		entry->value = NULL;
 | 
			
		||||
	} else {
 | 
			
		||||
		entry = xcalloc(1, sizeof *entry);
 | 
			
		||||
		entry->flag = ch;
 | 
			
		||||
		RB_INSERT(args_tree, &args->tree, entry);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	entry = xcalloc(1, sizeof *entry);
 | 
			
		||||
	entry->flag = ch;
 | 
			
		||||
	if (value != NULL)
 | 
			
		||||
		entry->value = xstrdup(value);
 | 
			
		||||
 | 
			
		||||
	RB_INSERT(args_tree, &args->tree, entry);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Get argument value. Will be NULL if it isn't present. */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user