lock.h: Add include for string.h when DEBUG_THREADS is defined.

When DEBUG_THREADS is defined, lock.h uses strerror(), which is defined
in the libc string.h file, to print warning messages. If the including
source file doesn't include string.h then strerror() won't be found and
and compile errors will be thrown. Since lock.h depends on this, string.h
is now included from there if DEBUG_THREADS is defined.  This way, including
source files don't have to worry about it.

(cherry picked from commit 8eaad114f4)
This commit is contained in:
George Joseph
2025-05-02 12:19:25 -06:00
parent 1a3d09e345
commit 679b0109d0

View File

@@ -54,6 +54,9 @@
#ifdef HAVE_BKTR #ifdef HAVE_BKTR
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#ifdef DEBUG_THREADS
#include <string.h>
#endif
#ifndef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK #ifndef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
#include "asterisk/time.h" #include "asterisk/time.h"