]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
rose: define invalid value for program offset
authorJustin Viiret <justin.viiret@intel.com>
Tue, 31 Jan 2017 23:41:32 +0000 (10:41 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 04:56:49 +0000 (14:56 +1000)
src/rose/program_runtime.h
src/rose/rose_build_impl.h
src/rose/rose_common.h

index 8f4c528d6f287523fcf9f6d2ee1206ec15a0e5b2..7172f6aadf2ca017be6b35ef1edda8ff2ce88da2 100644 (file)
@@ -41,6 +41,7 @@
 #include "miracle.h"
 #include "report.h"
 #include "rose.h"
+#include "rose_common.h"
 #include "rose_internal.h"
 #include "rose_program.h"
 #include "rose_types.h"
@@ -1501,6 +1502,7 @@ hwlmcb_rv_t roseRunProgram_i(const struct RoseEngine *t,
     DEBUG_PRINTF("program=%u, offsets [%llu,%llu], flags=%u\n", programOffset,
                  som, end, prog_flags);
 
+    assert(programOffset != ROSE_INVALID_PROG_OFFSET);
     assert(programOffset >= sizeof(struct RoseEngine));
     assert(programOffset < t->size);
 
index 9eba29f0de113789ba237cebe46c798ea411b5f8..8748a08c1ab993f73836d5e9469aa2fc3aca63e3 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "rose_build.h"
 #include "rose_build_util.h"
+#include "rose_common.h"
 #include "rose_graph.h"
 #include "nfa/mpvcompile.h"
 #include "nfa/goughcompile.h"
@@ -441,8 +442,8 @@ struct LitFragment {
         : fragment_id(fragment_id_in), groups(groups_in) {}
     u32 fragment_id;
     rose_group groups;
-    u32 lit_program_offset = 0;
-    u32 delay_program_offset = 0;
+    u32 lit_program_offset = ROSE_INVALID_PROG_OFFSET;
+    u32 delay_program_offset = ROSE_INVALID_PROG_OFFSET;
 };
 
 // Concrete impl class
index 3249f0b8bbb39539f58c6413d81c79b729f14409..c0250aa5e0889d15da7bd0dbd9cad1de8d7ab8f5 100644 (file)
@@ -41,4 +41,7 @@
 /** \brief Length in bytes of a reach bitvector, used by the lookaround code. */
 #define REACH_BITVECTOR_LEN 32
 
+/** \brief Value used to represent an invalid Rose program offset. */
+#define ROSE_INVALID_PROG_OFFSET 0
+
 #endif // ROSE_COMMON_H