The following commit has been merged in the master branch:
commit 79b9f3afb18513027e4e48d3e08a540c8eb2fb0c
Author: Guillem Jover <[email protected]>
Date: Thu Oct 27 02:10:50 2011 +0200
dpkg: Move match_node functions into a new file-match module
diff --git a/src/Makefile.am b/src/Makefile.am
index e29abf3..2896773 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,7 @@ dpkg_SOURCES = \
enquiry.c \
errors.c \
filesdb.c filesdb.h \
+ file-match.c file-match.h \
filters.c filters.h \
infodb.c infodb.h \
divertdb.c \
diff --git a/lib/dpkg/glob.c b/src/file-match.c
similarity index 60%
copy from lib/dpkg/glob.c
copy to src/file-match.c
index 92da6a3..0262c8f 100644
--- a/lib/dpkg/glob.c
+++ b/src/file-match.c
@@ -1,8 +1,8 @@
/*
- * libdpkg - Debian packaging suite library routines
- * glob.c - file globing functions
+ * dpkg - main program for package management
+ * file-match.c - file name/type match tracking functions
*
- * Copyright © 2009, 2010 Guillem Jover <[email protected]>
+ * Copyright © 2011 Guillem Jover <[email protected]>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,27 +24,26 @@
#include <stdlib.h>
#include <dpkg/dpkg.h>
-#include <dpkg/glob.h>
-void
-glob_list_prepend(struct glob_node **list, char *pattern)
+#include "file-match.h"
+
+struct match_node *
+match_node_new(const char *name, const char *type, struct match_node *next)
{
- struct glob_node *node;
+ struct match_node *node;
node = m_malloc(sizeof(*node));
- node->pattern = pattern;
- node->next = *list;
- *list = node;
+ node->next = next;
+ node->filename = m_strdup(name);
+ node->filetype = m_strdup(type);
+
+ return node;
}
void
-glob_list_free(struct glob_node *head)
+match_node_free(struct match_node *node)
{
- while (head) {
- struct glob_node *node = head;
-
- head = head->next;
- free(node->pattern);
- free(node);
- }
+ free(node->filetype);
+ free(node->filename);
+ free(node);
}
diff --git a/src/infodb.h b/src/file-match.h
similarity index 65%
copy from src/infodb.h
copy to src/file-match.h
index 8ab5fe5..2331d2e 100644
--- a/src/infodb.h
+++ b/src/file-match.h
@@ -1,6 +1,6 @@
/*
* dpkg - main program for package management
- * infodb.h - package control information database
+ * file-match.h - file name/type match tracking functions
*
* Copyright © 2011 Guillem Jover <[email protected]>
*
@@ -18,17 +18,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef DPKG_INFODB_H
-#define DPKG_INFODB_H
+#ifndef DPKG_FILE_MATCH_H
+#define DPKG_FILE_MATCH_H
-#include <stdbool.h>
+struct match_node {
+ struct match_node *next;
+ char *filetype;
+ char *filename;
+};
-#include <dpkg/dpkg-db.h>
+struct match_node *
+match_node_new(const char *name, const char *type, struct match_node *next);
+void
+match_node_free(struct match_node *node);
-bool pkg_infodb_has_file(struct pkginfo *pkg, const char *name);
-
-typedef void pkg_infodb_file_func(const char *filename, const char *filetype);
-
-void pkg_infodb_foreach(struct pkginfo *pkg, pkg_infodb_file_func *func);
-
-#endif /* DPKG_INFODB_H */
+#endif /* DPKG_FILE_MATCH_H */
diff --git a/src/processarc.c b/src/processarc.c
index d2384a7..af9d48b 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -51,6 +51,7 @@
#include <dpkg/triglib.h>
#include "filesdb.h"
+#include "file-match.h"
#include "infodb.h"
#include "main.h"
#include "archives.h"
@@ -208,35 +209,8 @@ push_conflictor(struct pkginfo *pkg, struct pkginfo
*pkg_fixbyrm)
conflictor[cflict_index++] = pkg_fixbyrm;
}
-struct match_node {
- struct match_node *next;
- char *filetype;
- char *filename;
-};
-
static struct match_node *match_head = NULL;
-static struct match_node *
-match_node_new(const char *name, const char *type, struct match_node *next)
-{
- struct match_node *node;
-
- node = m_malloc(sizeof(*node));
- node->next = next;
- node->filename = m_strdup(name);
- node->filetype = m_strdup(type);
-
- return node;
-}
-
-static void
-match_node_free(struct match_node *node)
-{
- free(node->filetype);
- free(node->filename);
- free(node);
-}
-
static void
pkg_infodb_update_file(const char *filename, const char *filetype)
{
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]