From: Jaroslav Kysela Date: Fri, 16 Jun 2017 16:40:11 +0000 (+0200) Subject: replace strdupa() with tvh_strdupa() X-Git-Tag: v4.2.3~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66b7e9e111af0b98e5d8278b5566307182e36e4b;p=thirdparty%2Ftvheadend.git replace strdupa() with tvh_strdupa() --- diff --git a/src/compat.h b/src/compat.h index 6a04f8fa8..cd123b0cb 100644 --- a/src/compat.h +++ b/src/compat.h @@ -19,15 +19,6 @@ #define TVH_COMPAT_H #if ENABLE_ANDROID -#ifndef strdupa -#define strdupa(s) \ - ({ \ - const char *__old = (s); \ - size_t __len = strlen(__old) + 1; \ - char *__new = (char *) alloca(__len); \ - (char *) memcpy(__new, __old, __len); \ - }) -#endif #ifndef index #define index(...) strchr(__VA_ARGS__) #endif diff --git a/src/download.c b/src/download.c index 7387a6e40..ce8a98d6c 100644 --- a/src/download.c +++ b/src/download.c @@ -172,7 +172,7 @@ download_pipe_read(void *aux) sbuf_alloc(&dn->pipe_sbuf, 2048); len = sbuf_read(&dn->pipe_sbuf, dn->pipe_fd); if (len == 0) { - s = dn->url ? strdupa(dn->url) : strdupa(""); + s = dn->url ? tvh_strdupa(dn->url) : tvh_strdupa(""); p = strchr(s, ' '); if (p) *p = '\0'; @@ -248,7 +248,7 @@ download_fetch(void *aux) goto done; if (strncmp(dn->url, "file://", 7) == 0) { - char *f = strdupa(dn->url + 7); + char *f = tvh_strdupa(dn->url + 7); http_deescape(f); download_file(dn, f); goto done; diff --git a/src/dvr/dvr_inotify.c b/src/dvr/dvr_inotify.c index f7bb4ca3b..d8f202cf6 100644 --- a/src/dvr/dvr_inotify.c +++ b/src/dvr/dvr_inotify.c @@ -119,7 +119,7 @@ static void dvr_inotify_add_one ( dvr_entry_t *de, htsmsg_t *m ) if (filename == NULL || fd < 0) return; - path = strdupa(filename); + path = tvh_strdupa(filename); SKEL_ALLOC(dvr_inotify_entry_skel); dvr_inotify_entry_skel->path = dirname(path); diff --git a/src/httpc.c b/src/httpc.c index 06df3fbc3..c62bd4e33 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -1253,7 +1253,7 @@ http_client_add_args ( http_client_t *hc, http_arg_list_t *h, const char *args ) if (args == NULL) return; - p = strdupa(args); + p = tvh_strdupa(args); while (*p) { while (*p && *p <= ' ') p++; if (*p == '\0') break; diff --git a/src/imagecache.c b/src/imagecache.c index 1af597043..3a2432aa7 100644 --- a/src/imagecache.c +++ b/src/imagecache.c @@ -656,7 +656,7 @@ imagecache_filename ( uint32_t id, char *name, size_t len ) /* Local file */ if (!strncasecmp(i->url, "file://", 7)) { - fn = strdupa(i->url + 7); + fn = tvh_strdupa(i->url + 7); http_deescape(fn); strncpy(name, fn, len); name[len-1] = '\0'; diff --git a/src/input/mpegts/iptv/iptv_auto.c b/src/input/mpegts/iptv/iptv_auto.c index f6745a638..73432c7de 100644 --- a/src/input/mpegts/iptv/iptv_auto.c +++ b/src/input/mpegts/iptv/iptv_auto.c @@ -123,7 +123,7 @@ iptv_auto_network_process_m3u_item(iptv_network_t *in, tags = htsmsg_get_str(item, "tvh-tags"); if (!tags) tags = htsmsg_get_str(item, "group-title"); if (tags) { - tags = n = strdupa(tags); + tags = n = tvh_strdupa(tags); while (*n) { if (*n == '|') *n = '\n'; diff --git a/src/misc/m3u.c b/src/misc/m3u.c index 18783efe4..75639da1d 100644 --- a/src/misc/m3u.c +++ b/src/misc/m3u.c @@ -101,7 +101,7 @@ static const char *get_url if ((l = is_full_url(url)) == 0 || is_full_url(rel)) return rel; - url2 = strdupa(url); + url2 = tvh_strdupa(url); if (rel[0] == '/') { p = strchr(url2 + l, '/'); if (p == NULL)