From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61738 invoked by alias); 16 May 2017 12:00:56 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 55195 invoked by uid 89); 16 May 2017 12:00:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: rgout04.bt.lon5.cpcloud.co.uk Received: from rgout0404.bt.lon5.cpcloud.co.uk (HELO rgout04.bt.lon5.cpcloud.co.uk) (65.20.0.217) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 May 2017 12:00:51 +0000 X-OWM-Source-IP: 86.166.190.52 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=8/50,refid=2.7.2:2017.5.13.91815:17:8.707,ip=,rules=NO_URI_FOUND, NO_CTA_URI_FOUND, NO_MESSAGE_ID, NO_URI_HTTPS, TO_MALFORMED Received: from localhost.localdomain (86.166.190.52) by rgout04.bt.lon5.cpcloud.co.uk (9.0.019.13-1) (authenticated as jonturney@btinternet.com) id 58482DA21100CF42; Tue, 16 May 2017 13:00:31 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 14/15] Make PackageDepends a type Date: Tue, 16 May 2017 12:00:00 -0000 Message-Id: <20170516115744.216288-5-jon.turney@dronecode.org.uk> In-Reply-To: <20170516115744.216288-1-jon.turney@dronecode.org.uk> References: <20170516114900.168120-1-jon.turney@dronecode.org.uk> <20170516115744.216288-1-jon.turney@dronecode.org.uk> X-SW-Source: 2017-05/txt/msg00115.txt.bz2 Make PackageDepends a type, rather than repeating it's definition everywhere. --- IniDBBuilderPackage.h | 2 +- Makefile.am | 1 + desktop.cc | 1 - package_db.cc | 2 +- package_depends.h | 21 +++++++++++++++++++++ package_version.cc | 8 ++++---- package_version.h | 9 +++++---- prereq.cc | 4 ++-- 8 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 package_depends.h diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h index ef1a6bf..4df1bdb 100644 --- a/IniDBBuilderPackage.h +++ b/IniDBBuilderPackage.h @@ -72,7 +72,7 @@ private: packagemeta *csp; packageversion cspv; PackageSpecification *currentSpec; - std::vector *currentNodeList; + PackageDepends *currentNodeList; int trust; IniParseFeedback const &_feedback; }; diff --git a/Makefile.am b/Makefile.am index 7d5e1e3..f0f36f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -202,6 +202,7 @@ inilint_SOURCES = \ nio-http.h \ package_db.cc \ package_db.h \ + package_depends.h \ package_meta.cc \ package_meta.h \ package_source.cc \ diff --git a/desktop.cc b/desktop.cc index 81278dd..24908f8 100644 --- a/desktop.cc +++ b/desktop.cc @@ -39,7 +39,6 @@ #include "filemanip.h" #include "io_stream.h" #include "getopt++/BoolOption.h" -#include "PackageSpecification.h" #include "LogFile.h" static BoolOption NoShortcutsOption (false, 'n', "no-shortcuts", "Disable creation of desktop and start menu shortcuts"); diff --git a/package_db.cc b/package_db.cc index e97eea1..3978421 100644 --- a/package_db.cc +++ b/package_db.cc @@ -312,7 +312,7 @@ ConnectedLoopFinder::visit(packagemeta *nodeToVisit) nodesInStronglyConnectedComponent.push(nodeToVisit); /* walk through each node */ - std::vector ::const_iterator dp = nodeToVisit->installed.depends()->begin(); + PackageDepends::const_iterator dp = nodeToVisit->installed.depends()->begin(); while (dp != nodeToVisit->installed.depends()->end()) { /* check for an installed match */ diff --git a/package_depends.h b/package_depends.h new file mode 100644 index 0000000..05e0dc6 --- /dev/null +++ b/package_depends.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2017 Jon Turney + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * A copy of the GNU General Public License can be found at + * http://www.gnu.org/ + * + */ + +#ifndef PACKAGE_DEPENDS_H +#define PACKAGE_DEPENDS_H + +#include + +typedef std::vector PackageDepends; + +#endif // PACKAGE_DEPENDS_H diff --git a/package_version.cc b/package_version.cc index cd2d509..6a903c5 100644 --- a/package_version.cc +++ b/package_version.cc @@ -229,13 +229,13 @@ packageversion::setSourcePackageSpecification (PackageSpecification const &spec) data->setSourcePackageSpecification(spec); } -vector * +PackageDepends * packageversion::depends() { return &data->depends; } -const vector * +const PackageDepends * packageversion::depends() const { return &data->depends; @@ -414,13 +414,13 @@ _packageversion::scripts() } void -dumpAndList (std::vector const *currentList, +dumpAndList (PackageDepends const *currentList, std::ostream &logger) { if (currentList) { Log (LOG_BABBLE) << "( "; - std::vector ::const_iterator i = currentList->begin(); + PackageDepends::const_iterator i = currentList->begin(); while (true) { if (i == currentList->end()) break; diff --git a/package_version.h b/package_version.h index 2f277bf..ff16eb8 100644 --- a/package_version.h +++ b/package_version.h @@ -43,6 +43,7 @@ class CategoryList; #include "package_source.h" #include "PackageSpecification.h" #include "PackageTrust.h" +#include "package_depends.h" #include "script.h" #include @@ -110,8 +111,8 @@ public: void setSourcePackageSpecification (PackageSpecification const &); /* invariant: these never return NULL */ - std::vector *depends(); - const std::vector *depends() const; + PackageDepends *depends(); + const PackageDepends *depends() const; bool picked() const; /* true if this version is to be installed */ void pick(bool, packagemeta *); /* trigger an install/reinsall */ @@ -171,7 +172,7 @@ public: virtual PackageSpecification & sourcePackageSpecification (); virtual void setSourcePackageSpecification (PackageSpecification const &); - std::vector depends; + PackageDepends depends; virtual void pick(bool const &newValue) { picked = newValue;} bool picked; /* non zero if this version is to be installed */ @@ -196,6 +197,6 @@ protected: }; // not sure where this belongs :}. -void dumpAndList (std::vector const *currentList, std::ostream &); +void dumpAndList (PackageDepends const *currentList, std::ostream &); #endif /* SETUP_PACKAGE_VERSION_H */ diff --git a/prereq.cc b/prereq.cc index 7477f79..eb8e21f 100644 --- a/prereq.cc +++ b/prereq.cc @@ -211,10 +211,10 @@ PrereqChecker::isMet () // Fetch the dependencies of the package. This assumes that the // dependencies of all versions are all the same. - const std::vector *deps = pack->curr.depends (); + const PackageDepends *deps = pack->curr.depends (); // go through the package's dependencies - for (std::vector ::const_iterator d = + for (PackageDepends::const_iterator d = deps->begin (); d != deps->end (); ++d) { PackageSpecification *dep_spec = *d; -- 2.12.3