summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/util/cleanupdelta.c8
-rw-r--r--src/util/testdb.c17
-rw-r--r--src/util/testpkg.c6
-rw-r--r--src/util/vercmp.c23
4 files changed, 19 insertions, 35 deletions
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index ffcfaba5..c1ef18c4 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -49,7 +49,7 @@ void output_cb(pmloglevel_t level, char *fmt, va_list args)
}
-void checkpkgs(alpm_list_t *pkglist)
+static void checkpkgs(alpm_list_t *pkglist)
{
alpm_list_t *i, *j;
for(i = pkglist; i; i = alpm_list_next(i)) {
@@ -63,7 +63,7 @@ void checkpkgs(alpm_list_t *pkglist)
}
}
-void checkdbs(char *dbpath, alpm_list_t *dbnames) {
+static void checkdbs(char *dbpath, alpm_list_t *dbnames) {
char syncdbpath[PATH_MAX];
pmdb_t *db = NULL;
alpm_list_t *i;
@@ -82,14 +82,14 @@ void checkdbs(char *dbpath, alpm_list_t *dbnames) {
}
-void usage() {
+static void usage(void) {
fprintf(stderr, "usage:\n");
fprintf(stderr,
"\t%s [-b <pacman db>] core extra ... : check the listed sync databases\n", BASENAME);
exit(1);
}
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
{
char *dbpath = DBPATH;
int a = 1;
diff --git a/src/util/testdb.c b/src/util/testdb.c
index 45a2626d..28f2b2b3 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -30,11 +30,6 @@
#define BASENAME "testdb"
-int str_cmp(const void *s1, const void *s2)
-{
- return(strcmp(s1, s2));
-}
-
static void cleanup(int signum) {
if(alpm_release() == -1) {
fprintf(stderr, "error releasing alpm: %s\n", alpm_strerrorlast());
@@ -100,7 +95,7 @@ static int db_test(char *dbpath, int local)
return(ret);
}
-int checkdeps(alpm_list_t *pkglist)
+static int checkdeps(alpm_list_t *pkglist)
{
alpm_list_t *data, *i;
int ret = 0;
@@ -119,7 +114,7 @@ int checkdeps(alpm_list_t *pkglist)
return(ret);
}
-int checkconflicts(alpm_list_t *pkglist)
+static int checkconflicts(alpm_list_t *pkglist)
{
alpm_list_t *data, *i;
int ret = 0;
@@ -135,7 +130,7 @@ int checkconflicts(alpm_list_t *pkglist)
return(ret);
}
-int check_localdb(char *dbpath) {
+static int check_localdb(char *dbpath) {
char localdbpath[PATH_MAX];
int ret = 0;
pmdb_t *db = NULL;
@@ -159,7 +154,7 @@ int check_localdb(char *dbpath) {
return(ret);
}
-int check_syncdbs(char *dbpath, alpm_list_t *dbnames) {
+static int check_syncdbs(char *dbpath, alpm_list_t *dbnames) {
char syncdbpath[PATH_MAX];
int ret = 0;
pmdb_t *db = NULL;
@@ -190,7 +185,7 @@ cleanup:
return(ret);
}
-void usage() {
+static void usage(void) {
fprintf(stderr, "usage:\n");
fprintf(stderr,
"\t%s [-b <pacman db>] : check the local database\n", BASENAME);
@@ -199,7 +194,7 @@ void usage() {
exit(1);
}
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
{
int ret = 0;
char *dbpath = DBPATH;
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index d86fb1e0..6fc0ce00 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h> /* printf */
#include <stdarg.h> /* va_list */
@@ -26,7 +24,7 @@
#define BASENAME "testpkg"
-static void output_cb(pmloglevel_t level, char *fmt, va_list args)
+void output_cb(pmloglevel_t level, char *fmt, va_list args)
{
if(fmt[0] == '\0') {
return;
@@ -39,7 +37,7 @@ static void output_cb(pmloglevel_t level, char *fmt, va_list args)
vprintf(fmt, args);
}
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
{
int retval = 1; /* default = false */
pmpkg_t *pkg = NULL;
diff --git a/src/util/vercmp.c b/src/util/vercmp.c
index 959dc137..8a785bb8 100644
--- a/src/util/vercmp.c
+++ b/src/util/vercmp.c
@@ -18,20 +18,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h> /* printf */
#include <string.h> /* strncpy */
#define BASENAME "vercmp"
-#define MAX_LEN 255
-
/* forward declaration, comes from vercmp.o in libalpm source that is linked in
* directly so we don't have any library deps */
int alpm_pkg_vercmp(const char *a, const char *b);
-static void usage()
+static void usage(void)
{
fprintf(stderr, "usage: %s <ver1> <ver2>\n\n", BASENAME);
fprintf(stderr, "return values:\n");
@@ -42,8 +38,8 @@ static void usage()
int main(int argc, char *argv[])
{
- char s1[MAX_LEN] = "";
- char s2[MAX_LEN] = "";
+ const char *s1 = "";
+ const char *s2 = "";
int ret;
if(argc == 1) {
@@ -56,16 +52,11 @@ int main(int argc, char *argv[])
usage();
return(0);
}
- if(argc > 1) {
- strncpy(s1, argv[1], MAX_LEN);
- s1[MAX_LEN -1] = '\0';
- }
if(argc > 2) {
- strncpy(s2, argv[2], MAX_LEN);
- s2[MAX_LEN -1] = '\0';
- } else {
- printf("0\n");
- return(0);
+ s2 = argv[2];
+ }
+ if(argc > 1) {
+ s1 = argv[1];
}
ret = alpm_pkg_vercmp(s1, s2);