vars: small cleanups

pull/2384/head
Victor Julien 9 years ago
parent e4b2729399
commit 321fb6463e

@ -876,7 +876,7 @@ static void AlertDebugLogModeSyncFlowbitsNamesToPacketStruct(Packet *p, DetectEn
}
FlowBit *fb = (FlowBit *) gv;
char *name = VariableIdxGetName(de_ctx, fb->idx, VAR_TYPE_FLOW_BIT);
const char *name = VariableIdxGetName(de_ctx, fb->idx, VAR_TYPE_FLOW_BIT);
if (name != NULL) {
p->debuglog_flowbits_names[i] = SCStrdup(name);
if (p->debuglog_flowbits_names[i] == NULL) {

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2010 Open Information Security Foundation
/* Copyright (C) 2007-2016 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
@ -31,7 +31,6 @@
typedef struct VariableName_ {
char *name;
uint8_t type; /* flowbit, pktvar, etc */
uint8_t flags;
uint16_t idx;
} VariableName;
@ -135,7 +134,7 @@ void VariableNameFreeHash(DetectEngineCtx *de_ctx)
* \retval 0 in case of error
* \retval idx the idx or 0
*/
uint16_t VariableNameGetIdx(DetectEngineCtx *de_ctx, char *name, enum VarTypes type)
uint16_t VariableNameGetIdx(DetectEngineCtx *de_ctx, const char *name, enum VarTypes type)
{
uint16_t idx = 0;
@ -174,7 +173,7 @@ error:
* \retval NULL in case of error
* \retval name of the variable if successful.
*/
char *VariableIdxGetName(DetectEngineCtx *de_ctx, uint16_t idx, enum VarTypes type)
const char *VariableIdxGetName(DetectEngineCtx *de_ctx, uint16_t idx, enum VarTypes type)
{
VariableName *fn = SCMalloc(sizeof(VariableName));
if (unlikely(fn == NULL))

@ -27,8 +27,10 @@
int VariableNameInitHash(DetectEngineCtx *);
void VariableNameFreeHash(DetectEngineCtx *);
uint16_t VariableNameGetIdx(DetectEngineCtx *, char *, enum VarTypes);
char * VariableIdxGetName(DetectEngineCtx *, uint16_t , enum VarTypes);
uint16_t VariableNameGetIdx(DetectEngineCtx *,
const char *name, enum VarTypes type);
const char *VariableIdxGetName(DetectEngineCtx *,
uint16_t id, enum VarTypes type);
#endif

Loading…
Cancel
Save