diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-05-29 23:38:18 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-06-06 18:16:12 +0200 |
commit | f428cb8a3a9cef3a1f68be6434f8db6fa9b693ef (patch) | |
tree | a9c9d4c739f9f9e8aa427e3e252c5a892513382c /lib/command.c | |
parent | lib: fix static analysis issues, use regfree() (diff) | |
download | frr-f428cb8a3a9cef3a1f68be6434f8db6fa9b693ef.tar.xz frr-f428cb8a3a9cef3a1f68be6434f8db6fa9b693ef.zip |
lib: add vector_compact(), use after str splits
* Add function to move all data to the start of a vector by shifting
over contiguous empty slots
* Use this function to remove empty slots leftover after
frrstr_filter_vec
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r-- | lib/command.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c index edf7348ba..b7690eac4 100644 --- a/lib/command.c +++ b/lib/command.c @@ -290,10 +290,12 @@ vector cmd_make_strvec(const char *string) for (unsigned int i = 0; i < vector_active(result); i++) { if (strlen(vector_slot(result, i)) == 0) { XFREE(MTYPE_TMP, vector_slot(result, i)); - vector_remove(result, i); - --i; + vector_unset(result, i); } } + + vector_compact(result); + return result; } |