[vlc-commits] vlc_list: prevent name conflict

Romain Vimont git at videolan.org
Fri Sep 18 09:14:56 CEST 2020


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Wed Sep 16 15:54:32 2020 +0200| [152963ca3e70dc603c3ddd15c0fda715f7cfaedd] | committer: Thomas Guillem

vlc_list: prevent name conflict

The macro vlc_list_foreach() declares an internal variable
vlc_list_it_XXX variable for looping, where XXX is the variable provided
by the user to receive the item.

If this name is "next", the resulting internal variable name is
"vlc_list_it_next", which conflicts with the function
vlc_list_it_next().

Add an _ to the internal variable name to prevent it.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=152963ca3e70dc603c3ddd15c0fda715f7cfaedd
---

 include/vlc_list.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/vlc_list.h b/include/vlc_list.h
index 45263cc789..bea20bfd9f 100644
--- a/include/vlc_list.h
+++ b/include/vlc_list.h
@@ -257,11 +257,11 @@ static inline void vlc_list_it_next(struct vlc_list_it *restrict it)
  * It is however <b>not</b> safe to delete another item.
  */
 #define vlc_list_foreach(pos, head, member) \
-    for (struct vlc_list_it vlc_list_it_##pos = vlc_list_it_start(head); \
-         vlc_list_it_continue(&(vlc_list_it_##pos)) \
-          && ((pos) = vlc_list_entry_p((vlc_list_it_##pos).current, \
+    for (struct vlc_list_it vlc_list_it__##pos = vlc_list_it_start(head); \
+         vlc_list_it_continue(&(vlc_list_it__##pos)) \
+          && ((pos) = vlc_list_entry_p((vlc_list_it__##pos).current, \
                                        pos, member), true); \
-         vlc_list_it_next(&(vlc_list_it_##pos)))
+         vlc_list_it_next(&(vlc_list_it__##pos)))
 
 /**
  * Converts a list node pointer to an element pointer.



More information about the vlc-commits mailing list