PERFORCE change 165130 for review

David Forsythe dforsyth at FreeBSD.org
Thu Jun 25 05:58:26 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165130

Change 165130 by dforsyth at squirrel on 2009/06/25 05:57:24

	A few changes, mostly to reflect the existance of pkg_sub, even it's
	not used yet.

Affected files ...

.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#26 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#21 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#16 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb.c#8 edit

Differences ...

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#26 (text+ko) ====

@@ -338,6 +338,13 @@
 	if (p == NULL)
 		arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT);
 	
+	free(p->ident);
+	free(p->comment);
+	free(p->contents);
+	free(p->description);
+	free(p->display);
+	free(p->mtree_dirs);
+	free(p->required_by);
 	p->ident = NULL;
 	p->comment = NULL;
 	p->contents = NULL;

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#21 (text+ko) ====

@@ -48,7 +48,7 @@
 }
 
 void
-pkg_plist_free(struct pkg_plist *pl)
+pkg_plist_delete(struct pkg_plist *pl)
 {
 	/* TODO: Write this function. */
 #if 0

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#16 (text+ko) ====

@@ -128,7 +128,7 @@
 
 void set_parse_state_default(struct parse_state *st);
 
-void pkg_plist_free(struct pkg_plist *pl);
+void pkg_plist_delete(struct pkg_plist *pl);
 
 /* pkg_dep */
 void pkg_plist_pkg_dep_list_init(struct pkg_plist *pl);

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb.c#8 (text+ko) ====

@@ -13,6 +13,7 @@
 #include "pkgdb_private.h"
 #include "pkgdb_hierdb.h"
 #include "pkgdb_hierdb_pkgdb_sub.h"
+#include "pkg_sub.h"
 
 int
 pkgdb_hierdb_db_open(struct pkgdb *db, const char *db_root)
@@ -20,7 +21,7 @@
 	int s;
 	struct stat sb;
 #if 0
-	if (!VALID_DB(db))a
+	if (!VALID_DB(db))
 #endif
 
 	if (db == NULL)
@@ -59,6 +60,9 @@
 	struct pkgdb_sub *sub;
 	struct dirent **ents;
 #if 0
+	struct pkg_dir *pkg_list;
+#endif
+#if 0
 	if (!VALID_DB(db))
 #endif
 	if (db == NULL)
@@ -69,6 +73,25 @@
 	c = scandir(db->db_root, &ents, subdir_sel, alphasort);
 	if (c < 1)
 		return (NOT_OK | MEMORY_ERR);
+
+#if 0
+	pkg_list = calloc(c, sizeof(*pkg_list));
+	if (pkg_list = NULL)
+		return (NOT_OK | MEMORY_ERR);
+
+	for i = 0, cnt = 0; i < c; ++i) {
+		status |= pkg_sub_init(db, pkg_list[i], ents[i]->d_name);
+		if (PKG_SUB_MEMORY_ERR(status)) {
+			pkgdb_pkg_sub_list_free(db);
+			for (; i < c; ++i)
+				free(ents[i]);
+			free(ents);
+			return (PKGDB_NOT_OK | PKGDB_MEMORY_ERR);
+		}
+		free(ents[i]);
+	}
+	free(ents);
+#endif
 	
 	pkgdb_pkgdb_sub_list_init(db);	
 	for (i = 0, cnt = 0; i < c; ++i) {


More information about the p4-projects mailing list