/*
* This file is part of DisOrder.
- * Copyright (C) 2004, 2007, 2008 Richard Kettlewell
+ * Copyright (C) 2004, 2007-2009 Richard Kettlewell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+/** @file lib/vector.c
+ * @brief Dynamic array utilities
+ */
#include "common.h"
#include <stddef.h>
}
}
+/** @brief Free a string list */
+void free_strings(int nvec, char **vec) {
+ for(int n = 0; n < nvec; ++n)
+ xfree(vec[n]);
+ xfree(vec);
+}
+
+/** @brief Free and re-initialize a vector */
+void vector_clear(struct vector *v) {
+ free_strings(v->nvec, v->vec);
+ vector_init(v);
+}
+
/*
Local Variables:
c-basic-offset:2