Commit eabb208b authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

added g_array_insert_vals() to insert elements at an arbitrary index, and

Mon Nov 23 10:03:58 1998  Owen Taylor  <otaylor@gtk.org>

	* glib.h garray.[ch]: added g_array_insert_vals() to
	insert elements at an arbitrary index, and
	g_array_insert_val() macro.
parent 70a6dbff
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
Mon Nov 23 10:03:58 1998 Owen Taylor <otaylor@gtk.org>
* glib.h garray.[ch]: added g_array_insert_vals() to
insert elements at an arbitrary index, and
g_array_insert_val() macro.
Sun Nov 22 17:07:03 1998 Tim Janik <timj@gtk.org>
* glib.h:
......
......@@ -112,6 +112,27 @@ g_array_prepend_vals (GArray *farray,
return farray;
}
GArray*
g_array_insert_vals (GArray *farray,
guint index,
gconstpointer data,
guint len)
{
GRealArray *array = (GRealArray*) farray;
g_array_maybe_expand (array, len);
g_memmove (array->data + array->elt_size * (len + index),
array->data + array->elt_size * index,
array->elt_size * (array->len - index));
memcpy (array->data + array->elt_size * index, data, len * array->elt_size);
array->len += len;
return farray;
}
GArray*
g_array_set_size (GArray *farray,
guint length)
......
......@@ -1644,6 +1644,7 @@ void g_string_sprintfa (GString *string,
#define g_array_append_val(a,v) g_array_append_vals(a,&v,1)
#define g_array_prepend_val(a,v) g_array_prepend_vals(a,&v,1)
#define g_array_insert_val(a,i,v) g_array_prepend_vals(a,i,&v,1)
#define g_array_index(a,t,i) (((t*)a->data)[i])
GArray* g_array_new (gboolean zero_terminated,
......@@ -1657,6 +1658,10 @@ GArray* g_array_append_vals (GArray *array,
GArray* g_array_prepend_vals (GArray *array,
gconstpointer data,
guint len);
GArray* g_array_insert_vals (GArray *array,
guint index,
gconstpointer data,
guint len);
GArray* g_array_set_size (GArray *array,
guint length);
GArray* g_array_remove_index (GArray *array,
......
......@@ -112,6 +112,27 @@ g_array_prepend_vals (GArray *farray,
return farray;
}
GArray*
g_array_insert_vals (GArray *farray,
guint index,
gconstpointer data,
guint len)
{
GRealArray *array = (GRealArray*) farray;
g_array_maybe_expand (array, len);
g_memmove (array->data + array->elt_size * (len + index),
array->data + array->elt_size * index,
array->elt_size * (array->len - index));
memcpy (array->data + array->elt_size * index, data, len * array->elt_size);
array->len += len;
return farray;
}
GArray*
g_array_set_size (GArray *farray,
guint length)
......
......@@ -1644,6 +1644,7 @@ void g_string_sprintfa (GString *string,
#define g_array_append_val(a,v) g_array_append_vals(a,&v,1)
#define g_array_prepend_val(a,v) g_array_prepend_vals(a,&v,1)
#define g_array_insert_val(a,i,v) g_array_prepend_vals(a,i,&v,1)
#define g_array_index(a,t,i) (((t*)a->data)[i])
GArray* g_array_new (gboolean zero_terminated,
......@@ -1657,6 +1658,10 @@ GArray* g_array_append_vals (GArray *array,
GArray* g_array_prepend_vals (GArray *array,
gconstpointer data,
guint len);
GArray* g_array_insert_vals (GArray *array,
guint index,
gconstpointer data,
guint len);
GArray* g_array_set_size (GArray *array,
guint length);
GArray* g_array_remove_index (GArray *array,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment