socsvn commit: r256749 - soc2013/mattbw/backend/query
mattbw at FreeBSD.org
mattbw at FreeBSD.org
Fri Aug 30 19:23:58 UTC 2013
Author: mattbw
Date: Fri Aug 30 19:23:57 2013
New Revision: 256749
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256749
Log:
Fix GetDepends/GetRequires availability error.
This was due to an inverted comparison to NULL.
In addition, some of the GetDepends/GetRequires code has been factored out
into another function.
Modified:
soc2013/mattbw/backend/query/depends.c
Modified: soc2013/mattbw/backend/query/depends.c
==============================================================================
--- soc2013/mattbw/backend/query/depends.c Fri Aug 30 18:29:25 2013 (r256748)
+++ soc2013/mattbw/backend/query/depends.c Fri Aug 30 19:23:57 2013 (r256749)
@@ -30,8 +30,9 @@
#include "id.h" /* query_id, query_id_... */
#include "match.h" /* query_match_... */
-static struct pkg *id_to_package(gchar *package_id, struct pkgdb *db, unsigned int load_flags);
+static bool emit_dependency(struct pkg_dep *dep, PkBackend *backend, struct pkgdb *db, unsigned int load_flags);
static gchar *dep_to_package_id(struct pkg_dep *dep);
+static struct pkg *id_to_package(gchar *package_id, struct pkgdb *db, unsigned int load_flags);
bool
query_depends_emit(PkBackend *backend, struct pkg *pkg, depends_get_ptr get,
@@ -48,36 +49,43 @@
dep = NULL;
while (get(pkg, &dep) == EPKG_OK) {
- gchar *package_id;
- struct pkg *package;
-
+ success = emit_dependency(dep, backend, db, load_flags);
+ if (!success) {
+ break;
+ }
+ }
- package_id = dep_to_package_id(dep);
+ return success;
+}
- /*
- * Does this dependency correspond to a package in our
- * database?
- */
-
- package = id_to_package(package_id, db, load_flags);
- if (package == NULL) {
- emit_package(pkg, backend,
- pkgutils_pkg_current_state(pkg));
- success = true;
- } else {
- success = (pk_backend_package(backend,
- PK_INFO_ENUM_UNKNOWN,
- package_id,
- "Could not find this package."));
- }
+static bool
+emit_dependency(struct pkg_dep *dep, PkBackend *backend, struct pkgdb *db,
+ unsigned int load_flags)
+{
+ bool success;
+ gchar *package_id;
+ struct pkg *package;
- g_free(package_id);
+ package_id = dep_to_package_id(dep);
- if (!success) {
- break;
- }
+ /*
+ * Does this dependency correspond to a package in our
+ * database?
+ */
+
+ package = id_to_package(package_id, db, load_flags);
+ if (package != NULL) {
+ emit_package(package, backend,
+ pkgutils_pkg_current_state(package));
+ success = true;
+ } else {
+ success = (pk_backend_package(backend,
+ PK_INFO_ENUM_UNKNOWN,
+ package_id,
+ "Could not find this package."));
}
+ g_free(package_id);
return success;
}
More information about the svn-soc-all
mailing list