X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fsvgtiny.c;h=a77e3b46d9f7c0ca382190075f6971af475c4da9;hb=9d74009dd53f0d4cbb1101c9cffe0fda7f983bf2;hp=f6319305c3d2f1c76504766879b9ef55a9e219ea;hpb=545123c6ec9a3d3903e713c1c2919762417538dd;p=libsvgtiny.git diff --git a/src/svgtiny.c b/src/svgtiny.c index f631930..a77e3b4 100644 --- a/src/svgtiny.c +++ b/src/svgtiny.c @@ -697,22 +697,21 @@ svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram, lwc_string_unref(svg_name_lwc); dom_string_unref(svg_name); - /* get graphic dimensions */ + /* initialize the state struct with zeros */ memset(&state, 0, sizeof(state)); + + /* get graphic dimensions */ state.diagram = diagram; state.document = document; state.viewport_width = viewport_width; state.viewport_height = viewport_height; - /* Initialize CSS context */ - if (state.select_ctx == NULL) { - css_code = css_select_ctx_create(&state.select_ctx); - if (css_code != CSS_OK) { - dom_node_unref(svg); - dom_node_unref(document); - return svgtiny_LIBCSS_ERROR; - } + css_code = css_select_ctx_create(&state.select_ctx); + if (css_code != CSS_OK) { + dom_node_unref(svg); + dom_node_unref(document); + return svgtiny_LIBCSS_ERROR; } #define SVGTINY_STRING_ACTION2(s,n) \