From: Jaroslav Kysela Date: Mon, 3 Dec 2018 07:38:48 +0000 (+0100) Subject: tvh_thread: do not use debug code when not activated, issue #5353, issue #5389 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80ea669a5cea155ebbd1161635800c11de0175f6;p=thirdparty%2Ftvheadend.git tvh_thread: do not use debug code when not activated, issue #5353, issue #5389 --- diff --git a/src/tvh_thread.c b/src/tvh_thread.c index d4d2f1972..6fc5c0615 100644 --- a/src/tvh_thread.c +++ b/src/tvh_thread.c @@ -305,13 +305,15 @@ tvh_cond_wait int r; #if ENABLE_TRACE - const char *filename; - int lineno; - tvh_mutex_remove_from_list(mutex, &filename, &lineno); + const char *filename = NULL; + int lineno = -1; + if (tvh_thread_debug > 0) + tvh_mutex_remove_from_list(mutex, &filename, &lineno); #endif r = pthread_cond_wait(&cond->cond, &mutex->mutex); #if ENABLE_TRACE - tvh_mutex_add_to_list(mutex, filename, lineno); + if (tvh_thread_debug > 0) + tvh_mutex_add_to_list(mutex, filename, lineno); #endif return r; } @@ -323,9 +325,10 @@ tvh_cond_timedwait int r; #if ENABLE_TRACE - const char *filename; - int lineno; - tvh_mutex_remove_from_list(mutex, &filename, &lineno); + const char *filename = NULL; + int lineno = -1; + if (tvh_thread_debug > 0) + tvh_mutex_remove_from_list(mutex, &filename, &lineno); #endif #if defined(PLATFORM_DARWIN) @@ -351,7 +354,8 @@ tvh_cond_timedwait #endif #if ENABLE_TRACE - tvh_mutex_add_to_list(mutex, filename, lineno); + if (tvh_thread_debug > 0) + tvh_mutex_add_to_list(mutex, filename, lineno); #endif return r; } @@ -361,13 +365,15 @@ int tvh_cond_timedwait_ts(tvh_cond_t *cond, tvh_mutex_t *mutex, struct timespec int r; #if ENABLE_TRACE - const char *filename; - int lineno; - tvh_mutex_remove_from_list(mutex, &filename, &lineno); + const char *filename = NULL; + int lineno = -1; + if (tvh_thread_debug > 0) + tvh_mutex_remove_from_list(mutex, &filename, &lineno); #endif r = pthread_cond_timedwait(&cond->cond, &mutex->mutex, ts); #if ENABLE_TRACE - tvh_mutex_add_to_list(mutex, filename, lineno); + if (tvh_thread_debug > 0) + tvh_mutex_add_to_list(mutex, filename, lineno); #endif return r; }