summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-19 18:15:31 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-19 18:15:31 +0000
commitbddea378b97088cdb303b4136f7e88f9130d0a2a (patch)
tree0a1dd44c34335a9d502388076ec676d940a5ab8d
parent2da0b2263ef80ab0b62dc81913a344c1bd6f92dd (diff)
Rework for fixed length strings
-rw-r--r--lib/libalpm/alpm.c8
-rw-r--r--lib/libalpm/util.c3
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 58b7d04d..94c8d2dc 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -292,18 +292,18 @@ void *alpm_pkg_getinfo(PM_PKG *pkg, unsigned char parm)
case PM_PKG_FILES:
case PM_PKG_BACKUP:
if(!(pkg->infolevel & INFRQ_FILES)) {
- char target[PKG_NAME_LEN+1+PKG_VERSION_LEN];
+ char target[PKG_NAME_LEN+PKG_VERSION_LEN];
- snprintf(target, PKG_NAME_LEN+1+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
+ snprintf(target, PKG_NAME_LEN+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_FILES, pkg);
}
break;
case PM_PKG_SCRIPLET:
if(!(pkg->infolevel & INFRQ_SCRIPLET)) {
- char target[PKG_NAME_LEN+1+PKG_VERSION_LEN];
+ char target[PKG_NAME_LEN+PKG_VERSION_LEN];
- snprintf(target, PKG_NAME_LEN+1+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
+ snprintf(target, PKG_NAME_LEN+PKG_VERSION_LEN, "%s-%s", pkg->name, pkg->version);
db_read(pkg->data, target, INFRQ_SCRIPLET, pkg);
}
break;
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 0c2e3360..053d7b98 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -144,13 +144,14 @@ char *_alpm_strtoupper(char *str)
char *_alpm_strtrim(char *str)
{
char *pch = str;
+
while(isspace(*pch)) {
pch++;
}
if(pch != str) {
memmove(str, pch, (strlen(pch) + 1));
}
-
+
pch = (char*)(str + (strlen(str) - 1));
while(isspace(*pch)) {
pch--;