[vala/staging] codegen: Use alternative for g_strcmp0 in POSIX profile
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Use alternative for g_strcmp0 in POSIX profile
- Date: Sat, 19 Oct 2019 08:38:44 +0000 (UTC)
commit 7714596f4ebb061e6bd0991e5d3ee2a2f4987302
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Oct 19 00:12:26 2019 +0200
codegen: Use alternative for g_strcmp0 in POSIX profile
codegen/valaccodebasemodule.vala | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
---
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"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]