util/var-store: suppress coverity warnings

pull/13519/head
Victor Julien 2 months ago
parent 2bea5af2c8
commit 7f5d1f4c79

@ -294,14 +294,17 @@ out:
return result;
}
/** \brief find name for id+type at packet time. */
/** \brief find name for id+type at packet time.
* As the `active` store won't be modified, we don't need locks. */
const char *VarNameStoreLookupById(const uint32_t id, const enum VarTypes type)
{
const char *name = NULL;
/* coverity[missing_lock] */
const VarNameStore *current = SC_ATOMIC_GET(active);
if (current) {
VariableName lookup = { .type = type, .id = id };
/* coverity[missing_lock] */
const VariableName *found = HashListTableLookup(current->ids, (void *)&lookup, 0);
if (found) {
return found->name;
@ -311,12 +314,15 @@ const char *VarNameStoreLookupById(const uint32_t id, const enum VarTypes type)
return name;
}
/** \brief find name for id+type at packet time. */
/** \brief find name for id+type at packet time.
* As the `active` store won't be modified, we don't need locks. */
uint32_t VarNameStoreLookupByName(const char *name, const enum VarTypes type)
{
/* coverity[missing_lock] */
const VarNameStore *current = SC_ATOMIC_GET(active);
if (current) {
VariableName lookup = { .name = (char *)name, .type = type };
/* coverity[missing_lock] */
const VariableName *found = HashListTableLookup(current->names, (void *)&lookup, 0);
if (found) {
return found->id;

Loading…
Cancel
Save