]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
noodle_build: use bytecode_ptr
authorJustin Viiret <justin.viiret@intel.com>
Mon, 20 Mar 2017 06:18:41 +0000 (17:18 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 05:19:35 +0000 (15:19 +1000)
src/hwlm/hwlm_build.cpp
src/hwlm/noodle_build.cpp
src/hwlm/noodle_build.h

index a05ca1a25fca98b7d5913283d27b62c43e61f84d..cd98feb468c501735b87c1b597f15396f30ccac6 100644 (file)
@@ -143,7 +143,7 @@ aligned_unique_ptr<HWLM> hwlmBuild(const vector<hwlmLiteral> &lits,
         const hwlmLiteral &lit = lits.front();
         auto noodle = noodBuildTable(lit);
         if (noodle) {
-            engSize = noodSize(noodle.get());
+            engSize = noodle.size();
         }
         eng = move(noodle);
     } else {
index d2b4e3f2091e9b3c6706b6447da79184aecd6667..6412d3f505d6493d9cf4dbbc4f1e05f013e6e897 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -35,7 +35,6 @@
 
 #include "hwlm_literal.h"
 #include "noodle_internal.h"
-#include "util/alloc.h"
 #include "util/compare.h"
 #include "util/verify_types.h"
 #include "ue2common.h"
@@ -67,7 +66,7 @@ size_t findNoodFragOffset(const hwlmLiteral &lit) {
     return offset;
 }
 
-aligned_unique_ptr<noodTable> noodBuildTable(const hwlmLiteral &lit) {
+bytecode_ptr<noodTable> noodBuildTable(const hwlmLiteral &lit) {
     if (!lit.msk.empty()) {
         DEBUG_PRINTF("noodle can't handle supplementary masks\n");
         return nullptr;
@@ -75,7 +74,7 @@ aligned_unique_ptr<noodTable> noodBuildTable(const hwlmLiteral &lit) {
 
     const auto &s = lit.s;
     size_t noodle_len = sizeof(noodTable) + s.length();
-    auto n = aligned_zmalloc_unique<noodTable>(noodle_len);
+    auto n = make_bytecode_ptr<noodTable>(noodle_len);
     assert(n);
 
     size_t key_offset = findNoodFragOffset(lit);
index 1a41695f736fa4fa61e00fcd4cfbf5b4a80f5b3c..b5725f0827a1d66b3da817de2e000a1daaa6fefb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  * \brief Noodle literal matcher: build code.
  */
 
-#ifndef NOODLE_BUILD_H_048A1A6D585A9A
-#define NOODLE_BUILD_H_048A1A6D585A9A
+#ifndef NOODLE_BUILD_H
+#define NOODLE_BUILD_H
 
 #include "ue2common.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
 
 struct noodTable;
 
@@ -43,7 +43,7 @@ namespace ue2 {
 struct hwlmLiteral;
 
 /** \brief Construct a Noodle matcher for the given literal. */
-ue2::aligned_unique_ptr<noodTable> noodBuildTable(const hwlmLiteral &lit);
+bytecode_ptr<noodTable> noodBuildTable(const hwlmLiteral &lit);
 
 size_t noodSize(const noodTable *n);
 
@@ -61,5 +61,5 @@ void noodPrintStats(const noodTable *n, FILE *f);
 
 #endif // DUMP_SUPPORT
 
-#endif /* NOODLE_BUILD_H_048A1A6D585A9A */
+#endif /* NOODLE_BUILD_H */