Replace calloc calls with zalloc

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-07-07 11:18:40 +10:00
parent d5d6d4cd53
commit e71ade2755
4 changed files with 6 additions and 10 deletions

View file

@ -2072,9 +2072,7 @@ tp_init_slots(struct tp_dispatch *tp,
}
tp->ntouches = max(tp->num_slots, n_btn_tool_touches);
tp->touches = calloc(tp->ntouches, sizeof(struct tp_touch));
if (!tp->touches)
return false;
tp->touches = zalloc(tp->ntouches * sizeof(struct tp_touch));
for (i = 0; i < tp->ntouches; i++)
tp_init_touch(tp, &tp->touches[i]);

View file

@ -1782,9 +1782,7 @@ fallback_dispatch_init_slots(struct fallback_dispatch *dispatch,
active_slot = libevdev_get_current_slot(evdev);
}
slots = calloc(num_slots, sizeof(struct mt_slot));
if (!slots)
return -1;
slots = zalloc(num_slots * sizeof(struct mt_slot));
for (slot = 0; slot < num_slots; ++slot) {
slots[slot].seat_slot = -1;

View file

@ -954,7 +954,7 @@ create_default_filter(int dpi)
filter->last_velocity = 0.0;
filter->trackers =
calloc(NUM_POINTER_TRACKERS, sizeof *filter->trackers);
zalloc(NUM_POINTER_TRACKERS * sizeof *filter->trackers);
filter->cur_tracker = 0;
filter->threshold = DEFAULT_THRESHOLD;
@ -1052,7 +1052,7 @@ create_pointer_accelerator_filter_lenovo_x230(int dpi)
filter->last_velocity = 0.0;
filter->trackers =
calloc(NUM_POINTER_TRACKERS, sizeof *filter->trackers);
zalloc(NUM_POINTER_TRACKERS * sizeof *filter->trackers);
filter->cur_tracker = 0;
filter->threshold = X230_THRESHOLD;

View file

@ -1067,7 +1067,7 @@ merge_absinfo(const struct input_absinfo *orig,
if (!orig)
return NULL;
abs = calloc(sz, sizeof(*abs));
abs = zalloc(sz * sizeof(*abs));
litest_assert(abs != NULL);
nelem = 0;
@ -1101,7 +1101,7 @@ merge_events(const int *orig, const int *override)
if (!orig)
return NULL;
events = calloc(sz, sizeof(int));
events = zalloc(sz * sizeof(int));
litest_assert(events != NULL);
nelem = 0;