Commit 0043048b authored by Pekka Pessi's avatar Pekka Pessi

su_strlst.c, su_strlst.h: always usize_t as index type.

darcs-hash:20061012131325-65a35-deb20e9b855722741aa88471f99ba0683693dd98.gz
parent 755438c4
......@@ -84,11 +84,11 @@ SU_DLL char const *su_slvprintf(su_strlst_t *self, char const *fmt, va_list ap);
SU_DLL char const *su_strlst_item(su_strlst_t const *, usize_t i);
/** Set a numbered item to list */
SU_DLL char const *su_strlst_set_item(su_strlst_t *self, unsigned i,
SU_DLL char const *su_strlst_set_item(su_strlst_t *self, usize_t i,
char const *s);
/** Remove a numbered item from list. */
SU_DLL char const *su_strlst_remove(su_strlst_t *, unsigned i);
SU_DLL char const *su_strlst_remove(su_strlst_t *, usize_t i);
/** Concatenate list of strings to one string. */
SU_DLL char *su_strlst_join(su_strlst_t *s, su_home_t *home,
......
......@@ -53,12 +53,14 @@
* Another example, splitting a string into lines and counting the number of
* non-empty ones:
* @code
* unsigned i, n;
* usize_t i, n;
* su_strlst_t *l;
*
* l = su_strlst_split(NULL, buf, "\n");
*
* for (i = 0, nonempty = 0; i < su_strlst_len(l); i++) {
* nonempty = 0;
*
* for (i = 0; i < su_strlst_len(l); i++) {
* n = strcspn(su_strlst_item(l, i), " \t");
* if (su_strlst_item(l, i)[n])
* nonempty++;
......@@ -473,7 +475,7 @@ char const *su_strlst_item(su_strlst_t const *self, usize_t i)
* Pointer to string, if item exists, or NULL if index is out of bounds or
* list does not exist.
*/
char const *su_strlst_set_item(su_strlst_t *self, unsigned i, char const *s)
char const *su_strlst_set_item(su_strlst_t *self, usize_t i, char const *s)
{
char const *old = NULL;
......@@ -504,7 +506,7 @@ char const *su_strlst_set_item(su_strlst_t *self, unsigned i, char const *s)
* Pointer to string, if item exists, or NULL if index is out of bounds or
* list does not exist.
*/
SU_DLL char const *su_strlst_remove(su_strlst_t *self, unsigned i)
SU_DLL char const *su_strlst_remove(su_strlst_t *self, usize_t i)
{
if (self && i < self->sl_len) {
char const *s = self->sl_list[i];
......
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