Commit 52cf4463 authored by Bernhard Link's avatar Bernhard Link

new strlist_move

parent 7ff3be9d
......@@ -166,3 +166,18 @@ retvalue strlist_dup(struct strlist *dest,const struct strlist *orig) {
}
return RET_OK;
}
/* replace the contents of dest with those from orig, which get emptied */
void strlist_move(struct strlist *dest,struct strlist *orig) {
assert(dest != NULL && orig != NULL);
if( dest == orig )
return;
dest->size = orig->size;
dest->count = orig->count;
dest->values = orig->values;
orig->size = orig->count = 0;
orig->values = NULL;
}
......@@ -26,6 +26,8 @@ retvalue strlist_fprint(FILE *file,const struct strlist *strlist);
/* duplicate with content */
retvalue strlist_dup(struct strlist *dest,const struct strlist *orig);
/* replace the contents of dest with those from orig, which get emptied */
void strlist_move(struct strlist *dest,struct strlist *orig);
int strlist_in(const struct strlist *strlist,const char *element);
......
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