forked from ariadne/pkgconf
queue: new file
parent
91271e56c6
commit
698358e9d4
|
@ -11,7 +11,7 @@ pkgconfigdir = @PKGCONFIGDIR@
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
PROG = pkgconf@EXEEXT@
|
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}
|
OBJS = ${SRCS:.c=.o}
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
18
main.c
18
main.c
|
@ -223,24 +223,6 @@ check_uninstalled(pkg_t *pkg, void *data, unsigned int flags)
|
||||||
*retval = EXIT_SUCCESS;
|
*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
|
int
|
||||||
pkg_queue_walk(pkg_queue_t *head)
|
pkg_queue_walk(pkg_queue_t *head)
|
||||||
{
|
{
|
||||||
|
|
8
pkg.h
8
pkg.h
|
@ -72,6 +72,11 @@ struct pkg_tuple_ {
|
||||||
char *value;
|
char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct pkg_queue_ {
|
||||||
|
struct pkg_queue_ *prev, *next;
|
||||||
|
char *package;
|
||||||
|
} pkg_queue_t;
|
||||||
|
|
||||||
#define PKG_PROPF_NONE 0x0
|
#define PKG_PROPF_NONE 0x0
|
||||||
#define PKG_PROPF_VIRTUAL 0x1
|
#define PKG_PROPF_VIRTUAL 0x1
|
||||||
|
|
||||||
|
@ -166,4 +171,7 @@ void pkg_tuple_define_global(const char *kv);
|
||||||
/* main.c */
|
/* main.c */
|
||||||
extern FILE *error_msgout;
|
extern FILE *error_msgout;
|
||||||
|
|
||||||
|
/* queue.c */
|
||||||
|
pkg_queue_t *pkg_queue_push(pkg_queue_t *parent, const char *package);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue