You can tell whether an item already exists in the array when calling
array_appendu() now.
This commit is contained in:
parent
4572f1b774
commit
ba1a3656a1
|
@ -31,10 +31,13 @@ bool array_contains(void* arrayp, void* value)
|
|||
return false;
|
||||
}
|
||||
|
||||
void array_appendu(void* arrayp, void* value)
|
||||
bool array_appendu(void* arrayp, void* value)
|
||||
{
|
||||
if (!array_contains(arrayp, value))
|
||||
if (array_contains(arrayp, value))
|
||||
return true;
|
||||
|
||||
array_append(arrayp, value);
|
||||
return false;
|
||||
}
|
||||
|
||||
void array_remove(void* arrayp, void* value)
|
||||
|
|
|
@ -18,7 +18,7 @@ struct array
|
|||
}
|
||||
|
||||
extern void array_append(void* array, void* value);
|
||||
extern void array_appendu(void* array, void* value);
|
||||
extern bool array_appendu(void* array, void* value);
|
||||
extern void array_remove(void* array, void* value);
|
||||
extern bool array_contains(void* array, void* value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue