]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
replace strdupa() with tvh_strdupa()
authorJaroslav Kysela <perex@perex.cz>
Fri, 16 Jun 2017 16:40:11 +0000 (18:40 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 16 Jun 2017 16:40:11 +0000 (18:40 +0200)
src/compat.h
src/download.c
src/dvr/dvr_inotify.c
src/httpc.c
src/imagecache.c
src/input/mpegts/iptv/iptv_auto.c
src/misc/m3u.c

index 6a04f8fa865981f168ced02a2b35e6c319ea428d..cd123b0cb2a0338007a53092d09e56f20bd84dcd 100644 (file)
 #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
index 7387a6e403d182213d476e715461c8b9414aa1bf..ce8a98d6cd79a8f2c4573eb2fcf10d8913b2d37b 100644 (file)
@@ -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;
index f7bb4ca3b8114f232b807220dd5f1290ec92b2da..d8f202cf67531cab435bb29413578a7fbc39d95d 100644 (file)
@@ -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);
index 06df3fbc3870123a1fd9a35f25c9bbf172782314..c62bd4e331a4b509adea8f25decb2a1a303fc2f8 100644 (file)
@@ -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;
index 1af5970438443de3e6d0d8757fcf9a67dc578b2e..3a2432aa72baee33fdc736ea8679f5f4a4986de2 100644 (file)
@@ -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';
index f6745a638555eb8a07ca5532649ba7feb2e7f1f5..73432c7de0b2aa0b0e18879dd222d528892aae4c 100644 (file)
@@ -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';
index 18783efe4667b7771d9124ea5a41b507fda9fd8f..75639da1d7135aef89df9e1269caa2a5b588a555 100644 (file)
@@ -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)