argvsplit: add argv_free().

feature/tap-sh
William Pitcock 2012-05-06 21:09:40 -05:00
parent 9d2bd0b66d
commit 83e7e2e733
2 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,12 @@
#include "config.h" #include "config.h"
#include "pkg.h" #include "pkg.h"
void argv_free(char **argv)
{
free(argv[0]);
free(argv);
}
int argv_split(const char *src, int *argc, char ***argv) int argv_split(const char *src, int *argc, char ***argv)
{ {
char *buf = malloc(strlen(src) + 1); char *buf = malloc(strlen(src) + 1);

1
pkg.h
View File

@ -151,6 +151,7 @@ void pkg_dependency_free(pkg_dependency_t *head);
/* argvsplit.c */ /* argvsplit.c */
int argv_split(const char *src, int *argc, char ***argv); int argv_split(const char *src, int *argc, char ***argv);
void argv_free(char **argv);
/* fragment.c */ /* fragment.c */
pkg_fragment_t *pkg_fragment_append(pkg_fragment_t *head, pkg_fragment_t *tail); pkg_fragment_t *pkg_fragment_append(pkg_fragment_t *head, pkg_fragment_t *tail);