libgimpbase: add an own struct for GimpStringArray

instead of re-using the GimpArray struct, which was confusing
particularly because of the meaning of the "length" member.
This commit is contained in:
Michael Natterer 2019-09-04 19:21:45 +02:00
parent 582930aa61
commit 738b17063a
2 changed files with 11 additions and 4 deletions

View File

@ -860,11 +860,11 @@ gimp_string_array_new (const gchar **data,
for (i = 0; i < length; i++)
tmp[i] = g_strdup (data[i]);
array->data = (guint8 *) tmp;
array->data = tmp;
}
else
{
array->data = (guint8 *) data;
array->data = (gchar **) data;
}
array->length = length;
@ -898,7 +898,7 @@ gimp_string_array_free (GimpStringArray *array)
{
if (! array->static_data)
{
gchar **tmp = (gchar **) array->data;
gchar **tmp = array->data;
gint i;
for (i = 0; i < array->length; i++)

View File

@ -306,7 +306,14 @@ void gimp_value_take_float_array (GValue *value,
* GIMP_TYPE_STRING_ARRAY
*/
typedef struct _GimpArray GimpStringArray;
typedef struct _GimpStringArray GimpStringArray;
struct _GimpStringArray
{
gchar **data;
gsize length;
gboolean static_data;
};
GimpStringArray * gimp_string_array_new (const gchar **data,
gsize length,