pod: remove SPA_POD_IS_OBJECT_TYPE

We have a safer version of that in iter.h
Use macros to get id and type of an object
Use safer checks in plugins.
This commit is contained in:
Wim Taymans 2019-10-29 10:08:46 +01:00
parent 241a6165d2
commit f7d32e78f2
5 changed files with 5 additions and 10 deletions

View file

@ -379,14 +379,12 @@ static inline int spa_pod_is_object(const struct spa_pod *pod)
static inline bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
{
return (pod && spa_pod_is_object(pod) &&
((const struct spa_pod_object *) pod)->body.type == type);
return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_TYPE(pod) == type);
}
static inline bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
{
return (pod && spa_pod_is_object(pod) &&
((const struct spa_pod_object *) pod)->body.id == id);
return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_ID(pod) == id);
}
static inline int spa_pod_is_sequence(const struct spa_pod *pod)

View file

@ -160,9 +160,6 @@ struct spa_pod_struct {
#define SPA_POD_OBJECT_TYPE(obj) (((struct spa_pod_object*)(obj))->body.type)
#define SPA_POD_OBJECT_ID(obj) (((struct spa_pod_object*)(obj))->body.id)
#define SPA_POD_IS_OBJECT_TYPE(obj,tp) (SPA_POD_TYPE(obj) == SPA_TYPE_Object && \
SPA_POD_OBJECT_TYPE(obj) == (tp))
struct spa_pod_object_body {
uint32_t type; /**< one of enum spa_type */
uint32_t id; /**< id of the object, depends on the object type */