"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "base/array.c" between
gvm-libs-1.0-beta2.tar.gz and gvm-libs-1.0.0.tar.gz

About: GVM Libraries for the Greenbone Vulnerability Management (GVM-10) framework (derived from the former openvas-libraries).

array.c  (gvm-libs-1.0-beta2):array.c  (gvm-libs-1.0.0)
/* Copyright (C) 2009-2018 Greenbone Networks GmbH /* Copyright (C) 2009-2019 Greenbone Networks GmbH
* *
* SPDX-License-Identifier: GPL-2.0-or-later * SPDX-License-Identifier: GPL-2.0-or-later
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 44 skipping to change at line 44
{ {
return g_ptr_array_new (); return g_ptr_array_new ();
} }
/** /**
* @brief Reset an array. * @brief Reset an array.
* *
* @param[in] array Pointer to array. * @param[in] array Pointer to array.
*/ */
void void
array_reset (array_t ** array) array_reset (array_t **array)
{ {
array_free (*array); array_free (*array);
*array = make_array (); *array = make_array ();
} }
/** /**
* @brief Free global array value. * @brief Free global array value.
* *
* Also g_free any elements. * Also g_free any elements.
* *
* @param[in] array Pointer to array. * @param[in] array Pointer to array.
*/ */
void void
array_free (GPtrArray * array) array_free (GPtrArray *array)
{ {
if (array) if (array)
{ {
guint index = array->len; guint index = array->len;
while (index--) while (index--)
g_free (g_ptr_array_index (array, index)); g_free (g_ptr_array_index (array, index));
g_ptr_array_free (array, TRUE); g_ptr_array_free (array, TRUE);
} }
} }
/** /**
* @brief Push a generic pointer onto an array. * @brief Push a generic pointer onto an array.
* *
* @param[in] array Array. * @param[in] array Array.
* @param[in] pointer Pointer. * @param[in] pointer Pointer.
*/ */
void void
array_add (array_t * array, gpointer pointer) array_add (array_t *array, gpointer pointer)
{ {
if (array) if (array)
g_ptr_array_add (array, pointer); g_ptr_array_add (array, pointer);
} }
/** /**
* @brief Terminate an array. * @brief Terminate an array.
* *
* @param[in] array Array. * @param[in] array Array.
*/ */
void void
array_terminate (array_t * array) array_terminate (array_t *array)
{ {
if (array) if (array)
g_ptr_array_add (array, NULL); g_ptr_array_add (array, NULL);
} }
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)