diff options
-rw-r--r-- | src/widget.c | 20 | ||||
-rw-r--r-- | src/widget.h | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/widget.c b/src/widget.c index c3007e1..b3b0307 100644 --- a/src/widget.c +++ b/src/widget.c @@ -10,18 +10,18 @@ cherry_widget_draw(CherryWidget *widget) widget->drawn = 1; } -CherryWidget * +CherryWidget cherry_widget_new(void) { - CherryWidget *widget = malloc(sizeof(*widget)); - widget->x = 0; - widget->y = 0; - widget->widgets = clist_create(); - widget->width = 0; - widget->height = 0; - widget->visible = 0; - widget->drawn = 0; - widget->draw = cherry_widget_draw; + CherryWidget widget; + widget.x = 0; + widget.y = 0; + widget.widgets = clist_create(); + widget.width = 0; + widget.height = 0; + widget.visible = 0; + widget.drawn = 0; + widget.draw = cherry_widget_draw; return widget; } diff --git a/src/widget.h b/src/widget.h index c324e0b..3488a7b 100644 --- a/src/widget.h +++ b/src/widget.h @@ -22,7 +22,7 @@ typedef struct CherryWidget { void (*draw)(struct CherryWidget *); } CherryWidget; -CherryWidget *cherry_widget_new(void); +CherryWidget cherry_widget_new(void); void cherry_widget_get_dimension(CherryWidget *, int *, int *); void cherry_widget_set_dimension(CherryWidget *, int, int); int cherry_widget_is_visible(CherryWidget *); |