FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-08-2011, 07:51 AM
Dan McGee
 
Default Add a helper method for retrieving the DB signature path

Note that is a bit different than the normal _alpm_db_path() method; the
caller is expected to free the result.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/db.c | 14 ++++++++++++++
lib/libalpm/db.h | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index b2f3762..f26eaae 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -378,6 +378,20 @@ int _alpm_db_version(pmdb_t *db)
return db->ops->version(db);
}

+char *_alpm_db_sig_path(pmdb_t *db)
+{
+ char *sigpath;
+ size_t len;
+ const char *dbfile = _alpm_db_path(db);
+ if(!db || !dbfile) {
+ return NULL;
+ }
+ len = strlen(dbfile) + strlen(".sig") + 1;
+ CALLOC(sigpath, len, sizeof(char), RET_ERR(db->handle, PM_ERR_MEMORY, NULL));
+ sprintf(sigpath, "%s.sig", dbfile);
+ return sigpath;
+}
+
int _alpm_db_cmp(const void *d1, const void *d2)
{
pmdb_t *db1 = (pmdb_t *)d1;
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 9ecf31f..e3faeeb 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -72,6 +72,7 @@ struct __pmdb_t {
pmdb_t *_alpm_db_new(const char *treename, int is_local);
void _alpm_db_free(pmdb_t *db);
const char *_alpm_db_path(pmdb_t *db);
+char *_alpm_db_sig_path(pmdb_t *db);
int _alpm_db_version(pmdb_t *db);
int _alpm_db_cmp(const void *d1, const void *d2);
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);
--
1.7.5.2
 
Old 06-08-2011, 11:27 AM
Allan McRae
 
Default Add a helper method for retrieving the DB signature path

On 08/06/11 17:51, Dan McGee wrote:

Note that is a bit different than the normal _alpm_db_path() method; the
caller is expected to free the result.

Signed-off-by: Dan McGee<dan@archlinux.org>
---
lib/libalpm/db.c | 14 ++++++++++++++
lib/libalpm/db.h | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index b2f3762..f26eaae 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -378,6 +378,20 @@ int _alpm_db_version(pmdb_t *db)
return db->ops->version(db);
}

+char *_alpm_db_sig_path(pmdb_t *db)
+{
+ char *sigpath;
+ size_t len;
+ const char *dbfile = _alpm_db_path(db);
+ if(!db || !dbfile) {
+ return NULL;
+ }
+ len = strlen(dbfile) + strlen(".sig") + 1;


Note that most other places we just do "+ 5" rather than the
strlen(".sig"). Not that it matters given it will be optimised out...




+ CALLOC(sigpath, len, sizeof(char), RET_ERR(db->handle, PM_ERR_MEMORY, NULL));
+ sprintf(sigpath, "%s.sig", dbfile);
+ return sigpath;
+}
+
int _alpm_db_cmp(const void *d1, const void *d2)
{
pmdb_t *db1 = (pmdb_t *)d1;
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 9ecf31f..e3faeeb 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -72,6 +72,7 @@ struct __pmdb_t {
pmdb_t *_alpm_db_new(const char *treename, int is_local);
void _alpm_db_free(pmdb_t *db);
const char *_alpm_db_path(pmdb_t *db);
+char *_alpm_db_sig_path(pmdb_t *db);
int _alpm_db_version(pmdb_t *db);
int _alpm_db_cmp(const void *d1, const void *d2);
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);
 

Thread Tools




All times are GMT. The time now is 06:57 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org