From: Jaroslav Kysela Date: Fri, 15 Dec 2017 16:41:45 +0000 (+0100) Subject: try to fix find_by_identifier mess X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57bf5591022afcd80fa55c46b7dc93ed5d8c827f;p=thirdparty%2Ftvheadend.git try to fix find_by_identifier mess --- diff --git a/src/api/api_service.c b/src/api/api_service.c index fa39a4c48..8ecd870cc 100644 --- a/src/api/api_service.c +++ b/src/api/api_service.c @@ -123,7 +123,7 @@ api_service_streams pthread_mutex_lock(&global_lock); /* Couldn't find */ - if (!(s = service_find(uuid))) { + if (!(s = service_find_by_uuid(uuid))) { pthread_mutex_unlock(&global_lock); return EINVAL; } diff --git a/src/bouquet.c b/src/bouquet.c index 6dcf39d3f..d6f268684 100644 --- a/src/bouquet.c +++ b/src/bouquet.c @@ -1296,7 +1296,7 @@ bouquet_service_resolve(void) if ((e = htsmsg_field_get_map(f)) == NULL) continue; lcn = htsmsg_get_s64_or_default(e, "lcn", 0); tag = htsmsg_get_str(e, "tag"); - s = service_find_by_identifier(f->hmf_name); + s = service_find_by_uuid(f->hmf_name); if (s) bouquet_add_service(bq, s, lcn, tag); } diff --git a/src/channels.c b/src/channels.c index 4d7b46b0b..a7cf3239a 100644 --- a/src/channels.c +++ b/src/channels.c @@ -1659,7 +1659,7 @@ channel_tag_find_by_name(const char *name, int create) * */ channel_tag_t * -channel_tag_find_by_identifier(uint32_t id) { +channel_tag_find_by_id(uint32_t id) { channel_tag_t *ct; TAILQ_FOREACH(ct, &channel_tags, ct_link) { diff --git a/src/channels.h b/src/channels.h index d10d0e7ab..769676321 100644 --- a/src/channels.h +++ b/src/channels.h @@ -156,7 +156,7 @@ channel_tag_t *channel_tag_create(const char *uuid, htsmsg_t *conf); channel_tag_t *channel_tag_find_by_name(const char *name, int create); -channel_tag_t *channel_tag_find_by_identifier(uint32_t id); +channel_tag_t *channel_tag_find_by_id(uint32_t id); static inline channel_tag_t *channel_tag_find_by_uuid(const char *uuid) { return (channel_tag_t*)idnode_find(uuid, &channel_tag_class, NULL); } diff --git a/src/epgdb.c b/src/epgdb.c index 1acb961ea..bc98c6ac4 100644 --- a/src/epgdb.c +++ b/src/epgdb.c @@ -66,7 +66,7 @@ static void _epgdb_v1_process ( htsmsg_t *c, epggrab_stats_t *stats ) /* Check key info */ if(htsmsg_get_u32(c, "ch_id", &ch_id)) return; - if((ch = channel_find_by_identifier(ch_id)) == NULL) return; + if((ch = channel_find_by_id(ch_id)) == NULL) return; if(htsmsg_get_u32(c, "start", &e_start)) return; if(htsmsg_get_u32(c, "stop", &e_stop)) return; if(!(title = htsmsg_get_str(c, "title"))) return; diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index d502d1626..dc1f23837 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -811,7 +811,7 @@ _eit_process_data(void *m, void *data, uint32_t len) memcpy(&ed, data, sizeof(ed)); data += sizeof(ed); len -= sizeof(ed); - svc = (mpegts_service_t *)service_find0(&ed.svc_uuid); + svc = (mpegts_service_t *)service_find_by_uuid0(&ed.svc_uuid); if (svc == NULL) return; pthread_mutex_lock(&global_lock); diff --git a/src/htsp_server.c b/src/htsp_server.c index a6f52df42..eaaf9201f 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -701,7 +701,7 @@ htsp_channel_tag_get_identifier(channel_tag_t *ct) } static channel_tag_t * -htsp_channel_tag_find_by_identifier(htsp_connection_t *htsp, uint32_t id) +htsp_channel_tag_find_by_id(htsp_connection_t *htsp, uint32_t id) { channel_tag_t *ct; @@ -1752,7 +1752,7 @@ htsp_method_epgQuery(htsp_connection_t *htsp, htsmsg_t *in) eq.channel = strdup(idnode_uuid_as_str(&ch->ch_id, ubuf)); } if(!(htsmsg_get_u32(in, "tagId", &u32))) { - if (!(ct = htsp_channel_tag_find_by_identifier(htsp, u32))) + if (!(ct = htsp_channel_tag_find_by_id(htsp, u32))) return htsp_error(htsp, N_("Channel tag does not exist")); else eq.channel_tag = strdup(idnode_uuid_as_str(&ct->ct_id, ubuf)); diff --git a/src/service.h b/src/service.h index 4dd11008f..993bab0d0 100644 --- a/src/service.h +++ b/src/service.h @@ -537,11 +537,10 @@ void service_unref(service_t *t); void service_ref(service_t *t); -static inline service_t *service_find(const char *identifier) - { return idnode_find(identifier, &service_class, NULL); } -static inline service_t *service_find0(tvh_uuid_t *uuid) +static inline service_t *service_find_by_uuid(const char *uuid) + { return idnode_find(uuid, &service_class, NULL); } +static inline service_t *service_find_by_uuid0(tvh_uuid_t *uuid) { return idnode_find0(uuid, &service_class, NULL); } -#define service_find_by_identifier service_find service_instance_t *service_find_instance(struct service *s, struct channel *ch, diff --git a/src/subscriptions.c b/src/subscriptions.c index a176c9626..1922ef8b3 100644 --- a/src/subscriptions.c +++ b/src/subscriptions.c @@ -1284,7 +1284,7 @@ dummy_retry(void *opaque) void subscription_dummy_join(const char *id, int first) { - service_t *t = service_find_by_identifier(id); + service_t *t = service_find_by_uuid(id); profile_chain_t *prch; streaming_target_t *st; th_subscription_t *s; diff --git a/src/webui/webui.c b/src/webui/webui.c index bd013ecb4..b92f5f393 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -1087,7 +1087,7 @@ page_http_playlist(http_connection_t *hc, const char *remain, void *opaque) else if(nc == 2 && !strcmp(components[0], "dvrid")) de = dvr_entry_find_by_id(atoi(components[1])); else if(nc == 2 && !strcmp(components[0], "tagid")) - tag = channel_tag_find_by_identifier(atoi(components[1])); + tag = channel_tag_find_by_id(atoi(components[1])); else if(nc == 2 && !strcmp(components[0], "tagname")) tag = channel_tag_find_by_name(components[1], 0); else if(nc == 2 && !strcmp(components[0], "tag")) { @@ -1395,7 +1395,7 @@ http_stream(http_connection_t *hc, const char *remain, void *opaque) } else if(!strcmp(components[0], "channel")) { ch = channel_find(components[1]); } else if(!strcmp(components[0], "service")) { - service = service_find_by_identifier(components[1]); + service = service_find_by_uuid(components[1]); #if ENABLE_MPEGTS } else if(!strcmp(components[0], "mux")) { // TODO: do we want to be able to force starting a particular instance diff --git a/src/webui/xmltv.c b/src/webui/xmltv.c index 7bdcc95ea..df8f8c439 100644 --- a/src/webui/xmltv.c +++ b/src/webui/xmltv.c @@ -282,7 +282,7 @@ page_xmltv(http_connection_t *hc, const char *remain, void *opaque) else if (nc == 2 && !strcmp(components[0], "channel")) ch = channel_find(components[1]); else if (nc == 2 && !strcmp(components[0], "tagid")) - tag = channel_tag_find_by_identifier(atoi(components[1])); + tag = channel_tag_find_by_id(atoi(components[1])); else if (nc == 2 && !strcmp(components[0], "tagname")) tag = channel_tag_find_by_name(components[1], 0); else if (nc == 2 && !strcmp(components[0], "tag"))