Thread (1 message) 1 message, 1 author, 2016-06-16

Re: [PATCH] string_list: use string-list API in unsorted_string_list_lookup()

From: Ralf Thielow <hidden>
Date: 2016-06-16 02:18:59

Johannes Schindelin [off-list ref] writes:
quoted
 
-	for (i = 0; i < list->nr; i++)
-		if (!cmp(string, list->items[i].string))
-			return list->items + i;
+	for_each_string_list_item(item, list) {
+		if (!cmp(string, item->string))
+			return item;
+	}
 	return NULL;
If you drop the extra curly braces (thereby matching Git's coding style as
an additional bonus), at least the patch won't increase the number of
lines.
Oops. I'll send a new version of the patch without these
extra curly braces.

Thanks!
In any case, I like the simplification of the code.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help