Commit 4a9c25a0 authored by Bernhard Link's avatar Bernhard Link

Added strlist_init_n

parent f299d54a
......@@ -39,6 +39,17 @@ int strlist_in(const struct strlist *strlist,const char *element) {
return 0;
}
retvalue strlist_init_n(int startsize,struct strlist *strlist) {
assert(strlist != NULL && startsize >= 0);
strlist->count = 0;
strlist->size = startsize;
strlist->values = malloc(startsize*sizeof(char *));
if( startsize > 0 && strlist->values == NULL )
return RET_ERROR_OOM;
return RET_OK;
}
retvalue strlist_init(struct strlist *strlist) {
assert(strlist != NULL);
......
......@@ -12,6 +12,7 @@ struct strlist {
};
retvalue strlist_init(struct strlist *strlist);
retvalue strlist_init_n(int startsize,struct strlist *strlist);
void strlist_done(struct strlist *strlist);
/* add a string, will get property of the strlist and free'd by it */
......
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