mpm/ac-ks: coding style fixes

pull/3072/head
Victor Julien 7 years ago
parent c2729fe931
commit 531b57947b

@ -629,57 +629,57 @@ static inline void SCACTileCreateDeltaTable(MpmCtx *mpm_ctx)
if (ctx->state_count < 32767) { if (ctx->state_count < 32767) {
if (ctx->state_count < 128) { if (ctx->state_count < 128) {
ctx->bytes_per_state = 1; ctx->bytes_per_state = 1;
ctx->set_next_state = SCACTileSetState1Byte; ctx->SetNextState = SCACTileSetState1Byte;
switch(ctx->alphabet_storage) { switch(ctx->alphabet_storage) {
case 8: case 8:
ctx->search = SCACTileSearchTiny8; ctx->Search = SCACTileSearchTiny8;
break; break;
case 16: case 16:
ctx->search = SCACTileSearchTiny16; ctx->Search = SCACTileSearchTiny16;
break; break;
case 32: case 32:
ctx->search = SCACTileSearchTiny32; ctx->Search = SCACTileSearchTiny32;
break; break;
case 64: case 64:
ctx->search = SCACTileSearchTiny64; ctx->Search = SCACTileSearchTiny64;
break; break;
case 128: case 128:
ctx->search = SCACTileSearchTiny128; ctx->Search = SCACTileSearchTiny128;
break; break;
default: default:
ctx->search = SCACTileSearchTiny256; ctx->Search = SCACTileSearchTiny256;
} }
} else { } else {
/* 16-bit state needed */ /* 16-bit state needed */
ctx->bytes_per_state = 2; ctx->bytes_per_state = 2;
ctx->set_next_state = SCACTileSetState2Bytes; ctx->SetNextState = SCACTileSetState2Bytes;
switch(ctx->alphabet_storage) { switch(ctx->alphabet_storage) {
case 8: case 8:
ctx->search = SCACTileSearchSmall8; ctx->Search = SCACTileSearchSmall8;
break; break;
case 16: case 16:
ctx->search = SCACTileSearchSmall16; ctx->Search = SCACTileSearchSmall16;
break; break;
case 32: case 32:
ctx->search = SCACTileSearchSmall32; ctx->Search = SCACTileSearchSmall32;
break; break;
case 64: case 64:
ctx->search = SCACTileSearchSmall64; ctx->Search = SCACTileSearchSmall64;
break; break;
case 128: case 128:
ctx->search = SCACTileSearchSmall128; ctx->Search = SCACTileSearchSmall128;
break; break;
default: default:
ctx->search = SCACTileSearchSmall256; ctx->Search = SCACTileSearchSmall256;
} }
} }
} else { } else {
/* 32-bit next state */ /* 32-bit next state */
ctx->search = SCACTileSearchLarge; ctx->Search = SCACTileSearchLarge;
ctx->bytes_per_state = 4; ctx->bytes_per_state = 4;
ctx->set_next_state = SCACTileSetState4Bytes; ctx->SetNextState = SCACTileSetState4Bytes;
ctx->alphabet_storage = 256; /* Change? */ ctx->alphabet_storage = 256; /* Change? */
} }
@ -740,7 +740,7 @@ static void SCACTileClubOutputStatePresenceWithDeltaTable(MpmCtx *mpm_ctx)
for (aa = 0; aa < ctx->alphabet_size; aa++) { for (aa = 0; aa < ctx->alphabet_size; aa++) {
int next_state = ctx->goto_table[state][aa]; int next_state = ctx->goto_table[state][aa];
int next_state_outputs = ctx->output_table[next_state].no_of_entries; int next_state_outputs = ctx->output_table[next_state].no_of_entries;
ctx->set_next_state(ctx, state, aa, next_state, next_state_outputs); ctx->SetNextState(ctx, state, aa, next_state, next_state_outputs);
} }
} }
} }
@ -842,7 +842,7 @@ static void SCACTilePrepareSearch(MpmCtx *mpm_ctx)
/* Resize the output table to be only as big as its final size. */ /* Resize the output table to be only as big as its final size. */
SCACTileReallocOutputTable(ctx, ctx->state_count); SCACTileReallocOutputTable(ctx, ctx->state_count);
search_ctx->search = ctx->search; search_ctx->Search = ctx->Search;
memcpy(search_ctx->translate_table, ctx->translate_table, sizeof(ctx->translate_table)); memcpy(search_ctx->translate_table, ctx->translate_table, sizeof(ctx->translate_table));
/* Move the state table from the Init context */ /* Move the state table from the Init context */
@ -1243,7 +1243,7 @@ uint32_t SCACTileSearch(const MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx,
return 0; return 0;
/* Context specific matching function. */ /* Context specific matching function. */
return search_ctx->search(search_ctx, mpm_thread_ctx, pmq, buf, buflen); return search_ctx->Search(search_ctx, mpm_thread_ctx, pmq, buf, buflen);
} }
/* This function handles (ctx->state_count >= 32767) */ /* This function handles (ctx->state_count >= 32767) */

@ -63,13 +63,13 @@ typedef struct SCACTileCtx_ {
* number of states could make the next state could be 16 bits or * number of states could make the next state could be 16 bits or
* 32 bits. * 32 bits.
*/ */
uint32_t (*search)(const struct SCACTileSearchCtx_ *ctx, struct MpmThreadCtx_ *, uint32_t (*Search)(const struct SCACTileSearchCtx_ *ctx, struct MpmThreadCtx_ *,
PrefilterRuleStore *, const uint8_t *, uint16_t); PrefilterRuleStore *, const uint8_t *, uint16_t);
/* Function to set the next state based on size of next state /* Function to set the next state based on size of next state
* (bytes_per_state). * (bytes_per_state).
*/ */
void (*set_next_state)(struct SCACTileCtx_ *ctx, int state, int aa, void (*SetNextState)(struct SCACTileCtx_ *ctx, int state, int aa,
int new_state, int outputs); int new_state, int outputs);
/* List of patterns that match for this state. Indexed by State Number */ /* List of patterns that match for this state. Indexed by State Number */
@ -116,7 +116,7 @@ typedef struct SCACTileSearchCtx_ {
* number of states could make the next state could be 16 bits or * number of states could make the next state could be 16 bits or
* 32 bits. * 32 bits.
*/ */
uint32_t (*search)(const struct SCACTileSearchCtx_ *ctx, struct MpmThreadCtx_ *, uint32_t (*Search)(const struct SCACTileSearchCtx_ *ctx, struct MpmThreadCtx_ *,
PrefilterRuleStore *, const uint8_t *, uint16_t); PrefilterRuleStore *, const uint8_t *, uint16_t);
/* Convert input character to matching alphabet */ /* Convert input character to matching alphabet */

Loading…
Cancel
Save