NFA API: Remove nfaBlockExecReverse scratch arg

Scratch is no longer used by this function's implementations.
This commit is contained in:
Justin Viiret 2016-02-11 16:46:15 +11:00 committed by Matthew Barr
parent 3e002f8181
commit 58f9617f66
6 changed files with 11 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Intel Corporation * Copyright (c) 2015-2016, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -65,8 +65,7 @@ extern "C"
void *state, u8 key); \ void *state, u8 key); \
char gf_name##_B_Reverse(const struct NFA *n, u64a offset, const u8 *buf, \ char gf_name##_B_Reverse(const struct NFA *n, u64a offset, const u8 *buf, \
size_t buflen, const u8 *hbuf, size_t hlen, \ size_t buflen, const u8 *hbuf, size_t hlen, \
struct hs_scratch *scratch, NfaCallback cb, \ NfaCallback cb, void *context); \
void *context); \
char gf_name##_queueCompressState(const struct NFA *nfa, \ char gf_name##_queueCompressState(const struct NFA *nfa, \
const struct mq *q, s64a loc); \ const struct mq *q, s64a loc); \
char gf_name##_expandState(const struct NFA *nfa, void *dest, \ char gf_name##_expandState(const struct NFA *nfa, void *dest, \

View File

@ -811,7 +811,6 @@ char JOIN(LIMEX_API_ROOT, _reportCurrent)(const struct NFA *n, struct mq *q) {
char JOIN(LIMEX_API_ROOT, _B_Reverse)(const struct NFA *n, u64a offset, char JOIN(LIMEX_API_ROOT, _B_Reverse)(const struct NFA *n, u64a offset,
const u8 *buf, size_t buflen, const u8 *buf, size_t buflen,
const u8 *hbuf, size_t hlen, const u8 *hbuf, size_t hlen,
UNUSED struct hs_scratch *scratch,
NfaCallback cb, void *context) { NfaCallback cb, void *context) {
assert(buf || hbuf); assert(buf || hbuf);
assert(buflen || hlen); assert(buflen || hlen);

View File

@ -44,7 +44,6 @@ extern "C"
#include "callback.h" #include "callback.h"
#include "ue2common.h" #include "ue2common.h"
struct hs_scratch;
struct mq; struct mq;
struct NFA; struct NFA;
@ -212,16 +211,12 @@ char nfaQueueExecRose(const struct NFA *nfa, struct mq *q, ReportID report);
* @param buflen length of buf * @param buflen length of buf
* @param hbuf history buf * @param hbuf history buf
* @param hlen length of hbuf * @param hlen length of hbuf
* @param scratch scratch
* @param callback the callback to call for each match raised * @param callback the callback to call for each match raised
* @param context context pointer passed to each callback * @param context context pointer passed to each callback
*
* Note: is NOT reentrant
*/ */
char nfaBlockExecReverse(const struct NFA *nfa, u64a offset, const u8 *buf, char nfaBlockExecReverse(const struct NFA *nfa, u64a offset, const u8 *buf,
size_t buflen, const u8 *hbuf, size_t hlen, size_t buflen, const u8 *hbuf, size_t hlen,
struct hs_scratch *scratch, NfaCallback callback, NfaCallback callback, void *context);
void *context);
/** /**
* Check whether the given NFA's state indicates that it is in one or more * Check whether the given NFA's state indicates that it is in one or more

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Intel Corporation * Copyright (c) 2015-2016, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -332,13 +332,12 @@ char nfaQueueExecRose(const struct NFA *nfa, struct mq *q, ReportID r) {
char nfaBlockExecReverse(const struct NFA *nfa, u64a offset, const u8 *buf, char nfaBlockExecReverse(const struct NFA *nfa, u64a offset, const u8 *buf,
size_t buflen, const u8 *hbuf, size_t hlen, size_t buflen, const u8 *hbuf, size_t hlen,
struct hs_scratch *scratch, NfaCallback callback, NfaCallback callback, void *context) {
void *context) {
assert(nfa); assert(nfa);
assert(ISALIGNED_CL(nfa) && ISALIGNED_CL(getImplNfa(nfa))); assert(ISALIGNED_CL(nfa) && ISALIGNED_CL(getImplNfa(nfa)));
DISPATCH_BY_NFA_TYPE(_B_Reverse(nfa, offset, buf, buflen, hbuf, hlen, DISPATCH_BY_NFA_TYPE(_B_Reverse(nfa, offset, buf, buflen, hbuf, hlen,
scratch, callback, context)); callback, context));
return 0; return 0;
} }

View File

@ -151,7 +151,7 @@ void runRevNfa(struct hs_scratch *scratch, const struct internal_report *ri,
*from_offset = to_offset; *from_offset = to_offset;
nfaBlockExecReverse(nfa, to_offset, buf, buf_bytes, hbuf, history_bytes, nfaBlockExecReverse(nfa, to_offset, buf, buf_bytes, hbuf, history_bytes,
scratch, somRevCallback, from_offset); somRevCallback, from_offset);
assert(*from_offset <= to_offset); assert(*from_offset <= to_offset);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Intel Corporation * Copyright (c) 2015-2016, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -369,7 +369,7 @@ TEST_P(LimExReverseTest, BlockExecReverse) {
const size_t hlen = 0; const size_t hlen = 0;
nfaBlockExecReverse(nfa.get(), offset, buf, buflen, hbuf, hlen, nfaBlockExecReverse(nfa.get(), offset, buf, buflen, hbuf, hlen,
scratch.get(), onMatch, &matches); onMatch, &matches);
ASSERT_EQ(3, matches); ASSERT_EQ(3, matches);
} }