From 698358e9d499d82fed697b0d68761582cfe3e73d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 29 Jul 2012 03:49:56 -0500 Subject: [PATCH] queue: new file --- Makefile.in | 2 +- main.c | 18 ------------------ pkg.h | 8 ++++++++ queue.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 queue.c diff --git a/Makefile.in b/Makefile.in index 3086304..9b99656 100644 --- a/Makefile.in +++ b/Makefile.in @@ -11,7 +11,7 @@ pkgconfigdir = @PKGCONFIGDIR@ CC = @CC@ PROG = pkgconf@EXEEXT@ -SRCS = main.c pkg.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fileio.c tuple.c dependency.c +SRCS = main.c pkg.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fileio.c tuple.c dependency.c queue.c OBJS = ${SRCS:.c=.o} CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ diff --git a/main.c b/main.c index ece8dc2..80cc357 100644 --- a/main.c +++ b/main.c @@ -223,24 +223,6 @@ check_uninstalled(pkg_t *pkg, void *data, unsigned int flags) *retval = EXIT_SUCCESS; } -typedef struct pkg_queue_ { - struct pkg_queue_ *prev, *next; - char *package; -} pkg_queue_t; - -static pkg_queue_t * -pkg_queue_push(pkg_queue_t *parent, const char *package) -{ - pkg_queue_t *pkgq = calloc(sizeof(pkg_queue_t), 1); - - pkgq->package = strdup(package); - pkgq->prev = parent; - if (pkgq->prev != NULL) - pkgq->prev->next = pkgq; - - return pkgq; -} - int pkg_queue_walk(pkg_queue_t *head) { diff --git a/pkg.h b/pkg.h index 651d174..96fd31f 100644 --- a/pkg.h +++ b/pkg.h @@ -72,6 +72,11 @@ struct pkg_tuple_ { char *value; }; +typedef struct pkg_queue_ { + struct pkg_queue_ *prev, *next; + char *package; +} pkg_queue_t; + #define PKG_PROPF_NONE 0x0 #define PKG_PROPF_VIRTUAL 0x1 @@ -166,4 +171,7 @@ void pkg_tuple_define_global(const char *kv); /* main.c */ extern FILE *error_msgout; +/* queue.c */ +pkg_queue_t *pkg_queue_push(pkg_queue_t *parent, const char *package); + #endif diff --git a/queue.c b/queue.c new file mode 100644 index 0000000..277b3f9 --- /dev/null +++ b/queue.c @@ -0,0 +1,30 @@ +/* + * queue.c + * compilation of a list of packages into a world dependency set + * + * Copyright (c) 2012 pkgconf authors (see AUTHORS). + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * This software is provided 'as is' and without any warranty, express or + * implied. In no event shall the authors be liable for any damages arising + * from the use of this software. + */ + +#include "pkg.h" +#include "bsdstubs.h" + +pkg_queue_t * +pkg_queue_push(pkg_queue_t *parent, const char *package) +{ + pkg_queue_t *pkgq = calloc(sizeof(pkg_queue_t), 1); + + pkgq->package = strdup(package); + pkgq->prev = parent; + if (pkgq->prev != NULL) + pkgq->prev->next = pkgq; + + return pkgq; +}