[vlc-commits] [Git][videolan/vlc][master] vlc_threads: fix thread name length warning

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Tue May 24 11:37:25 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
59579661 by Alexandre Janniaux at 2022-05-24T11:21:50+00:00
vlc_threads: fix thread name length warning

The warning was always triggered because __builtin_constant_p actually
checks whether the tested value is constant at compile time and strlen()
was never constant at compile time.

Note that __builtin_constant_p can be used with a non-constant test
expression while using the same expression after ? in a ternary
condition.

- - - - -


1 changed file:

- include/vlc_threads.h


Changes:

=====================================
include/vlc_threads.h
=====================================
@@ -641,8 +641,9 @@ const char * vlc_thread_name_too_big( const char * thread_name )
 }
 
 # define check_name_length( thread_name ) \
-    ((__builtin_constant_p(strlen(thread_name) > 15)) ? \
-        vlc_thread_name_too_big(thread_name) : thread_name)
+    ((__builtin_constant_p(__builtin_strlen(thread_name) > 15) && \
+      __builtin_strlen(thread_name) > 15) \
+      ? vlc_thread_name_too_big(thread_name): thread_name)
 #endif
 
 /**



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/595796613362941aa681310bd86a66a2543ca13c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/595796613362941aa681310bd86a66a2543ca13c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list