Subject: Re: [PATCH] revision: mark blobs needed for resolve-undo as reachable

From: Taylor Blau <[email-masked]>
Date: Tue, 14 Jun 2022 22:02:32 -0400

On Tue, Jun 14, 2022 at 10:35:10AM -0400, Derrick Stolee wrote:
> I thinks I had something like
>
> 	for ((list) && item = (list)->items; (list) && item && ...

I wrote something like this:

--- >8 ---

diff --git a/string-list.h b/string-list.h
index d5a744e143..425abc55f4 100644
--- a/string-list.h
+++ b/string-list.h
@@ -143,7 +143,7 @@ int for_each_string_list(struct string_list *list,

 /** Iterate over each item, as a macro. */
 #define for_each_string_list_item(item,list)            \
-	for (item = (list)->items;                      \
+	for (item = (list) ? (list)->items : NULL;      \
 	     item && item < (list)->items + (list)->nr; \
 	     ++item)

--- 8< ---

> but even with your suggestion, I get this compiler error:

...so did I. Though I'm not sure I understand the compiler's warning
here. Surely the thing being passed as list in the macro expansion
_won't_ always evaluate to non-NULL, will it?

Thanks,
Taylor