[pacman-dev] [PATCH 3/5] Remove provide.c and provide.h .
This file only contained one private function : _alpm_db_whatprovides . And the public alpm_db_whatprovides was in db.c , so I moved everything there. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> --- lib/libalpm/Makefile.am | 1 - lib/libalpm/add.c | 1 - lib/libalpm/db.c | 25 +++++++++++++++++++- lib/libalpm/db.h | 3 ++ lib/libalpm/deps.c | 1 - lib/libalpm/package.c | 1 - lib/libalpm/provide.c | 58 ----------------------------------------------- lib/libalpm/provide.h | 32 -------------------------- lib/libalpm/remove.c | 1 - lib/libalpm/sync.c | 1 - lib/libalpm/trans.c | 1 - 11 files changed, 27 insertions(+), 98 deletions(-) delete mode 100644 lib/libalpm/provide.c delete mode 100644 lib/libalpm/provide.h diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index b84dcc3..6549066 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -33,7 +33,6 @@ libalpm_la_SOURCES = \ log.h log.c \ md5.h md5.c \ package.h package.c \ - provide.h provide.c \ remove.h remove.c \ server.h server.c \ sync.h sync.c \ diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 1da874a..8538d22 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -45,7 +45,6 @@ #include "backup.h" #include "package.h" #include "db.h" -#include "provide.h" #include "conflict.h" #include "deps.h" #include "remove.h" diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 80c1c12..af58387 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -41,7 +41,6 @@ #include "util.h" #include "error.h" #include "server.h" -#include "provide.h" #include "handle.h" #include "cache.h" #include "alpm.h" @@ -778,4 +777,28 @@ pmdb_t *_alpm_db_register_sync(const char *treename) return(db); } +/* return a alpm_list_t of packages in "db" that provide "package" + */ +alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package) +{ + alpm_list_t *pkgs = NULL; + alpm_list_t *lp; + + ALPM_LOG_FUNC; + + if(db == NULL || package == NULL || strlen(package) == 0) { + return(NULL); + } + + for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) { + pmpkg_t *info = lp->data; + + if(alpm_list_find_str(alpm_pkg_get_provides(info), package)) { + pkgs = alpm_list_add(pkgs, info); + } + } + + return(pkgs); +} + /* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 16e1298..5d7173b 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -56,6 +56,9 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles); pmdb_t *_alpm_db_register_local(void); pmdb_t *_alpm_db_register_sync(const char *treename); +/* Provision */ +alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package); + /* be.c, backend specific calls */ int _alpm_db_install(pmdb_t *db, const char *dbfile); int _alpm_db_open(pmdb_t *db); diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 548b643..679981c 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -36,7 +36,6 @@ #include "package.h" #include "db.h" #include "cache.h" -#include "provide.h" #include "handle.h" static pmgraph_t *_alpm_graph_new(void) diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index d992766..b6691a2 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -47,7 +47,6 @@ #include "db.h" #include "cache.h" #include "delta.h" -#include "provide.h" #include "handle.h" #include "deps.h" diff --git a/lib/libalpm/provide.c b/lib/libalpm/provide.c deleted file mode 100644 index df600be..0000000 --- a/lib/libalpm/provide.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * provide.c - * - * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#include "config.h" - -#include <stdlib.h> -#include <string.h> - -/* libalpm */ -#include "provide.h" -#include "alpm_list.h" -#include "cache.h" -#include "db.h" -#include "log.h" - -/* return a alpm_list_t of packages in "db" that provide "package" - */ -alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package) -{ - alpm_list_t *pkgs = NULL; - alpm_list_t *lp; - - ALPM_LOG_FUNC; - - if(db == NULL || package == NULL || strlen(package) == 0) { - return(NULL); - } - - for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) { - pmpkg_t *info = lp->data; - - if(alpm_list_find_str(alpm_pkg_get_provides(info), package)) { - pkgs = alpm_list_add(pkgs, info); - } - } - - return(pkgs); -} - -/* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libalpm/provide.h b/lib/libalpm/provide.h deleted file mode 100644 index b5c55db..0000000 --- a/lib/libalpm/provide.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * provide.h - * - * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ -#ifndef _ALPM_PROVIDE_H -#define _ALPM_PROVIDE_H - -#include "db.h" -#include "alpm_list.h" -#include "config.h" - -alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package); - -#endif /* _ALPM_PROVIDE_H */ - -/* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 66a1527..5143505 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -46,7 +46,6 @@ #include "db.h" #include "cache.h" #include "deps.h" -#include "provide.h" #include "handle.h" #include "alpm.h" diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index e5748e6..6024b6b 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -42,7 +42,6 @@ #include "cache.h" #include "deps.h" #include "conflict.h" -#include "provide.h" #include "trans.h" #include "util.h" #include "handle.h" diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index bcd0707..f537e69 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -48,7 +48,6 @@ #include "alpm.h" #include "deps.h" #include "cache.h" -#include "provide.h" /** \addtogroup alpm_trans Transaction Functions * @brief Functions to manipulate libalpm transactions -- 1.5.3.5
participants (1)
-
Chantry Xavier