diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2013-08-03 20:35:52 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2013-08-03 20:35:52 +0000 |
| commit | 4a914e1f02d9ccb70858031f89e11ad480286413 (patch) | |
| tree | 6033a5fa569ddb52afc747e1771bcd6bd3f52d1f /src/libcroco | |
| parent | fix bug (diff) | |
| download | inkscape-4a914e1f02d9ccb70858031f89e11ad480286413.tar.gz inkscape-4a914e1f02d9ccb70858031f89e11ad480286413.zip | |
some code cleanup, trying to get it through cppcheck
(bzr r12458)
Diffstat (limited to 'src/libcroco')
| -rw-r--r-- | src/libcroco/cr-parser.c | 5 | ||||
| -rw-r--r-- | src/libcroco/cr-simple-sel.c | 9 | ||||
| -rw-r--r-- | src/libcroco/cr-statement.c | 13 | ||||
| -rw-r--r-- | src/libcroco/cr-term.c | 7 |
4 files changed, 14 insertions, 20 deletions
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-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); } |
