array.c
Go to the documentation of this file.
/* SPDX-FileCopyrightText: 2009-2023 Greenbone AG
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "array.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "libgvm base"
GPtrArray *
make_array (void)
{
return g_ptr_array_new ();
}
void
array_reset (array_t **array)
{
array_free (*array);
*array = make_array ();
}
void
array_free (GPtrArray *array)
{
if (array)
{
guint index = array->len;
while (index--)
g_free (g_ptr_array_index (array, index));
g_ptr_array_free (array, TRUE);
}
}
void
array_add (array_t *array, gpointer pointer)
{
if (array)
g_ptr_array_add (array, pointer);
}
void
array_terminate (array_t *array)
{
if (array)
g_ptr_array_add (array, NULL);
}
array_terminate
void array_terminate(array_t *array)
Terminate an array.
Definition array.c:80
make_array
GPtrArray * make_array(void)
Make a global array.
Definition array.c:25
array_add
void array_add(array_t *array, gpointer pointer)
Push a generic pointer onto an array.
Definition array.c:68
array_reset
void array_reset(array_t **array)
Reset an array.
Definition array.c:36
array_free
void array_free(GPtrArray *array)
Free global array value.
Definition array.c:50
array.h
Array utilities.
array_t
GPtrArray array_t
Definition array.h:16