Make libseat_seat_listener const
libseat will never write to that struct. Let's allow callers to make it read-only.
This commit is contained in:
parent
309650aa4d
commit
166feaea33
6 changed files with 10 additions and 10 deletions
|
@ -30,7 +30,7 @@
|
|||
|
||||
struct backend_logind {
|
||||
struct libseat base;
|
||||
struct libseat_seat_listener *seat_listener;
|
||||
const struct libseat_seat_listener *seat_listener;
|
||||
void *seat_listener_data;
|
||||
|
||||
sd_bus *bus;
|
||||
|
@ -621,7 +621,7 @@ static int set_type(struct backend_logind *backend, const char *type) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct libseat *logind_open_seat(struct libseat_seat_listener *listener, void *data) {
|
||||
static struct libseat *logind_open_seat(const struct libseat_seat_listener *listener, void *data) {
|
||||
struct backend_logind *backend = calloc(1, sizeof(struct backend_logind));
|
||||
if (backend == NULL) {
|
||||
return NULL;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
struct backend_noop {
|
||||
struct libseat base;
|
||||
struct libseat_seat_listener *seat_listener;
|
||||
const struct libseat_seat_listener *seat_listener;
|
||||
void *seat_listener_data;
|
||||
|
||||
bool initial_setup;
|
||||
|
@ -103,7 +103,7 @@ static int dispatch_background(struct libseat *base, int timeout) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct libseat *noop_open_seat(struct libseat_seat_listener *listener, void *data) {
|
||||
static struct libseat *noop_open_seat(const struct libseat_seat_listener *listener, void *data) {
|
||||
struct backend_noop *backend = calloc(1, sizeof(struct backend_noop));
|
||||
if (backend == NULL) {
|
||||
return NULL;
|
||||
|
|
|
@ -33,7 +33,7 @@ struct pending_event {
|
|||
struct backend_seatd {
|
||||
struct libseat base;
|
||||
struct connection connection;
|
||||
struct libseat_seat_listener *seat_listener;
|
||||
const struct libseat_seat_listener *seat_listener;
|
||||
void *seat_listener_data;
|
||||
struct linked_list pending_events;
|
||||
bool error;
|
||||
|
@ -363,7 +363,7 @@ static int dispatch_and_execute(struct libseat *base, int timeout) {
|
|||
return predispatch + postdispatch;
|
||||
}
|
||||
|
||||
static struct libseat *_open_seat(struct libseat_seat_listener *listener, void *data, int fd) {
|
||||
static struct libseat *_open_seat(const struct libseat_seat_listener *listener, void *data, int fd) {
|
||||
assert(listener != NULL);
|
||||
assert(listener->enable_seat != NULL && listener->disable_seat != NULL);
|
||||
struct backend_seatd *backend = calloc(1, sizeof(struct backend_seatd));
|
||||
|
@ -411,7 +411,7 @@ alloc_error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct libseat *open_seat(struct libseat_seat_listener *listener, void *data) {
|
||||
static struct libseat *open_seat(const struct libseat_seat_listener *listener, void *data) {
|
||||
int fd = seatd_connect();
|
||||
if (fd == -1) {
|
||||
return NULL;
|
||||
|
|
|
@ -34,7 +34,7 @@ static const struct named_backend impls[] = {
|
|||
#error At least one backend must be enabled
|
||||
#endif
|
||||
|
||||
struct libseat *libseat_open_seat(struct libseat_seat_listener *listener, void *data) {
|
||||
struct libseat *libseat_open_seat(const struct libseat_seat_listener *listener, void *data) {
|
||||
if (listener == NULL || listener->enable_seat == NULL || listener->disable_seat == NULL) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue