Hi Ben and thanks for letting me know about "x" prefix nomenclature, I was not aware about it. Thanks also for suggesting more appropriate function name, it much more descriptive. I am sending V2 patch
Signed-off-by: Damijan Skvarc <[email protected]> --- lib/util.c | 12 ++++++++++++ lib/util.h | 1 + 2 files changed, 13 insertions(+) diff --git a/lib/util.c b/lib/util.c index 830e145..5b0b477 100644 --- a/lib/util.c +++ b/lib/util.c @@ -321,6 +321,18 @@ free_cacheline(void *p) free_size_align(p); } +/* free array of char pointers and array itself */ +void +free_strings(char **strs, size_t size) +{ + size_t i; + + for (i = 0; i < size; i++) { + free(strs[i]); + } + free(strs); +} + void * xmalloc_pagealign(size_t size) { diff --git a/lib/util.h b/lib/util.h index 7ad8758..fc989ce 100644 --- a/lib/util.h +++ b/lib/util.h @@ -163,6 +163,7 @@ void *x2nrealloc(void *p, size_t *n, size_t s); void *xmalloc_cacheline(size_t) MALLOC_LIKE; void *xzalloc_cacheline(size_t) MALLOC_LIKE; void free_cacheline(void *); +void free_strings(char **, size_t); void ovs_strlcpy(char *dst, const char *src, size_t size); void ovs_strzcpy(char *dst, const char *src, size_t size); -- 2.7.4 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
