enum: Add functions to add and remove mappings from enum names

Co-authored-by: Thomas Egerer <[email protected]>
This commit is contained in:
Tobias Brunner
2023-02-17 13:37:38 +01:00
co-authored by Thomas Egerer
parent 3cf5653640
commit 0de42047a9
3 changed files with 160 additions and 1 deletions
+44
View File
@@ -1,4 +1,5 @@
/*
* Copyright (C) 2023 Tobias Brunner
* Copyright (C) 2006 Martin Willi
*
* Copyright (C) secunet Security Networks AG
@@ -23,6 +24,49 @@
#include "enum.h"
/*
* Described in header
*/
void enum_add_enum_names(enum_name_t *e, enum_name_t *names)
{
if (e)
{
do
{
if (!e->next)
{
e->next = names;
break;
}
else if (e->next == names)
{
break;
}
}
while ((e = e->next));
}
}
/*
* Described in header
*/
void enum_remove_enum_names(enum_name_t *e, enum_name_t *names)
{
if (e)
{
do
{
if (e->next == names)
{
e->next = names->next;
names->next = NULL;
break;
}
}
while ((e = e->next));
}
}
/**
* See header.
*/