summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-10-08 23:36:47 +0200
committerAurelien Foret <aurelien@archlinux.org>2005-10-08 23:36:47 +0200
commit8ffb82a691d08511e7436ba0f2fc63f8822e9a4e (patch)
tree5e2c8824daac847d37eaade52b810fa0794710ff /lib/libalpm
parent05ab859eab8dbe14f1957d0a4e64b3f005630d45 (diff)
downloadpacman-8ffb82a691d08511e7436ba0f2fc63f8822e9a4e.tar.gz
pacman-8ffb82a691d08511e7436ba0f2fc63f8822e9a4e.tar.xz
Code update to make use of PKG_FULLNAME_LEN
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c4
-rw-r--r--lib/libalpm/alpm.c16
-rw-r--r--lib/libalpm/db.c4
-rw-r--r--lib/libalpm/sync.c4
4 files changed, 14 insertions, 14 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 6c6fc6b6..6fcc6442 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -328,8 +328,8 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
oldpkg = pkg_new();
if(oldpkg) {
if(!(local->infolevel & INFRQ_FILES)) {
- char name[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
- snprintf(name, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", local->name, local->version);
+ char name[PKG_FULLNAME_LEN];
+ snprintf(name, PKG_FULLNAME_LEN, "%s-%s", local->name, local->version);
_alpm_log(PM_LOG_DEBUG, "loading FILES info for %s", local->name);
db_read(db, name, INFRQ_FILES, local);
}
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index fd8641b1..f7a1ec34 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -378,8 +378,8 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
case PM_PKG_REASON:
case PM_PKG_MD5SUM:
if(!(pkg->infolevel & INFRQ_DESC)) {
- char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
- snprintf(target, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", pkg->name, pkg->version);
+ char target[PKG_FULLNAME_LEN];
+ snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_DESC, pkg);
}
break;
@@ -392,8 +392,8 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
case PM_PKG_PROVIDES:
case PM_PKG_REPLACES:
if(!(pkg->infolevel & INFRQ_DEPENDS)) {
- char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
- snprintf(target, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", pkg->name, pkg->version);
+ char target[PKG_FULLNAME_LEN];
+ snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_DEPENDS, pkg);
}
break;*/
@@ -401,16 +401,16 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
case PM_PKG_FILES:
case PM_PKG_BACKUP:
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_FILES)) {
- char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
- snprintf(target, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", pkg->name, pkg->version);
+ char target[PKG_FULLNAME_LEN];
+ snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_FILES, pkg);
}
break;
/* Scriptlet */
case PM_PKG_SCRIPLET:
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_SCRIPLET)) {
- char target[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
- snprintf(target, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1, "%s-%s", pkg->name, pkg->version);
+ char target[PKG_FULLNAME_LEN];
+ snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_SCRIPLET, pkg);
}
break;
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 60850489..139bc3bb 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -181,7 +181,7 @@ pmpkg_t *db_scan(pmdb_t *db, char *target, unsigned int inforeq)
struct dirent *ent = NULL;
struct stat sbuf;
char path[PATH_MAX];
- char name[(PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1];
+ char name[PKG_FULLNAME_LEN];
char *ptr = NULL;
int found = 0;
pmpkg_t *pkg;
@@ -197,7 +197,7 @@ pmpkg_t *db_scan(pmdb_t *db, char *target, unsigned int inforeq)
if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) {
continue;
}
- STRNCPY(name, ent->d_name, (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1);
+ STRNCPY(name, ent->d_name, PKG_FULLNAME_LEN);
/* stat the entry, make sure it's a directory */
snprintf(path, PATH_MAX, "%s/%s", db->path, name);
if(stat(path, &sbuf) || !S_ISDIR(sbuf.st_mode)) {
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 0be24b79..27c4dac5 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -247,7 +247,7 @@ error:
int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *name)
{
- char targline[(PKG_NAME_LEN-1)+1+(DB_TREENAME_LEN-1)+1];
+ char targline[PKG_FULLNAME_LEN];
char *targ;
PMList *j;
pmpkg_t *local;
@@ -259,7 +259,7 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- STRNCPY(targline, name, (PKG_NAME_LEN-1)+1+(DB_TREENAME_LEN-1)+1);
+ STRNCPY(targline, name, PKG_FULLNAME_LEN);
targ = strchr(targline, '/');
if(targ) {
*targ = '\0';