summaryrefslogtreecommitdiffstats
path: root/src/libcroco
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcroco')
-rw-r--r--src/libcroco/cr-attr-sel.c5
-rw-r--r--src/libcroco/cr-om-parser.c43
-rw-r--r--src/libcroco/cr-parser.c5
-rw-r--r--src/libcroco/cr-prop-list.c2
-rw-r--r--src/libcroco/cr-simple-sel.c9
-rw-r--r--src/libcroco/cr-statement.c13
-rw-r--r--src/libcroco/cr-term.c7
7 files changed, 39 insertions, 45 deletions
diff --git a/src/libcroco/cr-attr-sel.c b/src/libcroco/cr-attr-sel.c
index 3c4800e66..0726f0f3e 100644
--- a/src/libcroco/cr-attr-sel.c
+++ b/src/libcroco/cr-attr-sel.c
@@ -208,8 +208,5 @@ cr_attr_sel_destroy (CRAttrSel * a_this)
a_this->next = NULL;
}
- if (a_this) {
- g_free (a_this);
- a_this = NULL;
- }
+ g_free (a_this);
}
diff --git a/src/libcroco/cr-om-parser.c b/src/libcroco/cr-om-parser.c
index b8d70e35a..c9ce032af 100644
--- a/src/libcroco/cr-om-parser.c
+++ b/src/libcroco/cr-om-parser.c
@@ -217,9 +217,9 @@ start_font_face (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt == NULL);
@@ -316,9 +316,9 @@ charset (CRDocHandler * a_this, CRString * a_charset,
ParsingContext **ctxtptr = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->stylesheet);
@@ -352,9 +352,9 @@ start_page (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt == NULL);
@@ -395,8 +395,11 @@ end_page (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
CRStatement *stmt = NULL;
+ UNUSED(a_page);
+ UNUSED(a_pseudo_page);
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt
@@ -416,8 +419,6 @@ end_page (CRDocHandler * a_this,
cr_statement_destroy (ctxt->cur_stmt);
ctxt->cur_stmt = NULL;
}
- a_page = NULL; /*keep compiler happy */
- a_pseudo_page = NULL; /*keep compiler happy */
}
static void
@@ -431,9 +432,9 @@ start_media (CRDocHandler * a_this,
GList *media_list = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
@@ -443,12 +444,10 @@ start_media (CRDocHandler * a_this,
&& ctxt->stylesheet);
if (a_media_list) {
/*duplicate the media_list */
- media_list = cr_utils_dup_glist_of_cr_string
- (a_media_list);
+ media_list = cr_utils_dup_glist_of_cr_string(a_media_list);
}
ctxt->cur_media_stmt =
- cr_statement_new_at_media_rule
- (ctxt->stylesheet, NULL, media_list);
+ cr_statement_new_at_media_rule(ctxt->stylesheet, NULL, media_list);
}
@@ -460,8 +459,10 @@ end_media (CRDocHandler * a_this, GList * a_media_list)
ParsingContext **ctxtptr = NULL;
CRStatement *stmts = NULL;
+ UNUSED(a_media_list);
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt
@@ -481,7 +482,6 @@ end_media (CRDocHandler * a_this, GList * a_media_list)
ctxt->cur_stmt = NULL ;
ctxt->cur_media_stmt = NULL ;
- a_media_list = NULL;
}
static void
@@ -499,10 +499,11 @@ import_style (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
GList *media_list = NULL ;
+ UNUSED(a_uri_default_ns);
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->stylesheet);
@@ -574,8 +575,10 @@ end_selector (CRDocHandler * a_this, CRSelector * a_selector_list)
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
+ UNUSED(a_selector_list);
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet);
diff --git a/src/libcroco/cr-parser.c b/src/libcroco/cr-parser.c
index a8e2de5a3..917c5cb60 100644
--- a/src/libcroco/cr-parser.c
+++ b/src/libcroco/cr-parser.c
@@ -4402,8 +4402,5 @@ cr_parser_destroy (CRParser * a_this)
PRIVATE (a_this) = NULL;
}
- if (a_this) {
- g_free (a_this);
- a_this = NULL; /*useless. Just for the sake of coherence */
- }
+ g_free (a_this);
}
diff --git a/src/libcroco/cr-prop-list.c b/src/libcroco/cr-prop-list.c
index 076837905..551f0b8ee 100644
--- a/src/libcroco/cr-prop-list.c
+++ b/src/libcroco/cr-prop-list.c
@@ -48,7 +48,7 @@ cr_prop_list_allocate (void)
}
memset (result, 0, sizeof (CRPropList));
PRIVATE (result) = (CRPropListPriv *)g_try_malloc (sizeof (CRPropListPriv));
- if (!result) {
+ if (!PRIVATE (result)) {
cr_utils_trace_info ("could not allocate CRPropListPriv");
g_free (result);
return NULL;
diff --git a/src/libcroco/cr-simple-sel.c b/src/libcroco/cr-simple-sel.c
index 18dd340d8..6a51a9526 100644
--- a/src/libcroco/cr-simple-sel.c
+++ b/src/libcroco/cr-simple-sel.c
@@ -275,12 +275,12 @@ cr_simple_sel_compute_specificity (CRSimpleSel * a_this)
/**
*The destructor of the current instance of
- *#CRSimpleSel.
+ *#CRSimpleSel. Recursively calls the destructor of #CRSimpleSel->next
*@param a_this the this pointer of the current instance of #CRSimpleSel.
*
*/
void
-cr_simple_sel_destroy (CRSimpleSel * a_this)
+cr_simple_sel_destroy (CRSimpleSel * const a_this)
{
g_return_if_fail (a_this);
@@ -296,9 +296,8 @@ cr_simple_sel_destroy (CRSimpleSel * a_this)
if (a_this->next) {
cr_simple_sel_destroy (a_this->next);
+ a_this->next = NULL;
}
- if (a_this) {
- g_free (a_this);
- }
+ g_free (a_this);
}
diff --git a/src/libcroco/cr-statement.c b/src/libcroco/cr-statement.c
index 40df49878..2b2c1836c 100644
--- a/src/libcroco/cr-statement.c
+++ b/src/libcroco/cr-statement.c
@@ -604,7 +604,10 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
g_return_val_if_fail (a_this && a_this->type == RULESET_STMT, NULL);
- GString *stringue = (GString *)g_string_new (NULL);
+ GString * stringue = (GString *)g_string_new (NULL);
+ if (!stringue) {
+ return result;
+ }
if (a_this->kind.ruleset->sel_list) {
if (a_indent)
@@ -635,10 +638,9 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
g_string_append (stringue, "}");
result = stringue->str;
- if (stringue) {
- g_string_free (stringue, FALSE);
- stringue = NULL;
- }
+ g_string_free (stringue, FALSE);
+ stringue = NULL;
+
if (tmp_str) {
g_free (tmp_str);
tmp_str = NULL;
@@ -1377,7 +1379,6 @@ cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
}
if (media_list) {
GList *cur = NULL;
-
for (cur = media_list; media_list;
media_list = g_list_next (media_list)) {
if (media_list->data) {
diff --git a/src/libcroco/cr-term.c b/src/libcroco/cr-term.c
index d95c4979f..635577334 100644
--- a/src/libcroco/cr-term.c
+++ b/src/libcroco/cr-term.c
@@ -771,7 +771,7 @@ cr_term_unref (CRTerm * a_this)
*of #CRTerm.
*/
void
-cr_term_destroy (CRTerm * a_this)
+cr_term_destroy (CRTerm * const a_this)
{
g_return_if_fail (a_this);
@@ -782,8 +782,5 @@ cr_term_destroy (CRTerm * a_this)
a_this->next = NULL;
}
- if (a_this) {
- g_free (a_this);
- }
-
+ g_free (a_this);
}