From 219a1b2ee8f4c3c2caf57e79bcb9780e32da7155 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Tue, 22 Apr 2008 08:16:26 +0000 Subject: Overwriting of bb files, apk_create (from old apk-tools), chdir changes, other stuff. --- src/apk_defines.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/apk_defines.h') diff --git a/src/apk_defines.h b/src/apk_defines.h index c9c64f5..d6557a2 100644 --- a/src/apk_defines.h +++ b/src/apk_defines.h @@ -44,9 +44,9 @@ typedef struct md5_ctx csum_ctx_t; #define csum_finish(ctx, buf) md5_finish(ctx, buf) #endif -extern int apk_quiet; +extern int apk_cwd_fd, apk_quiet; -#define apk_error(args...) if (!apk_quiet) { apk_log("ERROR: ", args); } +#define apk_error(args...) apk_log("ERROR: ", args); #define apk_warning(args...) if (!apk_quiet) { apk_log("WARNING: ", args); } #define apk_message(args...) if (!apk_quiet) { apk_log(NULL, args); } @@ -101,12 +101,18 @@ static inline int hlist_hashed(const struct hlist_node *n) static inline void __hlist_del(struct hlist_node *n, struct hlist_node **pprev) { *pprev = n->next; + n->next = NULL; } -static inline void hlist_del(struct hlist_node *n, struct hlist_node **pprev) +static inline void hlist_del(struct hlist_node *n, struct hlist_head *h) { - __hlist_del(n, pprev); - n->next = LIST_POISON1; + struct hlist_node **pp = &h->first; + + while (*pp != NULL && *pp != LIST_END && *pp != n) + pp = &(*pp)->next; + + if (*pp == n) + __hlist_del(n, pp); } static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) @@ -123,6 +129,16 @@ static inline void hlist_add_after(struct hlist_node *n, struct hlist_node **pre *prev = n; } +static inline struct hlist_node **hlist_tail_ptr(struct hlist_head *h) +{ + struct hlist_node *n = h->first; + if (n == NULL || n == LIST_END) + return &h->first; + while (n->next != NULL && n->next != LIST_END) + n = n->next; + return &n->next; +} + #define hlist_entry(ptr, type, member) container_of(ptr,type,member) #define hlist_for_each(pos, head) \ -- cgit v1.2.3-60-g2f50