#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
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';
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;
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);
if (args == NULL)
return;
- p = strdupa(args);
+ p = tvh_strdupa(args);
while (*p) {
while (*p && *p <= ' ') p++;
if (*p == '\0') break;
/* 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';
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';
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)