Skip to content

Commit

Permalink
Make sure WalkResult has default values.
Browse files Browse the repository at this point in the history
Since ReadingGrid::walk() may return an empty WalkResult if there are no
spans, it's important that no fields contain indeterminate values. After
this change, a local "WalkResult x;" declaration will result in all of
x's scalar fields to be 0.
  • Loading branch information
lukhnos committed Feb 20, 2024
1 parent 12025ca commit 0e43ba1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Engine/gramambular2/reading_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ class ReadingGrid {

struct WalkResult {
std::vector<NodePtr> nodes;
size_t totalReadings;
size_t vertices;
size_t edges;
uint64_t elapsedMicroseconds;
size_t totalReadings = 0;
size_t vertices = 0;
size_t edges = 0;
uint64_t elapsedMicroseconds = 0;

// Convenient method for finding the node at the cursor. Returns
// nodes.cend() if the value of cursor argument doesn't make sense. An
Expand Down

0 comments on commit 0e43ba1

Please # to comment.