zeroconf: pass user data as const

This commit is contained in:
Wim Taymans 2026-02-27 16:06:33 +01:00
parent db713c8264
commit a065cff8c1
7 changed files with 20 additions and 24 deletions

View file

@ -49,7 +49,7 @@ struct entry {
#define TYPE_ANNOUNCE 0
#define TYPE_BROWSE 1
uint32_t type;
void *user;
const void *user;
struct pw_properties *props;
@ -110,7 +110,7 @@ static void service_free(struct service *s)
free(s);
}
struct entry *entry_find(struct pw_zeroconf *zc, uint32_t type, void *user)
struct entry *entry_find(struct pw_zeroconf *zc, uint32_t type, const void *user)
{
struct entry *e;
spa_list_for_each(e, &zc->entries, link)
@ -505,7 +505,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *d)
zeroconf_unref(zc);
}
static struct entry *entry_new(struct pw_zeroconf *zc, uint32_t type, void *user, const struct spa_dict *info)
static struct entry *entry_new(struct pw_zeroconf *zc, uint32_t type, const void *user, const struct spa_dict *info)
{
struct entry *e;
@ -524,7 +524,7 @@ static struct entry *entry_new(struct pw_zeroconf *zc, uint32_t type, void *user
return e;
}
static int set_entry(struct pw_zeroconf *zc, uint32_t type, void *user, const struct spa_dict *info)
static int set_entry(struct pw_zeroconf *zc, uint32_t type, const void *user, const struct spa_dict *info)
{
struct entry *e;
int res = 0;
@ -546,11 +546,11 @@ static int set_entry(struct pw_zeroconf *zc, uint32_t type, void *user, const st
}
return res;
}
int pw_zeroconf_set_announce(struct pw_zeroconf *zc, void *user, const struct spa_dict *info)
int pw_zeroconf_set_announce(struct pw_zeroconf *zc, const void *user, const struct spa_dict *info)
{
return set_entry(zc, TYPE_ANNOUNCE, user, info);
}
int pw_zeroconf_set_browse(struct pw_zeroconf *zc, void *user, const struct spa_dict *info)
int pw_zeroconf_set_browse(struct pw_zeroconf *zc, const void *user, const struct spa_dict *info)
{
return set_entry(zc, TYPE_BROWSE, user, info);
}

View file

@ -22,8 +22,8 @@ struct pw_zeroconf_events {
void (*destroy) (void *data);
void (*error) (void *data, int err, const char *message);
void (*added) (void *data, void *user, const struct spa_dict *info);
void (*removed) (void *data, void *user, const struct spa_dict *info);
void (*added) (void *data, const void *user, const struct spa_dict *info);
void (*removed) (void *data, const void *user, const struct spa_dict *info);
};
struct pw_zeroconf * pw_zeroconf_new(struct pw_context *context,
@ -31,8 +31,8 @@ struct pw_zeroconf * pw_zeroconf_new(struct pw_context *context,
void pw_zeroconf_destroy(struct pw_zeroconf *zc);
int pw_zeroconf_set_announce(struct pw_zeroconf *zc, void *user, const struct spa_dict *info);
int pw_zeroconf_set_browse(struct pw_zeroconf *zc, void *user, const struct spa_dict *info);
int pw_zeroconf_set_announce(struct pw_zeroconf *zc, const void *user, const struct spa_dict *info);
int pw_zeroconf_set_browse(struct pw_zeroconf *zc, const void *user, const struct spa_dict *info);
void pw_zeroconf_add_listener(struct pw_zeroconf *zc,
struct spa_hook *listener,