(vector_append): Renamed the vector_insert() function to more
accurately indicate that entries are appended to the end of the vector.
This commit is contained in:
parent
4a377a712d
commit
42f9f37afc
@ -1,4 +1,4 @@
|
|||||||
/* $Id: vector.c,v 1.6 2002-05-24 04:45:32 rjkaes Exp $
|
/* $Id: vector.c,v 1.7 2003-05-29 20:47:52 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* A vector implementation. The vector can be of an arbitrary length, and
|
* A vector implementation. The vector can be of an arbitrary length, and
|
||||||
* the data for each entry is an lump of data (the size is stored in the
|
* the data for each entry is an lump of data (the size is stored in the
|
||||||
@ -97,7 +97,7 @@ vector_delete(vector_t vector)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inserts an entry into the vector. The entry is an arbitrary
|
* Appends an entry into the vector. The entry is an arbitrary
|
||||||
* collection of bytes of _len_ octets. The data is copied into the
|
* collection of bytes of _len_ octets. The data is copied into the
|
||||||
* vector, so the original data must be freed to avoid a memory leak.
|
* vector, so the original data must be freed to avoid a memory leak.
|
||||||
* The "data" must be non-NULL and the "len" must be greater than zero.
|
* The "data" must be non-NULL and the "len" must be greater than zero.
|
||||||
@ -106,7 +106,7 @@ vector_delete(vector_t vector)
|
|||||||
* negative number if there are errors
|
* negative number if there are errors
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
vector_insert(vector_t vector, void *data, ssize_t len)
|
vector_append(vector_t vector, void *data, ssize_t len)
|
||||||
{
|
{
|
||||||
struct vectorentry_s *entry;
|
struct vectorentry_s *entry;
|
||||||
|
|
||||||
|
12
src/vector.h
12
src/vector.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: vector.h,v 1.1 2002-04-07 21:29:23 rjkaes Exp $
|
/* $Id: vector.h,v 1.2 2003-05-29 20:47:51 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* A vector implementation. The vector can be of an arbritrary length, and
|
* A vector implementation. The vector can be of an arbritrary length, and
|
||||||
* the data for each entry is an lump of data (the size is stored in the
|
* the data for each entry is an lump of data (the size is stored in the
|
||||||
@ -44,15 +44,15 @@ extern vector_t vector_create(void);
|
|||||||
extern int vector_delete(vector_t vector);
|
extern int vector_delete(vector_t vector);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When you insert a piece of data into the vector, the data will be
|
* Append an entry to the end of the vector. When you insert a piece of
|
||||||
* duplicated, so you must free your copy if it was created on the
|
* data into the vector, the data will be duplicated, so you must free your
|
||||||
* heap. The data must be non-NULL and the length must be greater
|
* copy if it was created on the heap. The data must be non-NULL and the
|
||||||
* than zero.
|
* length must be greater than zero.
|
||||||
*
|
*
|
||||||
* Returns: negative on error
|
* Returns: negative on error
|
||||||
* 0 upon successful insert.
|
* 0 upon successful insert.
|
||||||
*/
|
*/
|
||||||
extern int vector_insert(vector_t vector, void *data, ssize_t len);
|
extern int vector_append(vector_t vector, void *data, ssize_t len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A pointer to the data at position "pos" (zero based) is returned in the
|
* A pointer to the data at position "pos" (zero based) is returned in the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user