argvsplit: proper namespacing

pull/15/head
William Pitcock 2012-05-06 22:21:11 -05:00
parent cc32bbd47c
commit 1da21bd3b4
3 changed files with 8 additions and 6 deletions

View File

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

View File

@ -32,12 +32,12 @@ parse_fragment_list(pkg_t *pkg, const char *string)
char *repstr = pkg_tuple_parse(pkg->vars, string); char *repstr = pkg_tuple_parse(pkg->vars, string);
pkg_fragment_t *head = NULL; pkg_fragment_t *head = NULL;
argv_split(repstr, &argc, &argv); pkg_argv_split(repstr, &argc, &argv);
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
head = pkg_fragment_add(head, argv[i]); head = pkg_fragment_add(head, argv[i]);
argv_free(argv); pkg_argv_free(argv);
free(repstr); free(repstr);
return head; return head;

4
pkg.h
View File

@ -150,8 +150,8 @@ pkg_dependency_t *pkg_dependency_append(pkg_dependency_t *head, pkg_dependency_t
void pkg_dependency_free(pkg_dependency_t *head); void pkg_dependency_free(pkg_dependency_t *head);
/* argvsplit.c */ /* argvsplit.c */
int argv_split(const char *src, int *argc, char ***argv); int pkg_argv_split(const char *src, int *argc, char ***argv);
void argv_free(char **argv); void pkg_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);