From c11a79c98df124fb33705f5c173f98b93bc0fb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 2 Nov 2020 19:09:58 +0100 Subject: [PATCH] bar, module: particles may no longer return NULL in instantiate() --- bar/bar.c | 21 --------------------- module.c | 3 +-- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/bar/bar.c b/bar/bar.c index 8dbda4b..526f80f 100644 --- a/bar/bar.c +++ b/bar/bar.c @@ -36,22 +36,16 @@ calculate_widths(const struct private *b, int *left, int *center, int *right) for (size_t i = 0; i < b->left.count; i++) { struct exposable *e = b->left.exps[i]; - if (e == NULL) - continue; *left += b->left_spacing + e->width + b->right_spacing; } for (size_t i = 0; i < b->center.count; i++) { struct exposable *e = b->center.exps[i]; - if (e == NULL) - continue; *center += b->left_spacing + e->width + b->right_spacing; } for (size_t i = 0; i < b->right.count; i++) { struct exposable *e = b->right.exps[i]; - if (e == NULL) - continue; *right += b->left_spacing + e->width + b->right_spacing; } @@ -85,30 +79,24 @@ expose(const struct bar *_bar) for (size_t i = 0; i < bar->left.count; i++) { struct module *m = bar->left.mods[i]; struct exposable *e = bar->left.exps[i]; - if (e != NULL) e->destroy(e); - bar->left.exps[i] = module_begin_expose(m); } for (size_t i = 0; i < bar->center.count; i++) { struct module *m = bar->center.mods[i]; struct exposable *e = bar->center.exps[i]; - if (e != NULL) e->destroy(e); - bar->center.exps[i] = module_begin_expose(m); } for (size_t i = 0; i < bar->right.count; i++) { struct module *m = bar->right.mods[i]; struct exposable *e = bar->right.exps[i]; - if (e != NULL) e->destroy(e); - bar->right.exps[i] = module_begin_expose(m); } @@ -119,8 +107,6 @@ expose(const struct bar *_bar) int x = bar->border.width + bar->left_margin - bar->left_spacing; for (size_t i = 0; i < bar->left.count; i++) { const struct exposable *e = bar->left.exps[i]; - if (e == NULL) - continue; e->expose(e, pix, x + bar->left_spacing, y, bar->height); x += bar->left_spacing + e->width + bar->right_spacing; } @@ -128,8 +114,6 @@ expose(const struct bar *_bar) x = bar->width / 2 - center_width / 2 - bar->left_spacing; for (size_t i = 0; i < bar->center.count; i++) { const struct exposable *e = bar->center.exps[i]; - if (e == NULL) - continue; e->expose(e, pix, x + bar->left_spacing, y, bar->height); x += bar->left_spacing + e->width + bar->right_spacing; } @@ -142,8 +126,6 @@ expose(const struct bar *_bar) for (size_t i = 0; i < bar->right.count; i++) { const struct exposable *e = bar->right.exps[i]; - if (e == NULL) - continue; e->expose(e, pix, x + bar->left_spacing, y, bar->height); x += bar->left_spacing + e->width + bar->right_spacing; } @@ -316,7 +298,6 @@ destroy(struct bar *bar) for (size_t i = 0; i < b->left.count; i++) { struct module *m = b->left.mods[i]; struct exposable *e = b->left.exps[i]; - if (e != NULL) e->destroy(e); m->destroy(m); @@ -324,7 +305,6 @@ destroy(struct bar *bar) for (size_t i = 0; i < b->center.count; i++) { struct module *m = b->center.mods[i]; struct exposable *e = b->center.exps[i]; - if (e != NULL) e->destroy(e); m->destroy(m); @@ -332,7 +312,6 @@ destroy(struct bar *bar) for (size_t i = 0; i < b->right.count; i++) { struct module *m = b->right.mods[i]; struct exposable *e = b->right.exps[i]; - if (e != NULL) e->destroy(e); m->destroy(m); diff --git a/module.c b/module.c index 6d30839..1e80c32 100644 --- a/module.c +++ b/module.c @@ -23,7 +23,6 @@ struct exposable * module_begin_expose(struct module *mod) { struct exposable *e = mod->content(mod); - if (e != NULL) - e->begin_expose(e); + e->begin_expose(e); return e; }