diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-05-30 16:21:48 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-05-30 16:21:48 +0000 |
commit | 1955dcd47b956da220497c9818c67a8ca58cca35 (patch) | |
tree | 283439c3c1184482352e5d3f70390bc603c2fa00 /src/vector.h | |
parent | c3eaebd1c5a3ba3be5b71c0ac35d1e8938242dbd (diff) | |
download | tinyproxy-1955dcd47b956da220497c9818c67a8ca58cca35.tar.gz tinyproxy-1955dcd47b956da220497c9818c67a8ca58cca35.zip |
(vector_getentry): Changed the API to return the data pointer and have
the length returned in a argument variable pointer. This should be a
more natural way of using the function.
Diffstat (limited to '')
-rw-r--r-- | src/vector.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/vector.h b/src/vector.h index 1600ce8..c125e85 100644 --- a/src/vector.h +++ b/src/vector.h @@ -1,4 +1,4 @@ -/* $Id: vector.h,v 1.3 2003-05-29 21:07:22 rjkaes Exp $ +/* $Id: vector.h,v 1.4 2003-05-30 16:21:47 rjkaes Exp $ * * 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 @@ -55,8 +55,8 @@ extern int vector_append(vector_t vector, void *data, ssize_t len); extern int vector_prepend(vector_t vector, void *data, ssize_t len); /* - * A pointer to the data at position "pos" (zero based) is returned in the - * "data" pointer. If the vector is out of bound, data is set to NULL. + * A pointer to the data at position "pos" (zero based) is returned and the + * size pointer contains the length of the data stored. * * The pointer points to the actual data in the vector, so you have * the power to modify the data, but do it responsibly since the @@ -65,10 +65,12 @@ extern int vector_prepend(vector_t vector, void *data, ssize_t len); * likely mess up the "length" parameter of the data.) However, DON'T * try to realloc or free the data; doing so will break the vector. * - * Returns: negative upon an error - * length of data if position is valid + * If "size" is NULL the size of the data is not returned. + * + * Returns: NULL on error + * valid pointer to data */ -extern ssize_t vector_getentry(vector_t vector, size_t pos, void **data); +extern void* vector_getentry(vector_t vector, size_t pos, size_t* size); /* * Returns the number of enteries (or the length) of the vector. |