Microoptimization
It hurts me to see wasted mallocs.
This commit is contained in:
		
							parent
							
								
									a63db9d978
								
							
						
					
					
						commit
						6f91f8131a
					
				
							
								
								
									
										11
									
								
								src/sdtui.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/sdtui.c
									
									
									
									
									
								
							| @ -244,11 +244,12 @@ struct application | |||||||
| static void | static void | ||||||
| view_entry_split_add (GPtrArray *out, const gchar *text) | view_entry_split_add (GPtrArray *out, const gchar *text) | ||||||
| { | { | ||||||
| 	gchar **it, **tmp = g_strsplit (text, "\n", -1); | 	const gchar *p = text, *nl; | ||||||
| 	for (it = tmp; *it; it++) | 	for (; (nl = strchr (p, '\n')); p = nl + 1) | ||||||
| 		if (**it) | 		if (nl != p) | ||||||
| 			g_ptr_array_add (out, g_strdup (*it)); | 			g_ptr_array_add (out, g_strndup (p, nl - p)); | ||||||
| 	g_strfreev (tmp); | 	if (*p) | ||||||
|  | 		g_ptr_array_add (out, g_strdup (p)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /// Decomposes a dictionary entry into the format we want.
 | /// Decomposes a dictionary entry into the format we want.
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user