treewide: get rid of tmp argument in list_for_each_safe

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
This commit is contained in:
Konstantin Kharlamov 2021-02-22 19:52:40 +03:00
parent 3f2c483439
commit 3d3d9b7f69
11 changed files with 64 additions and 67 deletions

View file

@ -1158,7 +1158,7 @@ static void
fallback_interface_remove(struct evdev_dispatch *evdev_dispatch)
{
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
struct evdev_paired_keyboard *kbd, *tmp;
struct evdev_paired_keyboard *kbd;
libinput_timer_cancel(&dispatch->debounce.timer);
libinput_timer_cancel(&dispatch->debounce.timer_short);
@ -1167,7 +1167,6 @@ fallback_interface_remove(struct evdev_dispatch *evdev_dispatch)
libinput_device_remove_event_listener(&dispatch->tablet_mode.other.listener);
list_for_each_safe(kbd,
tmp,
&dispatch->lid.paired_keyboard_list,
link) {
evdev_paired_keyboard_destroy(kbd);
@ -1433,10 +1432,9 @@ fallback_interface_device_removed(struct evdev_device *device,
{
struct fallback_dispatch *dispatch =
fallback_dispatch(device->dispatch);
struct evdev_paired_keyboard *kbd, *tmp;
struct evdev_paired_keyboard *kbd;
list_for_each_safe(kbd,
tmp,
&dispatch->lid.paired_keyboard_list,
link) {
if (!kbd->device)

View file

@ -2614,7 +2614,7 @@ tp_interface_device_removed(struct evdev_device *device,
struct evdev_device *removed_device)
{
struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch;
struct evdev_paired_keyboard *kbd, *tmp;
struct evdev_paired_keyboard *kbd;
if (removed_device == tp->buttons.trackpoint) {
/* Clear any pending releases for the trackpoint */
@ -2628,7 +2628,7 @@ tp_interface_device_removed(struct evdev_device *device,
tp->buttons.trackpoint = NULL;
}
list_for_each_safe(kbd, tmp, &tp->dwt.paired_keyboard_list, link) {
list_for_each_safe(kbd, &tp->dwt.paired_keyboard_list, link) {
if (kbd->device == removed_device) {
evdev_paired_keyboard_destroy(kbd);
tp->dwt.keyboard_active = false;

View file

@ -151,13 +151,13 @@ static void
pad_led_group_destroy(struct libinput_tablet_pad_mode_group *g)
{
struct pad_led_group *group = (struct pad_led_group *)g;
struct pad_mode_toggle_button *button, *tmp;
struct pad_mode_led *led, *tmpled;
struct pad_mode_toggle_button *button;
struct pad_mode_led *led;
list_for_each_safe(button, tmp, &group->toggle_button_list, link)
list_for_each_safe(button, &group->toggle_button_list, link)
pad_mode_toggle_button_destroy(button);
list_for_each_safe(led, tmpled, &group->led_list, link)
list_for_each_safe(led, &group->led_list, link)
pad_led_destroy(g->device->seat->libinput, led);
free(group);
@ -577,9 +577,9 @@ pad_init_leds(struct pad_dispatch *pad,
void
pad_destroy_leds(struct pad_dispatch *pad)
{
struct libinput_tablet_pad_mode_group *group, *tmpgrp;
struct libinput_tablet_pad_mode_group *group;
list_for_each_safe(group, tmpgrp, &pad->modes.mode_group_list, link)
list_for_each_safe(group, &pad->modes.mode_group_list, link)
libinput_tablet_pad_mode_group_unref(group);
}

View file

@ -2098,13 +2098,13 @@ static void
tablet_destroy(struct evdev_dispatch *dispatch)
{
struct tablet_dispatch *tablet = tablet_dispatch(dispatch);
struct libinput_tablet_tool *tool, *tmp;
struct libinput_tablet_tool *tool;
struct libinput *li = tablet_libinput_context(tablet);
libinput_timer_cancel(&tablet->quirks.prox_out_timer);
libinput_timer_destroy(&tablet->quirks.prox_out_timer);
list_for_each_safe(tool, tmp, &tablet->tool_list, link) {
list_for_each_safe(tool, &tablet->tool_list, link) {
libinput_tablet_tool_unref(tool);
}

View file

@ -1844,9 +1844,9 @@ libinput_seat_destroy(struct libinput_seat *seat);
static void
libinput_drop_destroyed_sources(struct libinput *libinput)
{
struct libinput_source *source, *next;
struct libinput_source *source;
list_for_each_safe(source, next, &libinput->source_destroy_list, link)
list_for_each_safe(source, &libinput->source_destroy_list, link)
free(source);
list_init(&libinput->source_destroy_list);
}
@ -1862,10 +1862,10 @@ LIBINPUT_EXPORT struct libinput *
libinput_unref(struct libinput *libinput)
{
struct libinput_event *event;
struct libinput_device *device, *next_device;
struct libinput_seat *seat, *next_seat;
struct libinput_tablet_tool *tool, *next_tool;
struct libinput_device_group *group, *next_group;
struct libinput_device *device;
struct libinput_seat *seat;
struct libinput_tablet_tool *tool;
struct libinput_device_group *group;
if (libinput == NULL)
return NULL;
@ -1884,8 +1884,8 @@ libinput_unref(struct libinput *libinput)
free(libinput->events);
list_for_each_safe(seat, next_seat, &libinput->seat_list, link) {
list_for_each_safe(device, next_device,
list_for_each_safe(seat, &libinput->seat_list, link) {
list_for_each_safe(device,
&seat->devices_list,
link)
libinput_device_destroy(device);
@ -1894,13 +1894,12 @@ libinput_unref(struct libinput *libinput)
}
list_for_each_safe(group,
next_group,
&libinput->device_group_list,
link) {
libinput_device_group_destroy(group);
}
list_for_each_safe(tool, next_tool, &libinput->tool_list, link) {
list_for_each_safe(tool, &libinput->tool_list, link) {
libinput_tablet_tool_unref(tool);
}
@ -2225,7 +2224,7 @@ post_device_event(struct libinput_device *device,
enum libinput_event_type type,
struct libinput_event *event)
{
struct libinput_event_listener *listener, *tmp;
struct libinput_event_listener *listener;
#if 0
struct libinput *libinput = device->seat->libinput;
@ -2240,7 +2239,7 @@ post_device_event(struct libinput_device *device,
init_event_base(event, device, type);
list_for_each_safe(listener, tmp, &device->event_listeners, link)
list_for_each_safe(listener, &device->event_listeners, link)
listener->notify_func(time, event, listener->notify_func_data);
libinput_post_event(device->seat->libinput, event);

View file

@ -52,9 +52,9 @@ static void
path_disable_device(struct evdev_device *device)
{
struct libinput_seat *seat = device->base.seat;
struct evdev_device *dev, *next;
struct evdev_device *dev;
list_for_each_safe(dev, next,
list_for_each_safe(dev,
&seat->devices_list, base.link) {
if (dev != device)
continue;
@ -68,12 +68,12 @@ static void
path_input_disable(struct libinput *libinput)
{
struct path_input *input = (struct path_input*)libinput;
struct path_seat *seat, *tmp;
struct evdev_device *device, *next;
struct path_seat *seat;
struct evdev_device *device;
list_for_each_safe(seat, tmp, &input->base.seat_list, base.link) {
list_for_each_safe(seat, &input->base.seat_list, base.link) {
libinput_seat_ref(&seat->base);
list_for_each_safe(device, next,
list_for_each_safe(device,
&seat->base.devices_list, base.link)
path_disable_device(device);
libinput_seat_unref(&seat->base);
@ -241,11 +241,11 @@ static void
path_input_destroy(struct libinput *input)
{
struct path_input *path_input = (struct path_input*)input;
struct path_device *dev, *tmp;
struct path_device *dev;
udev_unref(path_input->udev);
list_for_each_safe(dev, tmp, &path_input->path_list, link)
list_for_each_safe(dev, &path_input->path_list, link)
path_device_destroy(dev);
}

View file

@ -435,14 +435,14 @@ section_new(const char *path, const char *name)
static inline void
section_destroy(struct section *s)
{
struct property *p, *tmp;
struct property *p;
free(s->name);
free(s->match.name);
free(s->match.dmi);
free(s->match.dt);
list_for_each_safe(p, tmp, &s->properties, link)
list_for_each_safe(p, &s->properties, link)
property_cleanup(p);
assert(list_empty(&s->properties));
@ -1099,7 +1099,7 @@ quirks_context_ref(struct quirks_context *ctx)
struct quirks_context *
quirks_context_unref(struct quirks_context *ctx)
{
struct section *s, *tmp;
struct section *s;
if (!ctx)
return NULL;
@ -1113,7 +1113,7 @@ quirks_context_unref(struct quirks_context *ctx)
/* Caller needs to clean up before calling this */
assert(list_empty(&ctx->quirks));
list_for_each_safe(s, tmp, &ctx->sections, link) {
list_for_each_safe(s, &ctx->sections, link) {
section_destroy(s);
}

View file

@ -149,13 +149,13 @@ device_added(struct udev_device *udev_device,
static void
device_removed(struct udev_device *udev_device, struct udev_input *input)
{
struct evdev_device *device, *next;
struct evdev_device *device;
struct udev_seat *seat;
const char *syspath;
syspath = udev_device_get_syspath(udev_device);
list_for_each(seat, &input->base.seat_list, base.link) {
list_for_each_safe(device, next,
list_for_each_safe(device,
&seat->base.devices_list, base.link) {
if (streq(syspath,
udev_device_get_syspath(device->udev_device))) {
@ -243,12 +243,12 @@ out:
static void
udev_input_remove_devices(struct udev_input *input)
{
struct evdev_device *device, *next;
struct udev_seat *seat, *tmp;
struct evdev_device *device;
struct udev_seat *seat;
list_for_each_safe(seat, tmp, &input->base.seat_list, base.link) {
list_for_each_safe(seat, &input->base.seat_list, base.link) {
libinput_seat_ref(&seat->base);
list_for_each_safe(device, next,
list_for_each_safe(device,
&seat->base.devices_list, base.link) {
evdev_device_remove(device);
}

View file

@ -61,9 +61,9 @@ bool list_empty(const struct list *list);
&pos->member != (head); \
pos = list_first_entry_by_type(&pos->member, __typeof__(*pos), member))
#define list_for_each_safe(pos, tmp, head, member) \
for (pos = list_first_entry_by_type(head, __typeof__(*pos), member), \
tmp = list_first_entry_by_type(&pos->member, __typeof__(*tmp), member); \
#define list_for_each_safe(pos, head, member) \
pos = list_first_entry_by_type(head, __typeof__(*pos), member); \
for (__typeof__(pos) _tmp = list_first_entry_by_type(&pos->member, __typeof__(*_tmp), member); \
&pos->member != (head); \
pos = tmp, \
tmp = list_first_entry_by_type(&pos->member, __typeof__(*tmp), member))
pos = _tmp, \
_tmp = list_first_entry_by_type(&pos->member, __typeof__(*_tmp), member))

View file

@ -841,9 +841,9 @@ static void
close_restricted(int fd, void *userdata)
{
struct litest_context *ctx = userdata;
struct path *p, *tmp;
struct path *p;
list_for_each_safe(p, tmp, &ctx->paths, link) {
list_for_each_safe(p, &ctx->paths, link) {
if (p->fd != fd)
continue;
list_remove(&p->link);
@ -862,9 +862,9 @@ struct libinput_interface interface = {
static void
litest_signal(int sig)
{
struct created_file *f, *tmp;
struct created_file *f;
list_for_each_safe(f, tmp, &created_files_list, link) {
list_for_each_safe(f, &created_files_list, link) {
list_remove(&f->link);
unlink(f->path);
rmdir(f->path);
@ -897,12 +897,12 @@ litest_setup_sighandler(int sig)
static void
litest_free_test_list(struct list *tests)
{
struct suite *s, *snext;
struct suite *s;
list_for_each_safe(s, snext, tests, node) {
struct test *t, *tnext;
list_for_each_safe(s, tests, node) {
struct test *t;
list_for_each_safe(t, tnext, &s->tests, node) {
list_for_each_safe(t, &s->tests, node) {
free(t->name);
free(t->devname);
list_remove(&t->node);
@ -1002,7 +1002,7 @@ litest_run_suite(struct list *tests, int which, int max, int error_fd)
struct list node;
char *name;
};
struct name *n, *tmp;
struct name *n;
struct list testnames;
const char *data_path;
@ -1118,7 +1118,7 @@ litest_run_suite(struct list *tests, int which, int max, int error_fd)
}
srunner_free(sr);
out:
list_for_each_safe(n, tmp, &testnames, node) {
list_for_each_safe(n, &testnames, node) {
free(n->name);
free(n);
}
@ -1594,12 +1594,12 @@ litest_init_udev_rules(struct list *created_files)
static inline void
litest_remove_udev_rules(struct list *created_files_list)
{
struct created_file *f, *tmp;
struct created_file *f;
bool reload_udev;
reload_udev = !list_empty(created_files_list);
list_for_each_safe(f, tmp, created_files_list, link) {
list_for_each_safe(f, created_files_list, link) {
list_remove(&f->link);
unlink(f->path);
rmdir(f->path);
@ -1714,7 +1714,7 @@ litest_create_context(void)
void
litest_destroy_context(struct libinput *li)
{
struct path *p, *tmp;
struct path *p;
struct litest_context *ctx;
@ -1722,7 +1722,7 @@ litest_destroy_context(struct libinput *li)
litest_assert_ptr_notnull(ctx);
libinput_unref(li);
list_for_each_safe(p, tmp, &ctx->paths, link) {
list_for_each_safe(p, &ctx->paths, link) {
litest_abort_msg("Device paths should be removed by now");
}
free(ctx);

View file

@ -2284,7 +2284,7 @@ static int
mainloop(struct record_context *ctx)
{
bool autorestart = (ctx->timeout > 0);
struct source *source, *tmp;
struct source *source;
struct record_device *d = NULL;
sigset_t mask;
int sigfd, timerfd;
@ -2437,7 +2437,7 @@ mainloop(struct record_context *ctx)
sigprocmask(SIG_UNBLOCK, &mask, NULL);
list_for_each_safe(source, tmp, &ctx->sources, link) {
list_for_each_safe(source, &ctx->sources, link) {
destroy_source(ctx, source);
}
close(ctx->epoll_fd);
@ -2630,7 +2630,7 @@ main(int argc, char **argv)
{ "grab", no_argument, 0, OPT_GRAB },
{ 0, 0, 0, 0 },
};
struct record_device *d, *tmp;
struct record_device *d;
const char *output_arg = NULL;
bool all = false, with_libinput = false, grab = false;
int ndevices;
@ -2816,7 +2816,7 @@ main(int argc, char **argv)
rc = mainloop(&ctx);
out:
list_for_each_safe(d, tmp, &ctx.devices, link) {
list_for_each_safe(d, &ctx.devices, link) {
if (d->device)
libinput_device_unref(d->device);
free(d->events);