use calloc instead of memset and get rid of a duplicated field

This commit is contained in:
Christopher Chedeau
2014-04-18 16:03:29 -07:00
parent 75ab7b6f39
commit 02d8f35b9a
2 changed files with 1 additions and 3 deletions

View File

@@ -10,7 +10,6 @@
#define CSS_UNDEFINED NAN #define CSS_UNDEFINED NAN
void init_css_node(css_node_t *node) { void init_css_node(css_node_t *node) {
memset(node, 0, sizeof(*node));
node->style.align_items = CSS_ALIGN_FLEX_START; node->style.align_items = CSS_ALIGN_FLEX_START;
// Some of the fields default to undefined and not 0 // Some of the fields default to undefined and not 0
@@ -27,7 +26,7 @@ void init_css_node(css_node_t *node) {
} }
css_node_t *new_css_node() { css_node_t *new_css_node() {
css_node_t *node = malloc(sizeof(*node)); css_node_t *node = calloc(1, sizeof(*node));
init_css_node(node); init_css_node(node);
return node; return node;
} }

View File

@@ -60,7 +60,6 @@ typedef struct {
float padding[4]; float padding[4];
float position[4]; float position[4];
float dimensions[2]; float dimensions[2];
css_layout_t layout;
} css_style_t; } css_style_t;
typedef struct css_node { typedef struct css_node {