[vala/wip/ricotz: 6/6] codegen: g_free is already NULL-safe
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz: 6/6] codegen: g_free is already NULL-safe
- Date: Thu, 10 Nov 2016 13:49:57 +0000 (UTC)
commit ab99ec993144a63458907d8eddc01a8cf4fffa50
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Nov 10 14:40:18 2016 +0100
codegen: g_free is already NULL-safe
codegen/valaccodebasemodule.vala | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 66b8105..50fe680 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3073,7 +3073,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var freeid = (CCodeIdentifier) element_destroy_func_expression;
string free0_func = "_%s0_".printf (freeid.name);
- if (add_wrapper (free0_func)) {
+ // g_free is already NULL-safe
+ if (freeid.name == "g_free") {
+ free0_func = freeid.name;
+ } else if (add_wrapper (free0_func)) {
var function = new CCodeFunction (free0_func, "void");
function.modifiers = CCodeModifiers.STATIC;
@@ -3351,7 +3354,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var freeid = (CCodeIdentifier) ccall.call;
string free0_func = "_%s0".printf (freeid.name);
- if (add_wrapper (free0_func)) {
+ // g_free is already NULL-safe
+ if (freeid.name == "g_free") {
+ free0_func = freeid.name;
+ } else if (add_wrapper (free0_func)) {
var macro = destroy_value (new GLibValue (type, new CCodeIdentifier ("var"),
true), true);
cfile.add_type_declaration (new CCodeMacroReplacement.with_expression
("%s(var)".printf (free0_func), macro));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]