From 58fa286972b1001000e6ee933f14466c23a36f1b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 9 Aug 2012 17:06:09 -0500 Subject: [PATCH] fragment: add pkg_fragment_lookup(). --- fragment.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fragment.c b/fragment.c index 372f200..f7d4c8f 100644 --- a/fragment.c +++ b/fragment.c @@ -58,8 +58,8 @@ pkg_fragment_add(pkg_fragment_t *head, const char *string) return pkg_fragment_append(head, frag); } -bool -pkg_fragment_exists(pkg_fragment_t *head, pkg_fragment_t *base) +static inline pkg_fragment_t * +pkg_fragment_lookup(pkg_fragment_t *head, pkg_fragment_t *base) { pkg_fragment_t *node; @@ -69,10 +69,16 @@ pkg_fragment_exists(pkg_fragment_t *head, pkg_fragment_t *base) continue; if (!strcmp(base->data, node->data)) - return true; + return node; } - return false; + return NULL; +} + +bool +pkg_fragment_exists(pkg_fragment_t *head, pkg_fragment_t *base) +{ + return pkg_fragment_lookup(head, base) != NULL; } pkg_fragment_t *