style: fix sizeof() calls without parentheses

This commit is contained in:
Dominique Martinet 2017-12-28 16:28:19 +01:00
parent da3ef46daf
commit 8e24aaa3c6
3 changed files with 4 additions and 4 deletions

View file

@ -223,7 +223,7 @@ static bool match_obj_(struct match_state *st, size_t skips, size_t score, size_
if (score > st->score || (score == st->score && replaced < st->replaced)) {
st->score = score;
st->replaced = replaced;
memcpy(st->best, st->res, sizeof st->best[0] * st->num_res);
memcpy(st->best, st->res, sizeof(st->best[0]) * st->num_res);
if (st->score == st->num_objs && st->replaced == 0) {
st->exit_early = true;

View file

@ -95,7 +95,7 @@ static void handle_global(void *data, struct wl_registry *registry,
static struct screenshooter_output *output;
if (strcmp(interface, "wl_output") == 0) {
output = calloc(1, sizeof *output);
output = calloc(1, sizeof(*output));
output->output = wl_registry_bind(registry, name, &wl_output_interface,
1);
wl_list_insert(&output_list, &output->link);

View file

@ -901,14 +901,14 @@ static void data_source_offer(struct wl_client *client,
wl_resource_get_user_data(resource);
char **p;
p = wl_array_add(&source->mime_types, sizeof *p);
p = wl_array_add(&source->mime_types, sizeof(*p));
if (p) {
*p = strdup(mime_type);
}
if (!p || !*p){
if (p) {
source->mime_types.size -= sizeof *p;
source->mime_types.size -= sizeof(*p);
}
wl_resource_post_no_memory(resource);
}