From: Rico Tzschichholz Date: Fri, 18 Oct 2019 22:12:26 +0000 (+0200) Subject: codegen: Use alternative for g_strcmp0 in POSIX profile X-Git-Tag: 0.47.1~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7714596f4ebb061e6bd0991e5d3ee2a2f4987302;p=thirdparty%2Fvala.git codegen: Use alternative for g_strcmp0 in POSIX profile --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 993355b7e..06830c981 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1867,7 +1867,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { get_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("old_value_length"))); ccode.open_if (new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, get_call, new CCodeIdentifier ("value"))); } else if (property_type.compatible (string_type)) { - var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0")); + CCodeFunctionCall ccall; + if (context.profile == Profile.POSIX) { + ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp")))); + } else { + ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0")); + } ccall.add_argument (new CCodeIdentifier ("value")); ccall.add_argument (get_call); ccode.open_if (new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, ccall, new CCodeConstant ("0"))); @@ -2913,7 +2918,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { make_comparable_cexpression (ref variable_type, ref s1, ref variable_type, ref s2); if (!(f.variable_type is NullType) && f.variable_type.compatible (string_type)) { - var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0")); + CCodeFunctionCall ccall; + if (context.profile == Profile.POSIX) { + ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp")))); + } else { + ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0")); + } ccall.add_argument (s1); ccall.add_argument (s2); cexp = ccall; @@ -5621,7 +5631,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { var cneedle = new CCodeIdentifier ("needle"); CCodeBinaryExpression cif_condition; if (array_type.element_type.compatible (string_type)) { - var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0")); + CCodeFunctionCall ccall; + if (context.profile == Profile.POSIX) { + ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp")))); + } else { + ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0")); + } ccall.add_argument (celement); ccall.add_argument (cneedle); cif_condition = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, ccall, new CCodeConstant ("0"));