From: Jaroslav Kysela Date: Fri, 14 Sep 2018 08:27:12 +0000 (+0200) Subject: tprofile: fix tprofile_start1 when id==NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34b9a6f054b2428edc499c78abbd2cb4e4a1f05f;p=thirdparty%2Ftvheadend.git tprofile: fix tprofile_start1 when id==NULL --- diff --git a/src/tprofile.c b/src/tprofile.c index 17568f257..ad2b7099b 100644 --- a/src/tprofile.c +++ b/src/tprofile.c @@ -17,6 +17,7 @@ */ #include +#include #include "tvhlog.h" #include "clock.h" #include "tprofile.h" @@ -72,7 +73,13 @@ void tprofile_start1(tprofile_t *tprof, const char *id) pthread_mutex_lock(&tprofile_mutex); assert(tprof->start == 0); tprof->start = getfastmonoclock(); - tprof->start_id = strdup(id); + if (id) { + tprof->start_id = strdup(id); + } else { + char buf[32]; + snprintf(buf, sizeof(buf), "[%p]", tprof); + tprof->start_id = strdup(buf); + } pthread_mutex_unlock(&tprofile_mutex); }