Skip to content

Commit b0f4587

Browse files
committed
parse: No need to NULL guard lwc_string_unref
1 parent 2072074 commit b0f4587

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/parse/language.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ css_error css__language_destroy(css_language *language)
169169
if (language == NULL)
170170
return CSS_BADPARM;
171171

172-
if (language->default_namespace != NULL)
173-
lwc_string_unref(language->default_namespace);
172+
lwc_string_unref(language->default_namespace);
174173

175174
if (language->namespaces != NULL) {
176175
for (i = 0; i < language->num_namespaces; i++) {
@@ -855,8 +854,7 @@ css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri)
855854
{
856855
if (prefix == NULL) {
857856
/* Replace default namespace */
858-
if (c->default_namespace != NULL)
859-
lwc_string_unref(c->default_namespace);
857+
lwc_string_unref(c->default_namespace);
860858

861859
/* Special case: if new namespace uri is "", use NULL */
862860
if (lwc_string_length(uri) == 0)
@@ -892,8 +890,7 @@ css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri)
892890
}
893891

894892
/* Replace namespace URI */
895-
if (c->namespaces[idx].uri != NULL)
896-
lwc_string_unref(c->namespaces[idx].uri);
893+
lwc_string_unref(c->namespaces[idx].uri);
897894

898895
/* Special case: if new namespace uri is "", use NULL */
899896
if (lwc_string_length(uri) == 0)

0 commit comments

Comments
 (0)