diff options
author | Nikias Bassen | 2014-01-09 18:49:36 +0100 |
---|---|---|
committer | Nikias Bassen | 2014-01-09 18:49:36 +0100 |
commit | 61c399db59cb61118901819e0956e514dd511885 (patch) | |
tree | 8e319feb6ba1ed9f06ccd7f2bf3a03cfc60410d4 /src/utils.c | |
parent | 549da0b893d1d85b5a553a92aef8a4fecb4a602f (diff) | |
download | usbmuxd-61c399db59cb61118901819e0956e514dd511885.tar.gz usbmuxd-61c399db59cb61118901819e0956e514dd511885.tar.bz2 |
utils: add new collection_copy() function
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index 5296332..9fa4d80 100644 --- a/src/utils.c +++ b/src/utils.c @@ -124,6 +124,14 @@ int collection_count(struct collection *col) return cnt; } +void collection_copy(struct collection *dest, struct collection *src) +{ + if (!dest || !src) return; + dest->capacity = src->capacity; + dest->list = malloc(sizeof(void*) * src->capacity); + memcpy(dest->list, src->list, sizeof(void*) * src->capacity); +} + #ifndef HAVE_STPCPY /** * Copy characters from one string into another |