Pārlūkot izejas kodu

Fix graph boolean XOR op.

scossu 9 mēneši atpakaļ
vecāks
revīzija
78064ee6d6
1 mainītis faili ar 10 papildinājumiem un 1 dzēšanām
  1. 10 1
      src/graph.c

+ 10 - 1
src/graph.c

@@ -80,6 +80,8 @@ LSUP_graph_bool_op_txn (
         return LSUP_VALUE_ERR;
     }
 
+    /* BEGIN union block. */
+
     if (op == LSUP_BOOL_UNION) {
         rc = LSUP_graph_copy_contents (gr1, res);
         PCHECK (rc, fail);
@@ -89,6 +91,10 @@ LSUP_graph_bool_op_txn (
         return LSUP_OK;
     }
 
+    /* END union block. */
+
+    /* BEGIN subtraction, intersection, XOR block. */
+
     LSUP_Buffer
         *res_sc = LSUP_term_serialize (res->uri),
         *gr1_sc = LSUP_term_serialize (gr1->uri),
@@ -107,7 +113,7 @@ LSUP_graph_bool_op_txn (
             lu1_it = gr1->store->sif->lookup_fn (
                     gr1->store->data, sspo->s, sspo->p, sspo->o, gr1_sc,
                     txn, &ct);
-            if (ct > 0)
+            if (ct == 0)
                 res->store->sif->add_iter_fn (add_it, sspo);
             gr1->store->sif->lu_free_fn (lu1_it);
         }
@@ -129,10 +135,13 @@ LSUP_graph_bool_op_txn (
     gr1->store->sif->lu_free_fn (lu1_it);
 
     res->store->sif->add_done_fn (add_it);
+    LSUP_btriple_free_shallow (sspo);
     LSUP_buffer_free (res_sc);
     LSUP_buffer_free (gr1_sc);
     LSUP_buffer_free (gr2_sc);
 
+    /* END subtraction, intersection, XOR block. */
+
     return rc;
 
 fail: