← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.

Commit message:
small optimization in comparison operators + mafe string and jsoniq modules pure builtin

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/137413

small optimization in comparison operators + mafe string and jsoniq modules pure builtin
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/137413
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2012-11-17 00:57:54 +0000
+++ src/context/static_context.cpp	2012-12-02 07:31:21 +0000
@@ -590,12 +590,8 @@
   {
     return (ns == ZORBA_MATH_FN_NS ||
             ns == ZORBA_INTROSP_SCTX_FN_NS ||
-            ns == ZORBA_STRING_FN_NS ||
             ns == ZORBA_JSON_FN_NS ||
             ns == ZORBA_XQDOC_FN_NS ||
-#ifdef ZORBA_WITH_JSON
-            ns == JSONIQ_FN_NS ||
-#endif
             ns == ZORBA_URI_FN_NS ||
             ns == ZORBA_RANDOM_FN_NS ||
             ns == ZORBA_FETCH_FN_NS ||

=== modified file 'src/runtime/booleans/BooleanImpl.cpp'
--- src/runtime/booleans/BooleanImpl.cpp	2012-09-19 21:16:15 +0000
+++ src/runtime/booleans/BooleanImpl.cpp	2012-12-02 07:31:21 +0000
@@ -629,21 +629,22 @@
   store::SchemaTypeCode type1 = item1->getTypeCode();
 
   // all untyped Atomics to String
-  if (TypeOps::is_subtype(type0, store::XS_UNTYPED_ATOMIC))
+  if (type0 == store::XS_UNTYPED_ATOMIC)
   {
-    GenericCast::castToAtomic(castItem0, item0, store::XS_STRING, tm, NULL, loc);
-
-    if  (TypeOps::is_subtype(type1, store::XS_UNTYPED_ATOMIC))
+    if  (type1 == store::XS_UNTYPED_ATOMIC)
     {
-      GenericCast::castToAtomic(castItem1, item1, store::XS_STRING, tm, NULL, loc);
+      castItem0.transfer(item0);
+      castItem1.transfer(item1);
     }
     else
     {
+      GenericCast::castToAtomic(castItem0, item0, store::XS_STRING, tm, NULL, loc);
+
       if (!GenericCast::promote(castItem1, item1, store::XS_STRING, tm, loc))
         castItem1.transfer(item1);
     }
   }
-  else if (TypeOps::is_subtype(type1, store::XS_UNTYPED_ATOMIC))
+  else if (type1 == store::XS_UNTYPED_ATOMIC)
   {
     if (!GenericCast::promote(castItem0, item0, store::XS_STRING, tm, loc))
       castItem0.transfer(item0);
@@ -810,7 +811,7 @@
   store::SchemaTypeCode type0 = item0->getTypeCode();
   store::SchemaTypeCode type1 = item1->getTypeCode();
 
-  if (TypeOps::is_subtype(type0, store::XS_UNTYPED_ATOMIC))
+  if (type0 == store::XS_UNTYPED_ATOMIC)
   {
     if (TypeOps::is_numeric(type1))
     {
@@ -818,10 +819,10 @@
 
       GenericCast::promote(castItem1, item1, store::XS_DOUBLE, tm, loc);
     }
-    else if (TypeOps::is_subtype(type1, store::XS_UNTYPED_ATOMIC))
+    else if (type1 == store::XS_UNTYPED_ATOMIC)
     {
-      GenericCast::castToAtomic(castItem0, item0, store::XS_STRING, tm, NULL, loc);
-      GenericCast::castToAtomic(castItem1, item1, store::XS_STRING, tm, NULL, loc);
+      castItem0.transfer(item0);
+      castItem1.transfer(item1);
     }
     else if (TypeOps::is_subtype(type1, store::XS_STRING))
     {
@@ -834,7 +835,7 @@
       castItem1.transfer(item1);
     }
   }
-  else if (TypeOps::is_subtype(type1, store::XS_UNTYPED_ATOMIC))
+  else if (type1 == store::XS_UNTYPED_ATOMIC)
   {
     if (TypeOps::is_numeric(type0))
     {


Follow ups