+/**
+ * Set the local externally-stored parts of a parse state.
+ * Call this in functions that made a new state on the stack.
+ * Doesn't make own copy of global state, such as the interned string list.
+ */
+static void svgtiny_setup_state_local(struct svgtiny_parse_state *state)
+{
+ if (state->gradient_x1 != NULL) {
+ dom_string_ref(state->gradient_x1);
+ }
+ if (state->gradient_y1 != NULL) {
+ dom_string_ref(state->gradient_y1);
+ }
+ if (state->gradient_x2 != NULL) {
+ dom_string_ref(state->gradient_x2);
+ }
+ if (state->gradient_y2 != NULL) {
+ dom_string_ref(state->gradient_y2);
+ }
+}
+
+/**
+ * Cleanup the local externally-stored parts of a parse state.
+ * Call this in functions that made a new state on the stack.
+ * Doesn't cleanup global state, such as the interned string list.
+ */
+static void svgtiny_cleanup_state_local(struct svgtiny_parse_state *state)
+{
+ if (state->gradient_x1 != NULL) {
+ dom_string_unref(state->gradient_x1);
+ state->gradient_x1 = NULL;
+ }
+ if (state->gradient_y1 != NULL) {
+ dom_string_unref(state->gradient_y1);
+ state->gradient_y1 = NULL;
+ }
+ if (state->gradient_x2 != NULL) {
+ dom_string_unref(state->gradient_x2);
+ state->gradient_x2 = NULL;
+ }
+ if (state->gradient_y2 != NULL) {
+ dom_string_unref(state->gradient_y2);
+ state->gradient_y2 = NULL;
+ }
+}
+