Revert "Remove state machine but performance seems to drop"

This reverts commit 30af26dbe63410544a1ec01d1481dc1f07cfb2b3.

--- src/bwtree.h
+++ src/bwtree.h
@@ -4084,98 +4084,136 @@
     idb.AddKey(context_p->search_key);
     #endif

-traverse_init:
-    assert(context_p->abort_flag == false);
-    assert(context_p->current_level == -1);
-
-    // This is the serialization point for reading/writing root node
-    NodeID start_node_id = root_id.load();
-
-    // We need to call this even for root node since there could
-    // be split delta posted on to root node
-    LoadNodeIDReadOptimized(start_node_id, context_p);
-
-    // There could be an abort here, and we could not directly jump
-    // to Init state since we would like to do some clean up or
-    // statistics after aborting
-    if(context_p->abort_flag == true) {
-      goto traverse_abort;
-    }
-
-    bwt_printf("Successfully loading root node ID\n");
-
     while(1) {
-      NodeID child_node_id = NavigateInnerNode(context_p);
-
-      // Navigate could abort since it might go to another NodeID
-      // if there is a split delta and the key is >= split key
-      if(context_p->abort_flag == true) {
-        bwt_printf("Navigate Inner Node abort. ABORT\n");
-
-        // If NavigateInnerNode() aborts then it retrns INVALID_NODE_ID
-        // as a double check
-        // This is the only situation that this function returns
-        // INVALID_NODE_ID
-        assert(child_node_id == INVALID_NODE_ID);
-
-        goto traverse_abort;
-      }
-
-      // We use this to check whether NavigateInnerNode() brings us
-      // to the correct inner node
-      NodeSnapshot *snapshot_p = GetLatestNodeSnapshot(context_p);
-
-      assert(KeyCmpGreaterEqual(context_p->search_key,
-                                snapshot_p->node_p->metadata.lbound));
-      assert(KeyCmpLess(context_p->search_key,
-                        snapshot_p->node_p->metadata.ubound));
-
-      // This might load a leaf child
-      // Also LoadNodeID() does not guarantee the node bound matches
-      // seatch key. Since we could readjust using the split side link
-      // during Navigate...Node()
-      LoadNodeIDReadOptimized(child_node_id, context_p);
-
-      if(context_p->abort_flag == true) {
-        bwt_printf("LoadNodeID aborted. ABORT\n");
-
-        goto traverse_abort;
-      }
-
-      // This is the node we have just loaded
-      snapshot_p = GetLatestNodeSnapshot(context_p);
-
-      if(snapshot_p->IsLeaf() == true) {
-        bwt_printf("The next node is a leaf\n");
-
-        break;
-      }
-    }
-
-    NavigateLeafNode(context_p, *value_list_p);
-
-    if(context_p->abort_flag == true) {
-      bwt_printf("NavigateLeafNode aborts. ABORT\n");
-
-      goto traverse_abort;
-    }
-
-    bwt_printf("Found leaf node. Abort count = %d, level = %d\n",
-               context_p->abort_counter,
-               context_p->current_level);
-
-    // If there is no abort then we could safely return
+      // NOTE: break only breaks out this switch
+      switch(context_p->current_state) {
+        case OpState::Init: {
+          assert(context_p->abort_flag == false);
+          assert(context_p->current_level == -1);
+
+          // This is the serialization point for reading/writing root node
+          NodeID start_node_id = root_id.load();
+
+          // We need to call this even for root node since there could
+          // be split delta posted on to root node
+          LoadNodeIDReadOptimized(start_node_id, context_p);
+
+          // There could be an abort here, and we could not directly jump
+          // to Init state since we would like to do some clean up or
+          // statistics after aborting
+          if(context_p->abort_flag == true) {
+            context_p->current_state = OpState::Abort;
+
+            // This goes to the beginning of loop
+            break;
+          }
+
+          bwt_printf("Successfully loading root node ID\n");
+
+          // root node must be an inner node
+          // NOTE: We do not traverse down in this state, just hand it
+          // to Inner state and let it do all generic job
+          context_p->current_state = OpState::Inner;
+
+          break;
+        } // case Init
+        case OpState::Inner: {
+          NodeID child_node_id = NavigateInnerNode(context_p);
+
+          // Navigate could abort since it might go to another NodeID
+          // if there is a split delta and the key is >= split key
+          if(context_p->abort_flag == true) {
+            bwt_printf("Navigate Inner Node abort. ABORT\n");
+
+            // If NavigateInnerNode() aborts then it retrns INVALID_NODE_ID
+            // as a double check
+            // This is the only situation that this function returns
+            // INVALID_NODE_ID
+            assert(child_node_id == INVALID_NODE_ID);
+
+            context_p->current_state = OpState::Abort;
+
+            break;
+          }
+
+          // We use this to check whether NavigateInnerNode() brings us
+          // to the correct inner node
+          NodeSnapshot *snapshot_p = GetLatestNodeSnapshot(context_p);
+
+          assert(KeyCmpGreaterEqual(context_p->search_key,
+                                    snapshot_p->node_p->metadata.lbound));
+          assert(KeyCmpLess(context_p->search_key,
+                            snapshot_p->node_p->metadata.ubound));
+
+          // This might load a leaf child
+          // Also LoadNodeID() does not guarantee the node bound matches
+          // seatch key. Since we could readjust using the split side link
+          // during Navigate...Node()
+          LoadNodeIDReadOptimized(child_node_id, context_p);
+
+          if(context_p->abort_flag == true) {
+            bwt_printf("LoadNodeID aborted. ABORT\n");
+
+            context_p->current_state = OpState::Abort;
+
+            break;
+          }
+
+          // This is the node we have just loaded
+          snapshot_p = GetLatestNodeSnapshot(context_p);
+
+          if(snapshot_p->IsLeaf() == true) {
+            bwt_printf("The next node is a leaf\n");
+
+            // If there is an abort later on then we just go to
+            // abort state
+            context_p->current_state = OpState::Leaf;
+          }
+
+          break;
+        } // case Inner
+        case OpState::Leaf: {
+          NavigateLeafNode(context_p, *value_list_p);
+
+          if(context_p->abort_flag == true) {
+            bwt_printf("NavigateLeafNode aborts. ABORT\n");
+
+            context_p->current_state = OpState::Abort;
+
+            break;
+          }
+
+          bwt_printf("Found leaf node. Abort count = %d, level = %d\n",
+                     context_p->abort_counter,
+                     context_p->current_level);
+
+          // If there is no abort then we could safely return
+          return;
+
+          assert(false);
+        }
+        case OpState::Abort: {
+          assert(context_p->current_level >= 0);
+
+          context_p->current_state = OpState::Init;
+          context_p->current_level = -1;
+
+          context_p->abort_flag = false;
+          context_p->abort_counter++;
+
+          break;
+        } // case Abort
+        default: {
+          bwt_printf("ERROR: Unknown State: %d\n",
+                     static_cast<int>(context_p->current_state));
+          assert(false);
+          break;
+        }
+      } // switch current_state
+    } // while(1)
+
+    assert(false);
     return;
-
-traverse_abort:
-    assert(context_p->current_level >= 0);
-
-    context_p->current_level = -1;
-
-    context_p->abort_flag = false;
-    context_p->abort_counter++;
-
-    goto traverse_init;
   }

   ///////////////////////////////////////////////////////////////////


functions: revert the function init order to make pylint happy again. See #217

While this is not correct (and crashes with PyPy, thus the ifdeffery) it makes
pylint happy. Do this for now until we figure out what confuses pylint here.

--- gi/pygi-info.c
+++ gi/pygi-info.c
@@ -2308,10 +2308,18 @@
     _PyGI_REGISTER_TYPE (m, PyGICallableInfo_Type, CallableInfo,
                          PyGIBaseInfo_Type);

+    // FIXME: this is to work around a pylint issue
+    // https://gitlab.gnome.org/GNOME/pygobject/issues/217
+#ifndef PYPY_VERSION
+    _PyGI_REGISTER_TYPE (m, PyGIFunctionInfo_Type, FunctionInfo,
+                         PyGICallableInfo_Type);
+#endif
     PyGIFunctionInfo_Type.tp_call = (ternaryfunc) _function_info_call;
     PyGIFunctionInfo_Type.tp_descr_get = (descrgetfunc) _function_info_descr_get;
+#ifdef PYPY_VERSION
     _PyGI_REGISTER_TYPE (m, PyGIFunctionInfo_Type, FunctionInfo,
                          PyGICallableInfo_Type);
+#endif

     PyGIVFuncInfo_Type.tp_descr_get = (descrgetfunc) _vfunc_info_descr_get;
     _PyGI_REGISTER_TYPE (m, PyGIVFuncInfo_Type, VFuncInfo,


Check realloc's return code to prevent segfault on out of memory condition (Part 3)

--- src/c/http.c
+++ src/c/http.c
@@ -97,8 +97,15 @@

       if (back - buf == buf_size - 1) {
         char *new_buf;
-        buf_size *= 2;
-        new_buf = realloc(buf, buf_size);
+        size_t new_buf_size = buf_size*2;
+        new_buf = realloc(buf, new_buf_size);
+        if(!new_buf) {
+          qfprintf(stderr, "Realloc failed while receiving header\n");
+          close(sock);
+          sock = 0;
+          break;
+        }
+        buf_size = new_buf_size;
         back = new_buf + (back - buf);
         buf = new_buf;
       }
@@ -146,9 +153,16 @@
           while (back - body < clen) {
             if (back - buf == buf_size - 1) {
               char *new_buf;
-              buf_size *= 2;
-              new_buf = realloc(buf, buf_size);
-
+              size_t new_buf_size = buf_size * 2;
+              new_buf = realloc(buf, new_buf_size);
+              if(!new_buf) {
+                qfprintf(stderr, "Realloc failed while receiving content\n");
+                close(sock);
+                sock = 0;
+                goto done;
+              }
+
+              buf_size = new_buf_size;
               back = new_buf + (back - buf);
               body = new_buf + (body - buf);
               s = new_buf + (s - buf);


Add separator lines on weather

Add separator lines on weather

--- src/c/main.c
+++ src/c/main.c
@@ -404,12 +404,32 @@

 static void precip_chance_layer_update_proc(Layer *layer, GContext *ctx) {
   GRect bounds = layer_get_bounds(layer);
+  GPoint midway_48h = GPoint(
+    PRECIP_60M_WIDTH + ((bounds.size.w - PRECIP_60M_WIDTH) / 2),
+    (s_precip_48h_points[23].y + s_precip_48h_points[24].y) / 2
+  );
+
+  // Draw backdrop
   graphics_context_set_fill_color(ctx, GColorOxfordBlue);
   graphics_fill_rect(ctx, bounds, 0, GCornerNone);
+
+  // Draw graph
   graphics_context_set_fill_color(ctx, GColorDukeBlue);
   gpath_draw_filled(ctx, s_precip_60m_path);
   graphics_context_set_fill_color(ctx, GColorBlue);
   gpath_draw_filled(ctx, s_precip_48h_path);
+
+  // Draw interval lines
+  graphics_context_set_stroke_width(ctx, 1);
+  graphics_context_set_stroke_color(ctx, GColorDukeBlue);
+  graphics_draw_line(ctx, GPoint(PRECIP_60M_WIDTH, 0),
+    GPoint(PRECIP_60M_WIDTH, s_precip_48h_points[0].y - 1));
+  graphics_draw_line(ctx, GPoint(midway_48h.x, 0),
+    GPoint(midway_48h.x, midway_48h.y - 1));
+  graphics_context_set_stroke_color(ctx, GColorBlueMoon);
+  graphics_draw_line(ctx, GPoint(PRECIP_60M_WIDTH, s_precip_48h_points[0].y),
+    GPoint(PRECIP_60M_WIDTH, WEATHER_HEIGHT));
+  graphics_draw_line(ctx, midway_48h, GPoint(midway_48h.x, WEATHER_HEIGHT));
 }

 static void main_window_load(Window *window) {


Updated blat_coarse to take in the database directory and query file path separately

--- src/cablat.c
+++ src/cablat.c
@@ -107,17 +107,17 @@

 /*Runs BLAT on the coarse FASTA file and stores the results in a temporary
   psl file.*/
-void blat_coarse(struct opt_args *args){
-    char *target_path = path_join(args->args[0], CABLAST_COARSE_FASTA),
+void blat_coarse(char *db, char *queries){
+    char *target_path = path_join(db, CABLAST_COARSE_FASTA),
          *coarse_blat_command =
             malloc(
               (strlen("$HOME/bin/$MACHTYPE/blat    -noHead -minIdentity=80")
-               +strlen(target_path)+strlen(args->args[1])
-               +strlen("coarse-blat.psl")+1)*sizeof(*coarse_blat_command));
+               +strlen(target_path)+strlen(queries)+strlen("coarse-blat.psl")+1)
+              *sizeof(*coarse_blat_command));

     sprintf(coarse_blat_command,
             "$HOME/bin/$MACHTYPE/blat %s %s %s -noHead -minIdentity=80",
-            target_path, args->args[1], "coarse-blat.psl");
+            target_path, queries, "coarse-blat.psl");

     if (!cablat_flags.hide_progress)
         fprintf(stderr, "%s\n", coarse_blat_command);
@@ -269,7 +269,7 @@

     write_numbered_fasta(args->args[1], "CaBLAT_numbered_queries.fasta");

-    blat_coarse(args);
+    blat_coarse(args->args[0], "CaBLAT_numbered_queries.fasta");

     FILE *coarse_blat_output;


moved apic init() before the printf of the barrelfish to get the correct apic_id

--- kernel/arch/x86_64/init.c
+++ kernel/arch/x86_64/init.c
@@ -481,11 +481,12 @@
     // Enable machine check reporting
     mcheck_init();

+    // Initialize local APIC
+    apic_init();
+
     // do not remove/change this printf: needed by regression harness
     printf("Barrelfish CPU driver starting on x86_64 apic_id %u\n", apic_id);
-
-    // Initialize local APIC
-    apic_init();
+

     if(apic_is_bsp()) {
         // Initialize classic (8259A) PIC


[tty] Embed tty_keypress_echo() in kb_buf_write_elem()

--- kernel/char/tty_input.c.h
+++ kernel/char/tty_input.c.h
@@ -8,47 +8,6 @@
 static char kb_input_buf[KB_INPUT_BUF_SIZE];
 static ringbuf kb_input_ringbuf;
 static kcond kb_input_cond;
-
-static inline bool kb_buf_is_empty(void)
-{
-   return ringbuf_is_empty(&kb_input_ringbuf);
-}
-
-static inline char kb_buf_read_elem(void)
-{
-   u8 ret;
-   ASSERT(!kb_buf_is_empty());
-   DEBUG_CHECKED_SUCCESS(ringbuf_read_elem1(&kb_input_ringbuf, &ret));
-   return (char)ret;
-}
-
-static inline bool kb_buf_drop_last_written_elem(void)
-{
-   char unused;
-   return ringbuf_unwrite_elem(&kb_input_ringbuf, &unused);
-}
-
-static inline bool kb_buf_write_elem(char c)
-{
-   return ringbuf_write_elem1(&kb_input_ringbuf, c);
-}
-
-static int tty_keypress_handle_canon_mode(u32 key, u8 c)
-{
-   if (c == c_term.c_cc[VERASE]) {
-
-      kb_buf_drop_last_written_elem();
-
-   } else {
-
-      kb_buf_write_elem(c);
-
-      if (c == '\n')
-         kcond_signal_one(&kb_input_cond);
-   }
-
-   return KB_HANDLER_OK_AND_CONTINUE;
-}

 static void tty_keypress_echo(char c)
 {
@@ -113,6 +72,49 @@
    term_write(&c, 1);
 }

+static inline bool kb_buf_is_empty(void)
+{
+   return ringbuf_is_empty(&kb_input_ringbuf);
+}
+
+static inline char kb_buf_read_elem(void)
+{
+   u8 ret;
+   ASSERT(!kb_buf_is_empty());
+   DEBUG_CHECKED_SUCCESS(ringbuf_read_elem1(&kb_input_ringbuf, &ret));
+   return (char)ret;
+}
+
+static inline bool kb_buf_drop_last_written_elem(void)
+{
+   char unused;
+   tty_keypress_echo(c_term.c_cc[VERASE]);
+   return ringbuf_unwrite_elem(&kb_input_ringbuf, &unused);
+}
+
+static inline bool kb_buf_write_elem(char c)
+{
+   tty_keypress_echo(c);
+   return ringbuf_write_elem1(&kb_input_ringbuf, c);
+}
+
+static int tty_keypress_handle_canon_mode(u32 key, u8 c)
+{
+   if (c == c_term.c_cc[VERASE]) {
+
+      kb_buf_drop_last_written_elem();
+
+   } else {
+
+      kb_buf_write_elem(c);
+
+      if (c == '\n')
+         kcond_signal_one(&kb_input_cond);
+   }
+
+   return KB_HANDLER_OK_AND_CONTINUE;
+}
+
 static int tty_handle_non_printable_key(u32 key)
 {
    char seq[16];
@@ -125,11 +127,7 @@
    }

    while (*p) {
-
-      kb_buf_write_elem(*p);
-      tty_keypress_echo(*p);
-
-      p++;
+      kb_buf_write_elem(*p++);
    }

    if (!(c_term.c_lflag & ICANON))
@@ -164,7 +162,6 @@
    }

    kb_buf_write_elem(t);
-   tty_keypress_echo(t);
 }

 /*
@@ -177,17 +174,13 @@
       return KB_HANDLER_NAK;
    }

-   if (kb_is_alt_pressed()) {
+   if (kb_is_alt_pressed())
       kb_buf_write_elem('\033');
-      tty_keypress_echo('\033');
-   }
-
-   if (kb_is_ctrl_pressed()) {
+
+   if (kb_is_ctrl_pressed())
       tty_handle_ctrl_plus_letter(c);
-   } else {
+   else
       kb_buf_write_elem(c);
-      tty_keypress_echo(c);
-   }

    if (!(c_term.c_lflag & ICANON))
       kcond_signal_one(&kb_input_cond);
@@ -197,18 +190,14 @@

 static int tty_keypress_handler(u32 key, u8 c)
 {
-   if (key == KEY_PAGE_UP) {
-      if (kb_is_pressed(KEY_L_SHIFT) || kb_is_pressed(KEY_R_SHIFT)) {
-         term_scroll_up(5);
-         return KB_HANDLER_OK_AND_STOP;
-      }
-   }
-
-   if (key == KEY_PAGE_DOWN) {
-      if (kb_is_pressed(KEY_L_SHIFT) || kb_is_pressed(KEY_R_SHIFT)) {
-         term_scroll_down(5);
-         return KB_HANDLER_OK_AND_STOP;
-      }
+   if (key == KEY_PAGE_UP && kb_is_shift_pressed()) {
+      term_scroll_up(5);
+      return KB_HANDLER_OK_AND_STOP;
+   }
+
+   if (key == KEY_PAGE_DOWN && kb_is_shift_pressed()) {
+      term_scroll_down(5);
+      return KB_HANDLER_OK_AND_STOP;
    }

    if (!c)
@@ -217,8 +206,6 @@
    if (kb_get_current_modifiers() > 2)
       return tty_handle_pchar_with_mods(c);

-   tty_keypress_echo(c);
-
    if (c_term.c_lflag & ICANON)
       return tty_keypress_handle_canon_mode(key, c);


make-bug fix for windows version

make-bug fix for windows version

--- kernel/common/u/usocket.c
+++ kernel/common/u/usocket.c
@@ -13,6 +13,7 @@

 #else
 #include <Winsock2.h>
+#include <ws2tcpip.h>
 #endif


Revert "clockevents: Set noop handler in clockevents_exchange_device()"

This reverts commit de28f25e8244c7353abed8de0c7792f5f883588c.

It results in resume problems for various people. See for example

  http://thread.gmane.org/gmane.linux.kernel/1233033
  http://thread.gmane.org/gmane.linux.kernel/1233389
  http://thread.gmane.org/gmane.linux.kernel/1233159
  http://thread.gmane.org/gmane.linux.kernel/1227868/focus=1230877

and the fedora and ubuntu bug reports

  https://bugzilla.redhat.com/show_bug.cgi?id=767248
  https://bugs.launchpad.net/ubuntu/+source/linux/+bug/904569

which got bisected down to the stable version of this commit.

Reported-by: Jonathan Nieder <b57189c5f2fd5b3daf3350a77fde90def1080fa5@gmail.com>
Reported-by: Phil Miller <8ab4e956e1bdf9eb343e34d9113b7fe4c7e58c41@illinois.edu>
Reported-by: Philip Langdale <c2e2ad641b78da5d5e231b38d6c2530ebaa29faa@overt.org>
Reported-by: Tim Gardner <c65a040f7f664378353fb65fc3553df208a14f68@canonical.com>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Greg KH <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org    # for stable kernels that applied the original
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- kernel/time/clockevents.c
+++ kernel/time/clockevents.c
@@ -387,7 +387,6 @@
 	 * released list and do a notify add later.
 	 */
 	if (old) {
-		old->event_handler = clockevents_handle_noop;
 		clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED);
 		list_del(&old->list);
 		list_add(&old->list, &clockevents_released);


clockevents: Prevent shift out of bounds

Andrey reported that on a kernel with UBSan enabled he found:

     UBSan: Undefined behaviour in ../kernel/time/clockevents.c:75:34

     I guess it should be 1ULL here instead of 1U:
            (!ismax || evt->mult <= (1U << evt->shift)))

That's indeed the correct solution because shift might be 32.

Reported-by: Andrey Ryabinin <d7a2c23eccda99639e3fab64d868a1b1895748fa@samsung.com>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>


time: Revert to calling clock_was_set_delayed() while in irq context

In commit 47a1b796306356f35 ("tick/timekeeping: Call
update_wall_time outside the jiffies lock"), we moved to calling
clock_was_set() due to the fact that we were no longer holding
the timekeeping or jiffies lock.

However, there is still the problem that clock_was_set()
triggers an IPI, which cannot be done from the timer's hard irq
context, and will generate WARN_ON warnings.

Apparently in my earlier testing, I'm guessing I didn't bump the
dmesg log level, so I somehow missed the WARN_ONs.

Thus we need to revert back to calling clock_was_set_delayed().

Signed-off-by: John Stultz <33837adfb53316eae44aad04041e1240088d76fd@linaro.org>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Link: http://lkml.kernel.org/r/1395963049-11923-1-git-send-email-33837adfb53316eae44aad04041e1240088d76fd@linaro.org
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

--- kernel/time/timekeeping.c
+++ kernel/time/timekeeping.c
@@ -1435,7 +1435,8 @@
 out:
 	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
 	if (clock_set)
-		clock_was_set();
+		/* Have to call _delayed version, since in irq context*/
+		clock_was_set_delayed();
 }

 /**


Update comment about sensing window.

Update comment about sensing window.

--- open_spiel/games/rbc.h
+++ open_spiel/games/rbc.h
@@ -76,11 +76,16 @@
 // difference of player's pieces observations in the sensing phase.
 //
 // > "Sense phase: the player chooses any square on the chessboard to target
-// > their sensor."
-//
-// Sensing is done as a square within the chessboard and not centered on any
-// square, because smaller windows near the border of the chessboard give
-// less information and such actions will be always dominated by better sensing.
+// >  their sensor. Then, the true state of the game board in a three square by
+// >  three square window centered at the chosen square is revealed to the
+// >  sensing player."
+//
+// Sensing is done as picking a sensing window that fully fits within the
+// chessboard and is not centered on an underlying square. The centering can
+// make the sensing window smaller (as a rectangle near the border of the
+// chessboard) which gives strictly less information than a better placed window
+// (that remains a full square). This modification eliminates strategically
+// useless sensing actions.
 //
 // > "If the move was modified [..] then the modified move is made, and
 // >  the current player is notified of the modified move in the move results."


fix critical bug where I was hiding a lot more class members than i should. Add "CAN_NOT_SUPPORTED" guard to header instead of example

--- drivers/CAN.h
+++ drivers/CAN.h
@@ -94,7 +94,6 @@
      * @code
      * #include "mbed.h"
      *
-     * #if defined (DEVICE_CAN) || defined(DOXYGEN_ONLY)
      *
      * Ticker ticker;
      * DigitalOut led1(LED1);
@@ -126,10 +125,6 @@
      *     }
      * }
      *
-     * #else
-     *   #error CAN NOT SUPPORTED
-     *
-     * #endif
      * @endcode
      */
     CAN(PinName rd, PinName td);
@@ -304,12 +299,14 @@
     can_t               _can;
     Callback<void()>    _irq[IrqCnt];
     PlatformMutex       _mutex;
+#endif
 };
+
+} // namespace mbed
+
+#else
+    #error CAN NOT SUPPORTED
 #endif

-} // namespace mbed
-
-#endif
-
 #endif    // MBED_CAN_H


Added PLD_tek4010f and PLD_tek4107f to the #if at the top, since these
are now separate devices (for consistency with the configure code).  Took
out the internal #ifdefs over the init functions, as sometimes there's
crosstalk and otherwise we'd have to build in device dependencies here.
Reverted to previous way these were structured in the process.

svn path=/trunk/; revision=3500

--- drivers/tek.c
+++ drivers/tek.c
@@ -6,7 +6,9 @@

 #if defined(PLD_xterm) ||		/* xterm */ \
     defined(PLD_tek4010) ||		/* TEK 4010 */ \
+    defined(PLD_tek4010f) ||		/* ditto, file */ \
     defined(PLD_tek4107) ||		/* TEK 4107 */ \
+    defined(PLD_tek4107f) ||		/* ditto, file */ \
     defined(PLD_mskermit) ||		/* MS-kermit emulator */ \
     defined(PLD_versaterm) ||		/* Versaterm emulator */ \
     defined(PLD_vlt) ||			/* VLT emulator */ \
@@ -18,6 +20,19 @@
 #include "plplot/plevent.h"

 #include <ctype.h>
+
+/* Prototype the driver entry points that will be used to initialize the
+   dispatch table entries. */
+
+void plD_init_xterm		(PLStream *);
+void plD_init_tekt		(PLStream *);
+void plD_init_tekf		(PLStream *);
+void plD_init_tek4107t		(PLStream *);
+void plD_init_tek4107f		(PLStream *);
+void plD_init_mskermit		(PLStream *);
+void plD_init_versaterm		(PLStream *);
+void plD_init_vlt		(PLStream *);
+void plD_init_conex		(PLStream *);

 /* External generic entry points */

@@ -129,10 +144,79 @@
     pdt->pl_esc      = (plD_esc_fp)      plD_esc_tek;
 }

-/*--------------------------------------------------------------------------*\
- * Driver entry points that will be used to initialize the dispatch table
- * entries:
- *
+void plD_dispatch_init_xterm	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "Xterm Window", "xterm",
+                              plDevType_Interactive, 18,
+                              (plD_init_fp) plD_init_xterm );
+}
+
+void plD_dispatch_init_tekt	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "Tektronix Terminal (4010)", "tekt",
+                              plDevType_Interactive, 19,
+                              (plD_init_fp) plD_init_tekt );
+}
+
+void plD_dispatch_init_tek4107t	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "Tektronix Terminal (4105/4107)", "tek4107t",
+                              plDevType_Interactive, 20,
+                              (plD_init_fp) plD_init_tek4107t );
+}
+
+void plD_dispatch_init_mskermit	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "MS-Kermit emulator", "mskermit",
+                              plDevType_Interactive, 21,
+                              (plD_init_fp) plD_init_mskermit );
+}
+
+void plD_dispatch_init_versaterm( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "Versaterm vt100/tek emulator", "versaterm",
+                              plDevType_Interactive, 22,
+                              (plD_init_fp) plD_init_versaterm );
+}
+
+void plD_dispatch_init_vlt	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "VLT vt100/tek emulator", "vlt",
+                              plDevType_Interactive, 23,
+                              (plD_init_fp) plD_init_vlt );
+}
+
+void plD_dispatch_init_conex	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "Conex vt320/tek emulator", "conex",
+                              plDevType_Interactive, 24,
+                              (plD_init_fp) plD_init_conex );
+}
+
+void plD_dispatch_init_tekf	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "Tektronix File (4010)", "tekf",
+                              plDevType_FileOriented, 27,
+                              (plD_init_fp) plD_init_tekf );
+}
+
+void plD_dispatch_init_tek4107f	( PLDispatchTable *pdt )
+{
+    tek_dispatch_init_helper( pdt,
+                              "Tektronix File (4105/4107)", "tek4107f",
+                              plDevType_FileOriented, 28,
+                              (plD_init_fp) plD_init_tek4107f );
+}
+
+/*--------------------------------------------------------------------------*\
  * plD_init_xterm()	xterm
  * plD_init_tekt()	Tek 4010 terminal
  * plD_init_tekf()	Tek 4010 file
@@ -152,17 +236,6 @@
  * pls->dev_fill1	if can handle pattern area fill
 \*--------------------------------------------------------------------------*/

-#ifdef PLD_xterm
-void plD_init_xterm		(PLStream *);
-
-void plD_dispatch_init_xterm	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "Xterm Window", "xterm",
-                              plDevType_Interactive, 18,
-                              (plD_init_fp) plD_init_xterm );
-}
-
 void
 plD_init_xterm(PLStream *pls)
 {
@@ -170,21 +243,6 @@
     pls->termin = 1;
     tek_init(pls);
 }
-#endif	/* xterm */
-
-/*--------------------------------------------------------------------------*/
-
-#if defined (PLD_tek4010)
-void plD_init_tekt		(PLStream *);
-void plD_init_tekf		(PLStream *);
-
-void plD_dispatch_init_tekt	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "Tektronix Terminal (4010)", "tekt",
-                              plDevType_Interactive, 19,
-                              (plD_init_fp) plD_init_tekt );
-}

 void
 plD_init_tekt(PLStream *pls)
@@ -193,42 +251,11 @@
     plD_init_tekf(pls);
 }

-void plD_dispatch_init_tekf	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "Tektronix File (4010)", "tekf",
-                              plDevType_FileOriented, 27,
-                              (plD_init_fp) plD_init_tekf );
-}
-
 void
 plD_init_tekf(PLStream *pls)
 {
     pls->dev_minor = tek4010;
     tek_init(pls);
-}
-#endif	/* PLD_tek4010 (term & file) */
-
-/*--------------------------------------------------------------------------*/
-
-#if defined (PLD_tek4107)
-void plD_init_tek4107t		(PLStream *);
-void plD_init_tek4107f		(PLStream *);
-
-void plD_dispatch_init_tek4107t	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "Tektronix Terminal (4105/4107)", "tek4107t",
-                              plDevType_Interactive, 20,
-                              (plD_init_fp) plD_init_tek4107t );
-}
-
-void plD_dispatch_init_tek4107f	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "Tektronix File (4105/4107)", "tek4107f",
-                              plDevType_FileOriented, 28,
-                              (plD_init_fp) plD_init_tek4107f );
 }

 void
@@ -245,20 +272,6 @@
     pls->color = 1;
     pls->dev_fill0 = 1;
     tek_init(pls);
-}
-#endif	/* PLD_tek4107 (term & file) */
-
-/*--------------------------------------------------------------------------*/
-
-#ifdef PLD_mskermit
-void plD_init_mskermit		(PLStream *);
-
-void plD_dispatch_init_mskermit	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "MS-Kermit emulator", "mskermit",
-                              plDevType_Interactive, 21,
-                              (plD_init_fp) plD_init_mskermit );
 }

 void
@@ -270,20 +283,6 @@
     pls->dev_fill0 = 1;
     tek_init(pls);
 }
-#endif	/* PLD_mskermit */
-
-/*--------------------------------------------------------------------------*/
-
-#ifdef PLD_vlt
-void plD_init_vlt		(PLStream *);
-
-void plD_dispatch_init_vlt	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "VLT vt100/tek emulator", "vlt",
-                              plDevType_Interactive, 23,
-                              (plD_init_fp) plD_init_vlt );
-}

 void
 plD_init_vlt(PLStream *pls)
@@ -294,20 +293,6 @@
     pls->dev_fill0 = 1;
     tek_init(pls);
 }
-#endif	/* PLD_vlt */
-
-/*--------------------------------------------------------------------------*/
-
-#ifdef PLD_versaterm
-void plD_init_versaterm		(PLStream *);
-
-void plD_dispatch_init_versaterm( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "Versaterm vt100/tek emulator", "versaterm",
-                              plDevType_Interactive, 22,
-                              (plD_init_fp) plD_init_versaterm );
-}

 void
 plD_init_versaterm(PLStream *pls)
@@ -318,20 +303,6 @@
     pls->dev_fill0 = 1;
     tek_init(pls);
 }
-#endif	/* PLD_versaterm */
-
-/*--------------------------------------------------------------------------*/
-
-#ifdef PLD_conex
-void plD_init_conex		(PLStream *);
-
-void plD_dispatch_init_conex	( PLDispatchTable *pdt )
-{
-    tek_dispatch_init_helper( pdt,
-                              "Conex vt320/tek emulator", "conex",
-                              plDevType_Interactive, 24,
-                              (plD_init_fp) plD_init_conex );
-}

 void
 plD_init_conex(PLStream *pls)
@@ -341,7 +312,6 @@
     pls->color = 2;			/* only fixed colours */
     tek_init(pls);
 }
-#endif	/* PLD_conex */

 /*--------------------------------------------------------------------------*\
  * tek_init()


gioenums.h: Remove a trailing comma.

gioenums.h: Remove a trailing comma.

--- gio/gioenums.h
+++ gio/gioenums.h
@@ -589,7 +589,7 @@
   G_IO_STREAM_SPLICE_NONE          = 0,
   G_IO_STREAM_SPLICE_CLOSE_STREAM1 = (1 << 0),
   G_IO_STREAM_SPLICE_CLOSE_STREAM2 = (1 << 1),
-  G_IO_STREAM_SPLICE_WAIT_FOR_BOTH = (1 << 2),
+  G_IO_STREAM_SPLICE_WAIT_FOR_BOTH = (1 << 2)
 } GIOStreamSpliceFlags;

 /**


sample: subys: logging: fix for posix arch

In the POSIX arch, time does not pass inside infinite loops.
=> Add a small delay in each iteration of those loops
when compiled for it.

Signed-off-by: Alberto Escolar Piedras <52be3174920ed06cbdfbcf9622a1a6c68e942617@oticon.com>

--- samples/subsys/logging/logger/src/main.c
+++ samples/subsys/logging/logger/src/main.c
@@ -171,6 +171,9 @@
 	start_timestamp = timestamp_get();

 	while (start_timestamp == timestamp_get()) {
+#if (CONFIG_ARCH_POSIX)
+		k_busy_wait(100);
+#endif
 	}

 	start_timestamp = timestamp_get();
@@ -179,6 +182,9 @@
 		LOG_INF("performance test - log message %d", cnt);
 		cnt++;
 		current_timestamp = timestamp_get();
+#if (CONFIG_ARCH_POSIX)
+		k_busy_wait(100);
+#endif
 	} while (current_timestamp < (start_timestamp + window));

 	per_sec = (cnt * timestamp_freq()) / window;


mfxpostproc: fixes indirectly memory leak issue in ensure_allowed_srcpad_caps.

Fixes #15

Signed-off-by: Lim Siew Hoon <e412356d7e67dbdde94e841e5d46937fb9f4e623@intel.com>

--- gst/mfx/gstmfxpostproc.c
+++ gst/mfx/gstmfxpostproc.c
@@ -731,7 +731,7 @@

   /* Create initial caps from pad template */
   vpp->allowed_srcpad_caps =
-      gst_caps_from_string (gst_mfxpostproc_src_caps_str);
+      gst_static_pad_template_get_caps (&gst_mfxpostproc_src_factory);
   if (!vpp->allowed_srcpad_caps) {
     GST_ERROR_OBJECT (vpp, "failed to create MFX src caps");
     return FALSE;


qtmux: truncate buffer file after each send

--- gst/quicktime/gstqtmux.c
+++ gst/quicktime/gstqtmux.c
@@ -1063,6 +1063,22 @@
   }
 }

+static gboolean
+gst_qt_mux_seek_to_beginning (FILE * f)
+{
+#ifdef HAVE_FSEEKO
+  if (fseeko (f, (off_t) 0, SEEK_SET) != 0)
+    return FALSE;
+#elif defined (G_OS_UNIX) || defined (G_OS_WIN32)
+  if (lseek (fileno (f), (off_t) 0, SEEK_SET) == (off_t) - 1)
+    return FALSE;
+#else
+  if (fseek (f, (long) 0, SEEK_SET) != 0)
+    return FALSE;
+#endif
+  return TRUE;
+}
+
 static GstFlowReturn
 gst_qt_mux_send_buffered_data (GstQTMux * qtmux, guint64 * offset)
 {
@@ -1072,17 +1088,8 @@
   if (fflush (qtmux->fast_start_file))
     goto flush_failed;

-#ifdef HAVE_FSEEKO
-  if (fseeko (qtmux->fast_start_file, (off_t) 0, SEEK_SET) != 0)
+  if (!gst_qt_mux_seek_to_beginning (qtmux->fast_start_file))
     goto seek_failed;
-#elif defined (G_OS_UNIX) || defined (G_OS_WIN32)
-  if (lseek (fileno (qtmux->fast_start_file), (off_t) 0,
-          SEEK_SET) == (off_t) - 1)
-    goto seek_failed;
-#else
-  if (fseek (qtmux->fast_start_file, (long) 0, SEEK_SET) != 0)
-    goto seek_failed;
-#endif

   /* hm, this could all take a really really long time,
    * but there may not be another way to get moov atom first
@@ -1104,6 +1111,11 @@
   }
   if (buf)
     gst_buffer_unref (buf);
+
+  if (ftruncate (fileno (qtmux->fast_start_file), 0))
+    goto seek_failed;
+  if (!gst_qt_mux_seek_to_beginning (qtmux->fast_start_file))
+    goto seek_failed;

   return ret;


vaapisink: demote a debug message to trace

Reduces noise when debugging.

--- gst/vaapi/gstvaapisink.c
+++ gst/vaapi/gstvaapisink.c
@@ -1409,7 +1409,7 @@
   gst_vaapisink_ensure_colorbalance (sink);
   gst_vaapisink_ensure_rotation (sink, TRUE);

-  GST_DEBUG ("render surface %" GST_VAAPI_ID_FORMAT,
+  GST_TRACE_OBJECT (sink, "render surface %" GST_VAAPI_ID_FORMAT,
       GST_VAAPI_ID_ARGS (gst_vaapi_surface_get_id (surface)));

   if (!surface_rect)


treemodelfilter: add additional asserts to MODEL_FILTER_DEBUG mode

--- gtk/gtktreemodelfilter.c
+++ gtk/gtktreemodelfilter.c
@@ -1007,6 +1007,11 @@
         filter->priv->zero_ref_count--;
     }

+#ifdef MODEL_FILTER_DEBUG
+  if (filter_level == filter->priv->root)
+    g_assert (filter->priv->zero_ref_count == 0);
+#endif
+
   if (filter_level->parent_elt)
     {
       /* Release reference on parent */
@@ -3493,6 +3498,8 @@

 #ifdef MODEL_FILTER_DEBUG
           g_assert (filter->priv->zero_ref_count >= 0);
+          if (filter->priv->zero_ref_count > 0)
+            g_assert (filter->priv->root != NULL);
 #endif
         }
     }
@@ -3569,6 +3576,8 @@

 #ifdef MODEL_FILTER_DEBUG
           g_assert (filter->priv->zero_ref_count >= 0);
+          if (filter->priv->zero_ref_count > 0)
+            g_assert (filter->priv->root != NULL);
 #endif
         }
     }


treemodelfilter: Make the constructor binding friendly

This means reffing the root in the set property implementation,
rather than in the constructor. We don't need to unref the root
on set, as it's a CONSTRUCT_ONLY property.

https://bugzilla.gnome.org/show_bug.cgi?id=680065

--- gtk/gtktreemodelfilter.c
+++ gtk/gtktreemodelfilter.c
@@ -3758,10 +3758,14 @@
 {
   g_return_if_fail (GTK_IS_TREE_MODEL_FILTER (filter));

-  if (!root)
+  if (root)
+    {
+      filter->priv->virtual_root = gtk_tree_path_copy (root);
+      gtk_tree_model_filter_ref_path (filter, filter->priv->virtual_root);
+      filter->priv->virtual_root_deleted = FALSE;
+    }
+  else
     filter->priv->virtual_root = NULL;
-  else
-    filter->priv->virtual_root = gtk_tree_path_copy (root);
 }

 /* public API */
@@ -3782,24 +3786,12 @@
 gtk_tree_model_filter_new (GtkTreeModel *child_model,
                            GtkTreePath  *root)
 {
-  GtkTreeModel *retval;
-  GtkTreeModelFilter *filter;
-
   g_return_val_if_fail (GTK_IS_TREE_MODEL (child_model), NULL);

-  retval = g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
-			 "child-model", child_model,
-			 "virtual-root", root,
-			 NULL);
-
-  filter = GTK_TREE_MODEL_FILTER (retval);
-  if (filter->priv->virtual_root)
-    {
-      gtk_tree_model_filter_ref_path (filter, filter->priv->virtual_root);
-      filter->priv->virtual_root_deleted = FALSE;
-    }
-
-  return retval;
+  return g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
+                       "child-model", child_model,
+                       "virtual-root", root,
+                       NULL);
 }

 /**


Better stronger faster endianess conversion for encoders

--- src/cbor/internal/encoders.c
+++ src/cbor/internal/encoders.c
@@ -6,6 +6,13 @@
  */

 #include "encoders.h"
+
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#else
+// Props to http://esr.ibiblio.org/?p=5095
+#define IS_BIG_ENDIAN (*(uint16_t *)"\0\xff" < 0x100)
+#endif

 size_t _cbor_encode_uint8(uint8_t value, unsigned char *buffer, size_t buffer_size, uint8_t offset)
 {
@@ -29,11 +36,15 @@
 	if (buffer_size >= 3) {
 		buffer[0] = 0x19 + offset;

-#if defined(__clang__) || defined(__GNUC__)
-		*(uint16_t *) &buffer[1] = __builtin_bswap16(value);
+#ifdef HAVE_ENDIAN_H
+	*(uint16_t *) &buffer[1] = htobe16(value);
 #else
+	#ifdef IS_BIG_ENDIAN
+		*(uint16_t *) &buffer[1] = value;
+	#else
 		buffer[1] = value >> 8;
 		buffer[2] = value;
+	#endif
 #endif

 		return 3;
@@ -46,13 +57,17 @@
 	if (buffer_size >= 5) {
 		buffer[0] = 0x1A + offset;

-#if defined(__clang__) || defined(__GNUC__)
-		*(uint32_t *) &buffer[1] = __builtin_bswap32(value);
+#ifdef HAVE_ENDIAN_H
+		*(uint32_t *) &buffer[1] = htobe32(value);
 #else
+	#ifdef IS_BIG_ENDIAN
+		*(uint32_t *) &buffer[1] = value;
+	#else
 		buffer[1] = value >> 24;
 		buffer[2] = value >> 16;
 		buffer[3] = value >> 8;
 		buffer[4] = value;
+	#endif
 #endif

 		return 5;
@@ -65,9 +80,12 @@
 	if (buffer_size >= 9) {
 		buffer[0] = 0x1B + offset;

-#if defined(__clang__) || defined(__GNUC__)
-		*(uint64_t *) &buffer[1] = __builtin_bswap64(value);
+#ifdef HAVE_ENDIAN_H
+		*(uint64_t *) &buffer[1] = htobe64(value);
 #else
+	#ifdef IS_BIG_ENDIAN
+		*(uint64_t *) &buffer[1] = value;
+	#else
 		buffer[1] = value >> 56;
 		buffer[2] = value >> 48;
 		buffer[3] = value >> 40;
@@ -76,6 +94,7 @@
 		buffer[6] = value >> 16;
 		buffer[7] = value >> 8;
 		buffer[8] = value;
+	#endif
 #endif

 		return 9;


Improve the alignment test for the 'StaticMatrix' class template

--- blazetest/blazetest/mathtest/staticmatrix/ClassTest.h
+++ blazetest/blazetest/mathtest/staticmatrix/ClassTest.h
@@ -48,6 +48,7 @@
 #include <blaze/math/constraints/DenseMatrix.h>
 #include <blaze/math/StaticMatrix.h>
 #include <blaze/math/typetraits/IsRowMajorMatrix.h>
+#include <blaze/util/AlignedAllocator.h>
 #include <blaze/util/constraints/SameType.h>
 #include <blaze/util/typetraits/AlignmentOf.h>
 #include <blazetest/system/Types.h>
@@ -188,6 +189,9 @@
    typedef blaze::StaticMatrix<Type,7UL,5UL,blaze::rowMajor>     RowMajorMatrixType;
    typedef blaze::StaticMatrix<Type,7UL,5UL,blaze::columnMajor>  ColumnMajorMatrixType;

+   typedef blaze::AlignedAllocator<RowMajorMatrixType>     RowMajorAllocatorType;
+   typedef blaze::AlignedAllocator<ColumnMajorMatrixType>  ColumnMajorAllocatorType;
+
    const size_t alignment( blaze::AlignmentOf<Type>::value );

@@ -251,7 +255,7 @@
             if( deviation != 0UL ) {
                std::ostringstream oss;
                oss << " Test: Static array alignment test (row-major)\n"
-                   << " Error: Invalid alignment in row " << j << " detected\n"
+                   << " Error: Invalid alignment at index " << i << " in row " << j << " detected\n"
                    << " Details:\n"
                    << "   Element type      : " << type << "\n"
                    << "   Expected alignment: " << alignment << "\n"
@@ -273,7 +277,7 @@
             if( deviation != 0UL ) {
                std::ostringstream oss;
                oss << " Test: Static array alignment test (column-major)\n"
-                   << " Error: Invalid alignment in column " << j << " detected\n"
+                   << " Error: Invalid alignment at index " << i << " in column " << j << " detected\n"
                    << " Details:\n"
                    << "   Element type      : " << type << "\n"
                    << "   Expected alignment: " << alignment << "\n"
@@ -290,7 +294,7 @@
    //=====================================================================================

    {
-      const boost::container::vector<RowMajorMatrixType> mats( 7UL );
+      const boost::container::vector<RowMajorMatrixType,RowMajorAllocatorType> mats( 7UL );

       for( size_t i=0UL; i<mats.size(); ++i ) {
          for( size_t j=0UL; j<mats[i].rows(); ++j )
@@ -300,7 +304,7 @@
             if( deviation != 0UL ) {
                std::ostringstream oss;
                oss << " Test: Dynamic array alignment test (row-major)\n"
-                   << " Error: Invalid alignment in row " << j << " detected\n"
+                   << " Error: Invalid alignment at index " << i << " in row " << j << " detected\n"
                    << " Details:\n"
                    << "   Element type      : " << type << "\n"
                    << "   Expected alignment: " << alignment << "\n"
@@ -312,7 +316,7 @@
    }

    {
-      const boost::container::vector<ColumnMajorMatrixType> mats( 7UL );
+      const boost::container::vector<ColumnMajorMatrixType,ColumnMajorAllocatorType> mats( 7UL );

       for( size_t i=0UL; i<mats.size(); ++i ) {
          for( size_t j=0UL; j<mats[i].columns(); ++j )
@@ -322,7 +326,7 @@
             if( deviation != 0UL ) {
                std::ostringstream oss;
                oss << " Test: Dynamic array alignment test (column-major)\n"
-                   << " Error: Invalid alignment in column " << j << " detected\n"
+                   << " Error: Invalid alignment at index " << i << " in column " << j << " detected\n"
                    << " Details:\n"
                    << "   Element type      : " << type << "\n"
                    << "   Expected alignment: " << alignment << "\n"


Missed this file on previous commit.

Missed this file on previous commit.

--- vic/drivers/python/src/display_current_settings.c
+++ vic/drivers/python/src/display_current_settings.c
@@ -70,7 +70,7 @@
     fprintf(LOG_DEST, "MAX_VEG\t\t\t%2d\n", MAX_VEG);
     fprintf(LOG_DEST, "\n");
     fprintf(LOG_DEST, "MINSOILDEPTH\t\t%f\n", MINSOILDEPTH);
-    fprintf(LOG_DEST, "MIN_VEGCOVER\t\t%f\n", MIN_VEGCOVER);
+    fprintf(LOG_DEST, "MIN_FCANOPY\t\t%f\n", MIN_FCANOPY);
     fprintf(LOG_DEST, "\n");
     fprintf(LOG_DEST, "MIN_SUBDAILY_STEPS_PER_DAY %d\n",
             MIN_SUBDAILY_STEPS_PER_DAY);
@@ -330,23 +330,23 @@
     else if (options.LAI_SRC == FROM_VEGLIB) {
         fprintf(LOG_DEST, "LAI_SRC\t\tFROM_VEGLIB\n");
     }
-    if (options.VEGPARAM_VEGCOVER) {
-        fprintf(LOG_DEST, "VEGPARAM_VEGCOVER\t\tTRUE\n");
-    }
-    else {
-        fprintf(LOG_DEST, "VEGPARAM_VEGCOVER\t\tFALSE\n");
-    }
-    if (options.VEGCOVER_SRC == FROM_VEGHIST) {
-        fprintf(LOG_DEST, "VEGCOVER_SRC\t\tFROM_VEGHIST\n");
-    }
-    else if (options.VEGCOVER_SRC == FROM_VEGPARAM) {
-        fprintf(LOG_DEST, "VEGCOVER_SRC\t\tFROM_VEGPARAM\n");
-    }
-    else if (options.VEGCOVER_SRC == FROM_VEGLIB) {
-        fprintf(LOG_DEST, "VEGCOVER_SRC\t\tFROM_VEGLIB\n");
-    }
-    else if (options.VEGCOVER_SRC == FROM_DEFAULT) {
-        fprintf(LOG_DEST, "VEGCOVER_SRC\t\tFROM_DEFAULT\n");
+    if (options.VEGPARAM_FCAN) {
+        fprintf(LOG_DEST, "VEGPARAM_FCAN\t\tTRUE\n");
+    }
+    else {
+        fprintf(LOG_DEST, "VEGPARAM_FCAN\t\tFALSE\n");
+    }
+    if (options.FCAN_SRC == FROM_VEGHIST) {
+        fprintf(LOG_DEST, "FCAN_SRC\t\tFROM_VEGHIST\n");
+    }
+    else if (options.FCAN_SRC == FROM_VEGPARAM) {
+        fprintf(LOG_DEST, "FCAN_SRC\t\tFROM_VEGPARAM\n");
+    }
+    else if (options.FCAN_SRC == FROM_VEGLIB) {
+        fprintf(LOG_DEST, "FCAN_SRC\t\tFROM_VEGLIB\n");
+    }
+    else if (options.FCAN_SRC == FROM_DEFAULT) {
+        fprintf(LOG_DEST, "FCAN_SRC\t\tFROM_DEFAULT\n");
     }
     if (options.VEGPARAM_ALB) {
         fprintf(LOG_DEST, "VEGPARAM_ALB\t\tTRUE\n");


usb-device-manager: fix log messages to match vid:pid change

On Windows clients now USB devices are identified by their vid:pid
(sometimes these values are being held by variables "bus" and "addr")
Change log messages accordingly.

--- gtk/usb-device-manager.c
+++ gtk/usb-device-manager.c
@@ -49,6 +49,12 @@
 #include "usb-device-manager-priv.h"

 #include <glib/gi18n.h>
+
+#ifndef G_OS_WIN32 /* Linux -- device id is bus.addr */
+#define DEV_ID_FMT "at %d.%d"
+#else /* Windows -- device id is vid:pid */
+#define DEV_ID_FMT "0x%04x:0x%04x"
+#endif

 /**
  * SECTION:usb-device-manager
@@ -788,7 +794,11 @@

     device = spice_usb_device_manager_find_device(self, bus, address);
     if (device) {
-        SPICE_DEBUG("USB device at %d.%d already exists, ignored", bus, address);
+        SPICE_DEBUG("USB device 0x%04x:0x%04x at %d.%d already exists, ignored",
+                    spice_usb_device_get_vid(device),
+                    spice_usb_device_get_pid(device),
+                    spice_usb_device_get_busnum(device),
+                    spice_usb_device_get_devaddr(device));
         return;
     }

@@ -818,7 +828,7 @@
         libusb_free_device_list(dev_list, 1);

     if (!device) {
-        g_warning("Could not find USB device to add at busnum %d devaddr %d",
+        g_warning("Could not find USB device to add " DEV_ID_FMT,
                   bus, address);
         return;
     }
@@ -854,7 +864,7 @@

     device = spice_usb_device_manager_find_device(self, bus, address);
     if (!device) {
-        g_warning("Could not find USB device to remove at busnum %d devaddr %d",
+        g_warning("Could not find USB device to remove " DEV_ID_FMT,
                   bus, address);
         return;
     }
@@ -863,7 +873,7 @@
     const guint8 state = spice_usb_device_get_state(device);
     if ((state == SPICE_USB_DEVICE_STATE_INSTALLING) ||
         (state == SPICE_USB_DEVICE_STATE_UNINSTALLING)) {
-        SPICE_DEBUG("skipping device at %d.%d. It is un/installing it's driver",
+        SPICE_DEBUG("skipping " DEV_ID_FMT ". It is un/installing its driver",
                     bus, address);
         return;
     }


net: filter: fix length calculation in BPF testsuite

The current probe_filter_length() (the function that calculates the
length of a test BPF filter) behavior is to declare the end of the
filter as soon as it finds {0, *, *, 0}. This is actually a valid
insn ("ld #0"), so any filter with includes "BPF_STMT(BPF_LD | BPF_IMM, 0)"
fails (its length is cut short).

We are changing probe_filter_length() so as to start from the end, and
declare the end of the filter as the first instruction which is not
{0, *, *, 0}. This solution produces a simpler patch than the
alternative of using an explicit end-of-filter mark. It is technically
incorrect if your filter ends up with "ld #0", but that should not
happen anyway.

We also add a new test (LD_IMM_0) that includes ld #0 (does not work
without this patch).

Signed-off-by: Chema Gonzalez <1430170bc4463816eef89a902d9b948629a7b7c9@google.com>
Acked-by: Daniel Borkmann <9ff04a02a69f376b2b9aeec27187017cbf3cf5f9@redhat.com>
Acked-by: Alexei Starovoitov <c24c0248770ae98831f8a654310d4c2e07514c61@plumgrid.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


Comment out libnoise header inclusion

Comment out libnoise header inclusion

Since libnoise is not yet needed in this branch or included in CMakeLists.txt.

--- Wangscape/TilePartitionPerlin.h
+++ Wangscape/TilePartitionPerlin.h
@@ -1,2 +1,2 @@
 #pragma once
-#include <noise/noise.h>+//#include <noise/noise.h>


fix pointers to data and sock_thread check

--- projects/sdr_transceiver/server/sdr-transceiver.c
+++ projects/sdr_transceiver/server/sdr-transceiver.c
@@ -14,9 +14,9 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>

-uint32_t *rx_freq, *rx_rate, *rx_data;
-uint32_t *tx_freq, *tx_rate, *tx_data;
+uint32_t *rx_freq, *rx_rate, *tx_freq, *tx_rate;
 uint16_t *gpio, *rx_cntr, *tx_cntr;
+void *rx_data, *tx_data;

 int sock_thread[4] = {-1, -1, -1, -1};

@@ -132,7 +132,7 @@
     }

     result = recv(sock_client, (char *)&command, 4, MSG_WAITALL);
-    if(result <= 0 || command > 3 || sock_thread[command] < 0)
+    if(result <= 0 || command > 3 || sock_thread[command] > -1)
     {
       close(sock_client);
       continue;


JSON body needs to be framed for update an account API

--- src/account_management.c
+++ src/account_management.c
@@ -100,7 +100,7 @@
     struct curl_slist *headers = NULL;
     char *url;
     char body[BODY_SIZE_MIN];
-
+    // TODO: json object needs to be sent for updation
     if(prepareUrl(&url, configurations.base_url, configurations.update_an_account_name, NULL)) {

         appendHttpHeader(&headers, HEADER_CONTENT_TYPE_NAME, HEADER_CONTENT_TYPE_JSON);


driver/retimer: Avoid converting between enum types

When building with clang, it warns:

board/morphius/board.c:337:18: error: implicit conversion from
enumeration type 'enum ioex_signal' to different enumeration type 'enum
gpio_signal' [-Werror,-Wenum-conversion]
                .enable_gpio = IOEX_USB_C0_DATA_EN,

BRANCH=none
BUG=b:172020503
TEST=make buildall -j

Signed-off-by: Tom Hughes <fc5c12f30a5ed2baa0581f44ee14ad1eb7b20d83@chromium.org>
Change-Id: I8d7d9292701732925f7a34daa7d673a61abaebce
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3238251
Reviewed-by: Abe Levkoy <2e1ad7039298f93262cf06bbb457275fb3e2ecb5@chromium.org>

--- driver/retimer/pi3dpx1207.h
+++ driver/retimer/pi3dpx1207.h
@@ -45,7 +45,7 @@
 /* Retimer driver hardware specific controls */
 struct pi3dpx1207_usb_control {
 	/* Retimer enable */
-	const enum gpio_signal enable_gpio;
+	const enum ioex_signal enable_gpio;
 	/* DP Mode enable */
 	const enum gpio_signal dp_enable_gpio;
 };


sata_inic162x: update TF read handling

sata_inic162x: update TF read handling

inic162x can't reliably read back TF or at least we don't know how to
do it yet.  The only values which seem reliable are status and error.
This patch updates access to TF.

* implement inic_tf_read() which reads the TF area in mmio area

* implement custom inic_qc_fill_rtf() which only returns true if
  status indicates device error.  it'll be returning bogus addresses
  for device errors but it'll be able to report why it failed at
  least.

* implement custom inic_check_ready() and use ata_wait_after_reset()
  instead of the SFF version.

* use inic_tf_read() for classification.

This is not perfect but it fixes hotplug detection failure and at
least makes the driver report 0's instead of random garbages while
reporting valid status and error for device errors.

Signed-off-by: Tejun Heo <ccfba69985e72fbcd9ba8bbb6db43d42971ad06d@gmail.com>
Signed-off-by: Jeff Garzik <15f615bf7d20c2937c7eb5aa759110fd6768848c@redhat.com>

--- drivers/ata/sata_inic162x.c
+++ drivers/ata/sata_inic162x.c
@@ -410,6 +410,41 @@
 	return ata_sff_qc_issue(qc);
 }

+static void inic_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
+{
+	void __iomem *port_base = inic_port_base(ap);
+
+	tf->feature	= readb(port_base + PORT_TF_FEATURE);
+	tf->nsect	= readb(port_base + PORT_TF_NSECT);
+	tf->lbal	= readb(port_base + PORT_TF_LBAL);
+	tf->lbam	= readb(port_base + PORT_TF_LBAM);
+	tf->lbah	= readb(port_base + PORT_TF_LBAH);
+	tf->device	= readb(port_base + PORT_TF_DEVICE);
+	tf->command	= readb(port_base + PORT_TF_COMMAND);
+}
+
+static bool inic_qc_fill_rtf(struct ata_queued_cmd *qc)
+{
+	struct ata_taskfile *rtf = &qc->result_tf;
+	struct ata_taskfile tf;
+
+	/* FIXME: Except for status and error, result TF access
+	 * doesn't work.  I tried reading from BAR0/2, CPB and BAR5.
+	 * None works regardless of which command interface is used.
+	 * For now return true iff status indicates device error.
+	 * This means that we're reporting bogus sector for RW
+	 * failures.  Eeekk....
+	 */
+	inic_tf_read(qc->ap, &tf);
+
+	if (!(tf.command & ATA_ERR))
+		return false;
+
+	rtf->command = tf.command;
+	rtf->feature = tf.feature;
+	return true;
+}
+
 static void inic_freeze(struct ata_port *ap)
 {
 	void __iomem *port_base = inic_port_base(ap);
@@ -428,6 +463,13 @@
 	writeb(0xff, port_base + PORT_IRQ_STAT);

 	__inic_set_pirq_mask(ap, PIRQ_MASK_OTHER);
+}
+
+static int inic_check_ready(struct ata_link *link)
+{
+	void __iomem *port_base = inic_port_base(link->ap);
+
+	return ata_check_ready(readb(port_base + PORT_TF_COMMAND));
 }

 /*
@@ -465,7 +507,7 @@
 		struct ata_taskfile tf;

 		/* wait for link to become ready */
-		rc = ata_sff_wait_after_reset(link, 1, deadline);
+		rc = ata_wait_after_reset(link, deadline, inic_check_ready);
 		/* link occupied, -ENODEV too is an error */
 		if (rc) {
 			ata_link_printk(link, KERN_WARNING, "device not ready "
@@ -473,7 +515,7 @@
 			return rc;
 		}

-		ata_sff_tf_read(ap, &tf);
+		inic_tf_read(ap, &tf);
 		*class = ata_dev_classify(&tf);
 	}

@@ -569,6 +611,7 @@
 	.bmdma_stop		= inic_bmdma_stop,
 	.bmdma_status		= inic_bmdma_status,
 	.qc_issue		= inic_qc_issue,
+	.qc_fill_rtf		= inic_qc_fill_rtf,

 	.freeze			= inic_freeze,
 	.thaw			= inic_thaw,


Refactored search test to check for expected nodes

--- test/search.c
+++ test/search.c
@@ -29,9 +29,20 @@

 #include "test.h"
 #include "test-common.h"
+#include "memory-pool.h"
 #include "string-table.h"
 #include "safe-wrappers.h"
 #include "error-handling.h"
+
+/** Stores informations about a found path. */
+typedef struct
+{
+  /** The policy of the path. */
+  BackupPolicy policy;
+
+  /** The node which matched the path, or NULL. */
+  SearchNode *node;
+}FoundPathInfo;

 /** Performs some checks on the given SearchResult.

@@ -125,29 +136,35 @@
   return strCopy(str(&string.str[cwd.length + 1]));
 }

-/** Checks all nodes in the given search tree to be correctly set and
+/** Asserts that all nodes in the given search tree got correctly set and
   updated by the search.

-  @param root_node The search tree which should be checked.
+  @param root_node The search tree to check.
   @param cwd_depth The recursion depth of the current working directory.

-  @return The parent node of the first directory inside the cwd, or NULL if
-  the check failed.
+  @return The parent node of the first directory inside the cwd.
 */
 static SearchNode *checkCwdTree(SearchNode *root_node, size_t cwd_depth)
 {
   if(root_node->subnodes == NULL)
   {
-    return NULL;
+    die("root node doesn't have subnodes");
   }

   SearchNode *node = root_node->subnodes;
   for(size_t counter = 0; counter < cwd_depth; counter++)
   {
-    if(node->subnodes == NULL || node->subnodes->next != NULL ||
-       node->search_match != SRT_directory)
-    {
-      return NULL;
+    if(node->subnodes == NULL)
+    {
+      die("node doesn't have subnodes: \"%s\"", node->name.str);
+    }
+    else if(node->subnodes->next != NULL)
+    {
+      die("node has too many subnodes: \"%s\"", node->name.str);
+    }
+    else if(node->search_match != SRT_directory)
+    {
+      die("node has not matched a directory: \"%s\"", node->name.str);
     }

     node = node->subnodes;
@@ -216,28 +233,41 @@
       file_count += (result.type == SRT_regular ||
                      result.type == SRT_symlink);
       recursion_depth += result.type == SRT_directory;
-      strtableMap(table, relative_path,
-                  (void *)((size_t)result.policy + 1));
+
+      FoundPathInfo *info = mpAlloc(sizeof *info);
+      info->policy = result.policy;
+      info->node = result.node;
+      strtableMap(table, relative_path, info);
     }
   }

   return file_count;
 }

-/** Asserts that the given table contains a mapping of the given path to
-  the given policy plus 1. */
-static void checkHasPolicy(StringTable *table, const char *path,
-                           BackupPolicy policy)
-{
-  void *address = strtableGet(table, str(path));
-
-  if(address == NULL)
-  {
-    die("\"%s\" with policy %i does not exist in the given table",
-        path, policy);
-  }
-
-  assert_true(address == (void *)((size_t)policy + 1));
+/** Asserts that the given path was found with the specified properties.
+
+  @param table The table containing found paths.
+  @param path The path which should be checked.
+  @param policy The policy of the found path.
+  @param node The node trough which the path was found, or NULL.
+*/
+static void checkFoundPath(StringTable *table, const char *path,
+                           BackupPolicy policy, SearchNode *node)
+{
+  FoundPathInfo *info = strtableGet(table, str(path));
+
+  if(info == NULL)
+  {
+    die("path was not found during search: \"%s\"", path);
+  }
+  else if(info->policy != policy)
+  {
+    die("path was found with the wrong policy: \"%s\"", path);
+  }
+  else if(info->node != node)
+  {
+    die("path was found trough the wrong node: \"%s\"", path);
+  }
 }

 /** Asserts that various test data directories where ignored properly.
@@ -264,9 +294,9 @@

   @return The node with the given properties.
 */
-static SearchNode *checkSubnode(SearchNode *parent_node,
-                                const char *name_str,
-                                SearchResultType search_match)
+static SearchNode *findSubnode(SearchNode *parent_node,
+                               const char *name_str,
+                               SearchResultType search_match)
 {
   String name = str(name_str);
   for(SearchNode *node = parent_node->subnodes;
@@ -314,74 +344,73 @@
   assert_true(context != NULL);

   size_t cwd_depth = skipCwd(context, cwd, root);
-  StringTable *found_files = strtableNew();
-  assert_true(populateDirectoryTable(context, found_files, cwd) == 29);
+  StringTable *paths = strtableNew();
+  assert_true(populateDirectoryTable(context, paths, cwd) == 29);
   finishSearch(context, cwd_depth);

-  checkHasPolicy(found_files, "empty.txt",   BPOL_track);
-  checkHasPolicy(found_files, "example.txt", BPOL_track);
-  checkHasPolicy(found_files, "symlink.txt", BPOL_mirror);
-  checkHasIgnoredProperly(found_files);
-
-  assert_true(strtableGet(found_files, str("non-existing-directory")) == NULL);
-  assert_true(strtableGet(found_files, str("test directory/non-existing-file.txt")) == NULL);
-  assert_true(strtableGet(found_files, str("test directory/non-existing-regex")) == NULL);
-
-  checkHasPolicy(found_files, "test directory",                            BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.empty",                     BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden",                    BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden",            BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-A.txt", BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-B.txt", BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-C.txt", BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/test file.☢",        BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/❤❤❤.txt",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden 1",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden 2",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden 3",                  BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden symlink",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/bar-a.txt",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/bar-b.txt",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/empty-directory",            BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1",                      BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1/bar",                  BPOL_track);
-  checkHasPolicy(found_files, "test directory/foo 1/bar/1.txt",            BPOL_track);
-  checkHasPolicy(found_files, "test directory/foo 1/bar/2.txt",            BPOL_track);
-  checkHasPolicy(found_files, "test directory/foo 1/bar/3.txt",            BPOL_track);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-a.txt",      BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-b.txt",      BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-c.txt",      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1/♞.☂",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foobar a1.txt",              BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foobar a2.txt",              BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foobar b1.txt",              BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foobar b2.txt",              BPOL_copy);
-  checkHasPolicy(found_files, "test directory/symlink",                    BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/φ.txt",                      BPOL_copy);
-  checkHasPolicy(found_files, "test directory/€.txt",                      BPOL_copy);
-  strtableFree(found_files);
-
-  SearchNode *node = checkCwdTree(root, cwd_depth);
-  assert_true(node != NULL);
-
-  checkSubnode(node, "non-existing-directory", SRT_none);
-  checkSubnode(node, "^e.*\\.txt$", SRT_regular);
-  checkSubnode(node, "symlink.txt", SRT_symlink);
-
-  SearchNode *test_dir = checkSubnode(node, "test directory", SRT_directory);
-  checkSubnode(test_dir, "non-existing-file.txt", SRT_none);
-  checkSubnode(test_dir, "^non-existing-regex$",  SRT_none);
-  checkSubnode(test_dir, ".empty",                SRT_directory);
-  checkSubnode(test_dir, " 3$",                   SRT_regular);
-  checkSubnode(test_dir, "symlink",               SRT_symlink);
-
-  SearchNode *hidden = checkSubnode(test_dir, ".hidden", SRT_directory);
-  checkSubnode(hidden, ".hidden", SRT_directory);
-  checkSubnode(hidden, "\\.txt$", SRT_regular);
-
-  SearchNode *foo_1 = checkSubnode(test_dir, "foo 1", SRT_directory);
-  checkSubnode(foo_1, "bar",             SRT_directory);
-  checkSubnode(foo_1, "test-file-c.txt", SRT_regular);
+  /* Check nodes in search tree. */
+  SearchNode *n_cwd         = checkCwdTree(root, cwd_depth);
+  SearchNode *n_e_txt       = findSubnode(n_cwd, "^e.*\\.txt$", SRT_regular);
+  SearchNode *n_symlink_txt = findSubnode(n_cwd, "symlink.txt", SRT_symlink);
+  findSubnode(n_cwd, "non-existing-directory", SRT_none);
+
+  SearchNode *n_test_dir  = findSubnode(n_cwd,      "test directory",        SRT_directory);
+  SearchNode *n_empty     = findSubnode(n_test_dir, ".empty",                SRT_directory);
+  SearchNode *n_3         = findSubnode(n_test_dir, " 3$",                   SRT_regular);
+  SearchNode *n_symlink   = findSubnode(n_test_dir, "symlink",               SRT_symlink);
+  findSubnode(n_test_dir, "non-existing-file.txt", SRT_none);
+  findSubnode(n_test_dir, "^non-existing-regex$",  SRT_none);
+
+  SearchNode *n_hidden        = findSubnode(n_test_dir, ".hidden", SRT_directory);
+  SearchNode *n_hidden_hidden = findSubnode(n_hidden,   ".hidden", SRT_directory);
+  SearchNode *n_txt           = findSubnode(n_hidden,   "\\.txt$", SRT_regular);
+
+  SearchNode *n_foo_1       = findSubnode(n_test_dir, "foo 1",           SRT_directory);
+  SearchNode *n_bar         = findSubnode(n_foo_1,    "bar",             SRT_directory);
+  SearchNode *n_test_file_c = findSubnode(n_foo_1,    "test-file-c.txt", SRT_regular);
+
+  /* Check found paths. */
+  checkHasIgnoredProperly(paths);
+  assert_true(strtableGet(paths, str("non-existing-directory"))               == NULL);
+  assert_true(strtableGet(paths, str("test directory/non-existing-file.txt")) == NULL);
+  assert_true(strtableGet(paths, str("test directory/non-existing-regex"))    == NULL);
+
+  checkFoundPath(paths, "empty.txt",                                 BPOL_track,  n_e_txt);
+  checkFoundPath(paths, "example.txt",                               BPOL_track,  n_e_txt);
+  checkFoundPath(paths, "symlink.txt",                               BPOL_mirror, n_symlink_txt);
+  checkFoundPath(paths, "test directory",                            BPOL_copy,   n_test_dir);
+  checkFoundPath(paths, "test directory/.empty",                     BPOL_mirror, n_empty);
+  checkFoundPath(paths, "test directory/.hidden",                    BPOL_copy,   n_hidden);
+  checkFoundPath(paths, "test directory/.hidden/.hidden",            BPOL_track,  n_hidden_hidden);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-A.txt", BPOL_track,  NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-B.txt", BPOL_track,  NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-C.txt", BPOL_track,  NULL);
+  checkFoundPath(paths, "test directory/.hidden/test file.☢",        BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden/❤❤❤.txt",            BPOL_mirror, n_txt);
+  checkFoundPath(paths, "test directory/.hidden 1",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden 2",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden 3",                  BPOL_track,  n_3);
+  checkFoundPath(paths, "test directory/.hidden symlink",            BPOL_mirror, n_symlink);
+  checkFoundPath(paths, "test directory/bar-a.txt",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/bar-b.txt",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/empty-directory",            BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foo 1",                      BPOL_copy,   n_foo_1);
+  checkFoundPath(paths, "test directory/foo 1/bar",                  BPOL_track,  n_bar);
+  checkFoundPath(paths, "test directory/foo 1/bar/1.txt",            BPOL_track,  NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar/2.txt",            BPOL_track,  NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar/3.txt",            BPOL_track,  NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-a.txt",      BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-b.txt",      BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-c.txt",      BPOL_mirror, n_test_file_c);
+  checkFoundPath(paths, "test directory/foo 1/♞.☂",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foobar a1.txt",              BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foobar a2.txt",              BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foobar b1.txt",              BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foobar b2.txt",              BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/symlink",                    BPOL_mirror, n_symlink);
+  checkFoundPath(paths, "test directory/φ.txt",                      BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/€.txt",                      BPOL_copy,   NULL);
+  strtableFree(paths);
 }

 /** Tests a search by using the generated config "ignore-expressions.txt".
@@ -395,10 +424,58 @@
   assert_true(context != NULL);

   size_t cwd_depth = skipCwd(context, cwd, root);
-  StringTable *found_files = strtableNew();
-  assert_true(populateDirectoryTable(context, found_files, cwd) == 19);
+  StringTable *paths = strtableNew();
+  assert_true(populateDirectoryTable(context, paths, cwd) == 19);
   finishSearch(context, cwd_depth);

+  /* Check nodes in search tree. */
+  SearchNode *n_cwd            = checkCwdTree(root, cwd_depth);
+  SearchNode *n_symlink        = findSubnode(n_cwd,      "symlink",         SRT_symlink);
+  SearchNode *n_test_dir       = findSubnode(n_cwd,      "test directory",  SRT_directory);
+  SearchNode *n_hidden_symlink = findSubnode(n_test_dir, ".hidden symlink", SRT_symlink);
+  SearchNode *n_bar_a_txt      = findSubnode(n_test_dir, "^bar-a\\.txt$",   SRT_regular);
+
+  /* Check found paths. */
+  checkHasIgnoredProperly(paths);
+  assert_true(strtableGet(paths, str("empty.txt"))   == NULL);
+  assert_true(strtableGet(paths, str("example.txt")) == NULL);
+
+  checkFoundPath(paths, "symlink.txt",                               BPOL_mirror, n_symlink);
+  checkFoundPath(paths, "test directory",                            BPOL_copy,   n_test_dir);
+  checkFoundPath(paths, "test directory/.empty",                     BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden",                    BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden",            BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-A.txt", BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-B.txt", BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-C.txt", BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden/test file.☢",        BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden/❤❤❤.txt",            BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden 1",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden 2",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden 3",                  BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/.hidden symlink",            BPOL_mirror, n_hidden_symlink);
+  checkFoundPath(paths, "test directory/bar-a.txt",                  BPOL_track,  n_bar_a_txt);
+  assert_true(strtableGet(paths, str("test directory/bar-b.txt"))       == NULL);
+  assert_true(strtableGet(paths, str("test directory/empty-directory")) == NULL);
+  checkFoundPath(paths, "test directory/foo 1",                      BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar",                  BPOL_copy,   NULL);
+  assert_true(strtableGet(paths, str("test directory/foo 1/bar/1.txt")) == NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar/2.txt",            BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar/3.txt",            BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-a.txt",      BPOL_copy,   NULL);
+  assert_true(strtableGet(paths, str("test directory/foo 1/test-file-b.txt")) == NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-c.txt",      BPOL_copy,   NULL);
+  checkFoundPath(paths, "test directory/foo 1/♞.☂",                  BPOL_copy,   NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar a1.txt")) == NULL);
+  checkFoundPath(paths, "test directory/foobar a2.txt",              BPOL_copy,   NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar b1.txt")) == NULL);
+  checkFoundPath(paths, "test directory/foobar b2.txt",              BPOL_copy,   NULL);
+  assert_true(strtableGet(paths, str("test directory/symlink")) == NULL);
+  checkFoundPath(paths, "test directory/φ.txt",                      BPOL_copy,   NULL);
+  assert_true(strtableGet(paths, str("test directory/€.txt")) == NULL);
+  strtableFree(paths);
+
+  /* Check ignore expressions. */
   checkIgnoreExpression(root, "test/data/.*(tmp|config-files|metadata)$", true);
   checkIgnoreExpression(root, "test/data/e.+\\.txt$",        true);
   checkIgnoreExpression(root, "^will-never-match-anything$", false);
@@ -408,54 +485,6 @@
   checkIgnoreExpression(root, "€\\.txt$",                    true);
   checkIgnoreExpression(root, "^will-never-match-any-file$", false);
   checkIgnoreExpression(root, "directory$",                  true);
-
-  assert_true(strtableGet(found_files, str("empty.txt"))   == NULL);
-  assert_true(strtableGet(found_files, str("example.txt")) == NULL);
-  checkHasPolicy(found_files, "symlink.txt", BPOL_mirror);
-  checkHasIgnoredProperly(found_files);
-
-  checkHasPolicy(found_files, "test directory",                            BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.empty",                     BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden",                    BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden",            BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-A.txt", BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-B.txt", BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-C.txt", BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/test file.☢",        BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden/❤❤❤.txt",            BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden 1",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden 2",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden 3",                  BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden symlink",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/bar-a.txt",                  BPOL_track);
-  assert_true(strtableGet(found_files, str("test directory/bar-b.txt"))       == NULL);
-  assert_true(strtableGet(found_files, str("test directory/empty-directory")) == NULL);
-  checkHasPolicy(found_files, "test directory/foo 1",                      BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1/bar",                  BPOL_copy);
-  assert_true(strtableGet(found_files, str("test directory/foo 1/bar/1.txt")) == NULL);
-  checkHasPolicy(found_files, "test directory/foo 1/bar/2.txt",            BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1/bar/3.txt",            BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-a.txt",      BPOL_copy);
-  assert_true(strtableGet(found_files, str("test directory/foo 1/test-file-b.txt")) == NULL);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-c.txt",      BPOL_copy);
-  checkHasPolicy(found_files, "test directory/foo 1/♞.☂",                  BPOL_copy);
-  assert_true(strtableGet(found_files, str("test directory/foobar a1.txt")) == NULL);
-  checkHasPolicy(found_files, "test directory/foobar a2.txt",              BPOL_copy);
-  assert_true(strtableGet(found_files, str("test directory/foobar b1.txt")) == NULL);
-  checkHasPolicy(found_files, "test directory/foobar b2.txt",              BPOL_copy);
-  assert_true(strtableGet(found_files, str("test directory/symlink")) == NULL);
-  checkHasPolicy(found_files, "test directory/φ.txt",                      BPOL_copy);
-  assert_true(strtableGet(found_files, str("test directory/€.txt")) == NULL);
-  strtableFree(found_files);
-
-  SearchNode *node = checkCwdTree(root, cwd_depth);
-  assert_true(node != NULL);
-
-  checkSubnode(node, "symlink", SRT_symlink);
-
-  SearchNode *test_dir = checkSubnode(node, "test directory", SRT_directory);
-  checkSubnode(test_dir, ".hidden symlink", SRT_symlink);
-  checkSubnode(test_dir, "^bar-a\\.txt$", SRT_regular);
 }

 /** Tests a search by using the generated config "symlink-following.txt".
@@ -469,57 +498,58 @@
   assert_true(context != NULL);

   size_t cwd_depth = skipCwd(context, cwd, root);
-  StringTable *found_files = strtableNew();
-  assert_true(populateDirectoryTable(context, found_files, cwd) == 20);
+  StringTable *paths = strtableNew();
+  assert_true(populateDirectoryTable(context, paths, cwd) == 20);
   finishSearch(context, cwd_depth);

+  /* Check nodes in search tree. */
+  SearchNode *n_cwd      = checkCwdTree(root, cwd_depth);
+  SearchNode *n_test_dir = findSubnode(n_cwd, "test directory", SRT_directory);
+
+  SearchNode *n_hidden_symlink = findSubnode(n_test_dir,       ".hidden symlink", SRT_directory);
+  SearchNode *n_2_txt          = findSubnode(n_hidden_symlink, "2.txt",           SRT_regular);
+
+  SearchNode *n_empty_dir = findSubnode(n_test_dir, "empty-directory", SRT_directory);
+  findSubnode(n_empty_dir, ".*", SRT_none);
+
+  /* Check found paths. */
+  checkHasIgnoredProperly(paths);
+  assert_true(strtableGet(paths, str("empty.txt"))   == NULL);
+  assert_true(strtableGet(paths, str("example.txt")) == NULL);
+  assert_true(strtableGet(paths, str("symlink.txt")) == NULL);
+
+  checkFoundPath(paths, "test directory",                            BPOL_track, n_test_dir);
+  checkFoundPath(paths, "test directory/.empty",                     BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden",                    BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden",            BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-A.txt", BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-B.txt", BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-C.txt", BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden/test file.☢",        BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden/❤❤❤.txt",            BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden 1",                  BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden 2",                  BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden 3",                  BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden symlink",            BPOL_track, n_hidden_symlink);
+  checkFoundPath(paths, "test directory/.hidden symlink/1.txt",      BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/.hidden symlink/2.txt",      BPOL_copy,  n_2_txt);
+  checkFoundPath(paths, "test directory/.hidden symlink/3.txt",      BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/bar-a.txt",                  BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/bar-b.txt",                  BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/empty-directory",            BPOL_track, n_empty_dir);
+  assert_true(strtableGet(paths, str("test directory/foo 1")) == NULL);
+  checkFoundPath(paths, "test directory/foobar a1.txt",              BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/foobar a2.txt",              BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/foobar b1.txt",              BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/foobar b2.txt",              BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/symlink",                    BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/φ.txt",                      BPOL_track, NULL);
+  checkFoundPath(paths, "test directory/€.txt",                      BPOL_track, NULL);
+  strtableFree(paths);
+
+  /* Check ignore expressions. */
   checkIgnoreExpression(root, "test/data/[^/]+$", true);
   checkIgnoreExpression(root, "foo 1$", true);
-
-  assert_true(strtableGet(found_files, str("empty.txt"))   == NULL);
-  assert_true(strtableGet(found_files, str("example.txt")) == NULL);
-  assert_true(strtableGet(found_files, str("symlink.txt")) == NULL);
-  checkHasIgnoredProperly(found_files);
-
-  checkHasPolicy(found_files, "test directory",                            BPOL_track);
-  checkHasPolicy(found_files, "test directory/.empty",                     BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden",                    BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden",            BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-A.txt", BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-B.txt", BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-C.txt", BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/test file.☢",        BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden/❤❤❤.txt",            BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden 1",                  BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden 2",                  BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden 3",                  BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden symlink",            BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden symlink/1.txt",      BPOL_track);
-  checkHasPolicy(found_files, "test directory/.hidden symlink/2.txt",      BPOL_copy);
-  checkHasPolicy(found_files, "test directory/.hidden symlink/3.txt",      BPOL_track);
-  checkHasPolicy(found_files, "test directory/bar-a.txt",                  BPOL_track);
-  checkHasPolicy(found_files, "test directory/bar-b.txt",                  BPOL_track);
-  checkHasPolicy(found_files, "test directory/empty-directory",            BPOL_track);
-  assert_true(strtableGet(found_files, str("test directory/foo 1")) == NULL);
-  checkHasPolicy(found_files, "test directory/foobar a1.txt",              BPOL_track);
-  checkHasPolicy(found_files, "test directory/foobar a2.txt",              BPOL_track);
-  checkHasPolicy(found_files, "test directory/foobar b1.txt",              BPOL_track);
-  checkHasPolicy(found_files, "test directory/foobar b2.txt",              BPOL_track);
-  checkHasPolicy(found_files, "test directory/symlink",                    BPOL_track);
-  checkHasPolicy(found_files, "test directory/φ.txt",                      BPOL_track);
-  checkHasPolicy(found_files, "test directory/€.txt",                      BPOL_track);
-  strtableFree(found_files);
-
-  SearchNode *node = checkCwdTree(root, cwd_depth);
-  assert_true(node != NULL);
-
-  SearchNode *test_dir = checkSubnode(node, "test directory", SRT_directory);
-
-  SearchNode *hidden_symlink = checkSubnode(test_dir, ".hidden symlink", SRT_directory);
-  checkSubnode(hidden_symlink, "2.txt", SRT_regular);
-
-  SearchNode *empty_dir = checkSubnode(test_dir, "empty-directory", SRT_directory);
-  checkSubnode(empty_dir, ".*", SRT_none);
 }

 /** Performs a search using the generated config file
@@ -535,51 +565,50 @@
   assert_true(context != NULL);

   size_t cwd_depth = skipCwd(context, cwd, root);
-  StringTable *found_files = strtableNew();
-  assert_true(populateDirectoryTable(context, found_files, cwd) == 2);
+  StringTable *paths = strtableNew();
+  assert_true(populateDirectoryTable(context, paths, cwd) == 2);
   finishSearch(context, cwd_depth);

-  checkHasPolicy(found_files, "empty.txt", BPOL_none);
-  assert_true(strtableGet(found_files, str("empty.txt/file 1.txt")) == NULL);
-
-  checkHasPolicy(found_files, "symlink.txt", BPOL_none);
-  assert_true(strtableGet(found_files, str("symlink.txt/foo-bar.txt")) == NULL);
-
-  assert_true(strtableGet(found_files, str("example.txt"))            == NULL);
-  checkHasIgnoredProperly(found_files);
-
-  checkHasPolicy(found_files, "test directory", BPOL_none);
-  assert_true(strtableGet(found_files, str("test directory/super-file.txt"))  == NULL);
-  assert_true(strtableGet(found_files, str("test directory/.empty"))          == NULL);
-  assert_true(strtableGet(found_files, str("test directory/.hidden"))         == NULL);
-  assert_true(strtableGet(found_files, str("test directory/.hidden 1"))       == NULL);
-  assert_true(strtableGet(found_files, str("test directory/.hidden 2"))       == NULL);
-  assert_true(strtableGet(found_files, str("test directory/.hidden 3"))       == NULL);
-  assert_true(strtableGet(found_files, str("test directory/.hidden symlink")) == NULL);
-  assert_true(strtableGet(found_files, str("test directory/bar-a.txt"))       == NULL);
-  assert_true(strtableGet(found_files, str("test directory/bar-b.txt"))       == NULL);
-  assert_true(strtableGet(found_files, str("test directory/empty-directory")) == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foo 1"))           == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foobar a1.txt"))   == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foobar a2.txt"))   == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foobar b1.txt"))   == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foobar b2.txt"))   == NULL);
-  assert_true(strtableGet(found_files, str("test directory/symlink"))         == NULL);
-  assert_true(strtableGet(found_files, str("test directory/φ.txt"))           == NULL);
-  assert_true(strtableGet(found_files, str("test directory/€.txt"))           == NULL);
-  strtableFree(found_files);
-
-  SearchNode *node = checkCwdTree(root, cwd_depth);
-  assert_true(node != NULL);
-
-  SearchNode *empty_txt = checkSubnode(node, "empty.txt", SRT_regular);
-  checkSubnode(empty_txt, "file 1.txt", SRT_none);
-
-  SearchNode *symlink = checkSubnode(node, "symlink.txt", SRT_regular);
-  checkSubnode(symlink, "foo-bar.txt", SRT_none);
-
-  SearchNode *test_dir = checkSubnode(node, "test directory", SRT_directory);
-  checkSubnode(test_dir, "super-file.txt", SRT_none);
+  /* Check nodes in search tree. */
+  SearchNode *n_cwd = checkCwdTree(root, cwd_depth);
+
+  SearchNode *n_empty_txt = findSubnode(n_cwd, "empty.txt", SRT_regular);
+  findSubnode(n_empty_txt, "file 1.txt", SRT_none);
+
+  SearchNode *n_symlink_txt = findSubnode(n_cwd, "symlink.txt", SRT_regular);
+  findSubnode(n_symlink_txt, "foo-bar.txt", SRT_none);
+
+  SearchNode *n_test_dir = findSubnode(n_cwd, "test directory", SRT_directory);
+  findSubnode(n_test_dir, "super-file.txt", SRT_none);
+
+  /* Check found paths. */
+  checkHasIgnoredProperly(paths);
+  assert_true(strtableGet(paths, str("example.txt")) == NULL);
+
+  checkFoundPath(paths, "empty.txt", BPOL_none, n_empty_txt);
+  assert_true(strtableGet(paths, str("empty.txt/file 1.txt")) == NULL);
+  checkFoundPath(paths, "symlink.txt", BPOL_none, n_symlink_txt);
+  assert_true(strtableGet(paths, str("symlink.txt/foo-bar.txt")) == NULL);
+  checkFoundPath(paths, "test directory", BPOL_none, n_test_dir);
+  assert_true(strtableGet(paths, str("test directory/super-file.txt"))  == NULL);
+  assert_true(strtableGet(paths, str("test directory/.empty"))          == NULL);
+  assert_true(strtableGet(paths, str("test directory/.hidden"))         == NULL);
+  assert_true(strtableGet(paths, str("test directory/.hidden 1"))       == NULL);
+  assert_true(strtableGet(paths, str("test directory/.hidden 2"))       == NULL);
+  assert_true(strtableGet(paths, str("test directory/.hidden 3"))       == NULL);
+  assert_true(strtableGet(paths, str("test directory/.hidden symlink")) == NULL);
+  assert_true(strtableGet(paths, str("test directory/bar-a.txt"))       == NULL);
+  assert_true(strtableGet(paths, str("test directory/bar-b.txt"))       == NULL);
+  assert_true(strtableGet(paths, str("test directory/empty-directory")) == NULL);
+  assert_true(strtableGet(paths, str("test directory/foo 1"))           == NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar a1.txt"))   == NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar a2.txt"))   == NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar b1.txt"))   == NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar b2.txt"))   == NULL);
+  assert_true(strtableGet(paths, str("test directory/symlink"))         == NULL);
+  assert_true(strtableGet(paths, str("test directory/φ.txt"))           == NULL);
+  assert_true(strtableGet(paths, str("test directory/€.txt"))           == NULL);
+  strtableFree(paths);
 }

 /** Performs a search by using the generated config file
@@ -594,71 +623,71 @@
   assert_true(context != NULL);

   size_t cwd_depth = skipCwd(context, cwd, root);
-  StringTable *found_files = strtableNew();
-  assert_true(populateDirectoryTable(context, found_files, cwd) == 26);
+  StringTable *paths = strtableNew();
+  assert_true(populateDirectoryTable(context, paths, cwd) == 26);
   finishSearch(context, cwd_depth);

+  /* Check nodes in search tree. */
+  SearchNode *n_cwd = checkCwdTree(root, cwd_depth);
+  SearchNode *n_es  = findSubnode(n_cwd, "^[es]", SRT_regular | SRT_symlink);
+
+  SearchNode *n_test_dir = findSubnode(n_cwd,      "^tes",     SRT_directory);
+  SearchNode *n_symlink  = findSubnode(n_test_dir, " symlink", SRT_directory);
+  SearchNode *n_star     = findSubnode(n_symlink,  ".*",       SRT_regular);
+
+  SearchNode *n_hidden_123 = findSubnode(n_test_dir, "^.hidden [1-3]$", SRT_regular);
+  findSubnode(n_hidden_123, "2.txt", SRT_none);
+  findSubnode(n_hidden_123, ".*",    SRT_none);
+
+  /* Check found paths. */
+  checkHasIgnoredProperly(paths);
+  checkFoundPath(paths, "empty.txt",   BPOL_copy, n_es);
+  checkFoundPath(paths, "example.txt", BPOL_copy, n_es);
+  checkFoundPath(paths, "symlink.txt", BPOL_copy, n_es);
+
+  checkFoundPath(paths, "test directory",                            BPOL_mirror, n_test_dir);
+  checkFoundPath(paths, "test directory/.empty",                     BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden",                    BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden",            BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-A.txt", BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-B.txt", BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden/.hidden/test-C.txt", BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden/test file.☢",        BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden/❤❤❤.txt",            BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/.hidden 1",                  BPOL_mirror, n_hidden_123);
+  checkFoundPath(paths, "test directory/.hidden 2",                  BPOL_mirror, n_hidden_123);
+  checkFoundPath(paths, "test directory/.hidden 3",                  BPOL_mirror, n_hidden_123);
+  checkFoundPath(paths, "test directory/.hidden symlink",            BPOL_mirror, n_symlink);
+  checkFoundPath(paths, "test directory/.hidden symlink/1.txt",      BPOL_mirror, n_star);
+  checkFoundPath(paths, "test directory/.hidden symlink/2.txt",      BPOL_mirror, n_star);
+  checkFoundPath(paths, "test directory/.hidden symlink/3.txt",      BPOL_mirror, n_star);
+  checkFoundPath(paths, "test directory/bar-a.txt",                  BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/bar-b.txt",                  BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/empty-directory",            BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/foo 1",                      BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar",                  BPOL_mirror, NULL);
+  assert_true(strtableGet(paths, str("test directory/foo 1/bar/1.txt")) == NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar/2.txt",            BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/foo 1/bar/3.txt",            BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-a.txt",      BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-b.txt",      BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/foo 1/test-file-c.txt",      BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/foo 1/♞.☂",                  BPOL_mirror, NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar a1.txt")) == NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar a2.txt")) == NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar b1.txt")) == NULL);
+  assert_true(strtableGet(paths, str("test directory/foobar b2.txt")) == NULL);
+  checkFoundPath(paths, "test directory/symlink",                    BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/φ.txt",                      BPOL_mirror, NULL);
+  checkFoundPath(paths, "test directory/€.txt",                      BPOL_mirror, NULL);
+  strtableFree(paths);
+
+  /* Check ignore expressions. */
   checkIgnoreExpression(root, "test/data/.*(tmp|config-files|metadata)$", true);
   checkIgnoreExpression(root, "^never-matches-anything$",   false);
   checkIgnoreExpression(root, "\\.hidden symlink/2\\.txt$", false);
   checkIgnoreExpression(root, "1\\.txt$",                   true);
   checkIgnoreExpression(root, "foobar",                     true);
-
-  checkHasPolicy(found_files, "empty.txt",   BPOL_copy);
-  checkHasPolicy(found_files, "example.txt", BPOL_copy);
-  checkHasPolicy(found_files, "symlink.txt", BPOL_copy);
-  checkHasIgnoredProperly(found_files);
-
-  checkHasPolicy(found_files, "test directory",                            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.empty",                     BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden",                    BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-A.txt", BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-B.txt", BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden/.hidden/test-C.txt", BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden/test file.☢",        BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden/❤❤❤.txt",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden 1",                  BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden 2",                  BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden 3",                  BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden symlink",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden symlink/1.txt",      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden symlink/2.txt",      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/.hidden symlink/3.txt",      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/bar-a.txt",                  BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/bar-b.txt",                  BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/empty-directory",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1",                      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1/bar",                  BPOL_mirror);
-  assert_true(strtableGet(found_files, str("test directory/foo 1/bar/1.txt")) == NULL);
-  checkHasPolicy(found_files, "test directory/foo 1/bar/2.txt",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1/bar/3.txt",            BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-a.txt",      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-b.txt",      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1/test-file-c.txt",      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/foo 1/♞.☂",                  BPOL_mirror);
-  assert_true(strtableGet(found_files, str("test directory/foobar a1.txt")) == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foobar a2.txt")) == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foobar b1.txt")) == NULL);
-  assert_true(strtableGet(found_files, str("test directory/foobar b2.txt")) == NULL);
-  checkHasPolicy(found_files, "test directory/symlink",                    BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/φ.txt",                      BPOL_mirror);
-  checkHasPolicy(found_files, "test directory/€.txt",                      BPOL_mirror);
-  strtableFree(found_files);
-
-  SearchNode *node = checkCwdTree(root, cwd_depth);
-  assert_true(node != NULL);
-
-  checkSubnode(node, "^[es]", SRT_regular | SRT_symlink);
-
-  SearchNode *test_dir = checkSubnode(node, "^tes", SRT_directory);
-
-  SearchNode *symlink = checkSubnode(test_dir, " symlink", SRT_directory);
-  checkSubnode(symlink, ".*", SRT_regular);
-
-  SearchNode *hidden = checkSubnode(test_dir, "^.hidden [1-3]$", SRT_regular);
-  checkSubnode(hidden, ".*", SRT_none);
-  checkSubnode(hidden, "2.txt", SRT_none);
 }

 int main(void)