The following commit has been merged in the master branch:
commit ecd886da6390f9c10b8a36d27323f0bc570e97f3
Author: Guillem Jover <[email protected]>
Date: Wed Mar 2 06:33:06 2011 +0100
dpkg: Refactor match_node allocation into new match_node_new()
diff --git a/src/processarc.c b/src/processarc.c
index 7b463ef..4151258 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -172,6 +172,19 @@ struct match_node {
char *filename;
};
+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)
{
@@ -921,11 +934,7 @@ void process_archive(const char *filename) {
* might influence the current readdir(), the just renamed file might
* be returned a second time as it's actually a new file from the
* point of view of the filesystem. */
- match_node = m_malloc(sizeof(*match_node));
- match_node->next = match_head;
- match_node->filetype = m_strdup(p);
- match_node->filename = m_strdup(infofnvb.buf);
- match_head = match_node;
+ match_head = match_node_new(infofnvb.buf, p, match_head);
}
pop_cleanup(ehflag_normaltidy); /* closedir */
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]