Relax memory requirements on 64bit platforms; fix two memleaks.

This commit is contained in:
Juan RP
2013-06-12 10:04:10 +02:00
parent 6a9e394a60
commit db1efb3aa6
33 changed files with 83 additions and 74 deletions

View File

@@ -37,8 +37,8 @@ struct xferstat {
/* from transaction.c */
int install_new_pkg(struct xbps_handle *, const char *, bool);
int update_pkg(struct xbps_handle *, const char *);
int dist_upgrade(struct xbps_handle *, size_t, bool, bool);
int exec_transaction(struct xbps_handle *, size_t, bool, bool);
int dist_upgrade(struct xbps_handle *, int, bool, bool);
int exec_transaction(struct xbps_handle *, int, bool, bool);
/* from question.c */
bool yesno(const char *, ...);
@@ -51,7 +51,7 @@ void fetch_file_progress_cb(struct xbps_fetch_cb_data *, void *);
void state_cb(struct xbps_state_cb_data *, void *);
/* From util.c */
void print_package_line(const char *, size_t, bool);
size_t get_maxcols(void);
void print_package_line(const char *, int, bool);
int get_maxcols(void);
#endif /* !_XBPS_INSTALL_DEFS_H_ */

View File

@@ -102,7 +102,7 @@ main(int argc, char **argv)
const char *rootdir, *cachedir, *conffile, *defrepo;
int i, c, flags, rv, fflag = 0;
bool sync, yes, reinstall, drun, update;
size_t maxcols;
int maxcols;
rootdir = cachedir = conffile = defrepo = NULL;
flags = rv = 0;

View File

@@ -48,7 +48,7 @@ struct transaction {
static void
show_missing_deps(prop_array_t a)
{
size_t i;
unsigned int i;
const char *str;
fprintf(stderr, "Unable to locate some required packages:\n");
@@ -61,7 +61,7 @@ show_missing_deps(prop_array_t a)
static void
show_conflicts(prop_array_t a)
{
size_t i;
unsigned int i;
const char *str;
fprintf(stderr, "Conflicting packages were found:\n");
@@ -93,7 +93,7 @@ show_actions(prop_object_iterator_t iter)
}
static void
show_package_list(prop_object_iterator_t iter, const char *match, size_t cols)
show_package_list(prop_object_iterator_t iter, const char *match, int cols)
{
prop_object_t obj;
const char *pkgver, *tract;
@@ -110,7 +110,7 @@ show_package_list(prop_object_iterator_t iter, const char *match, size_t cols)
}
static int
show_transaction_sizes(struct transaction *trans, size_t cols)
show_transaction_sizes(struct transaction *trans, int cols)
{
uint64_t dlsize = 0, instsize = 0, rmsize = 0;
char size[8];
@@ -186,7 +186,7 @@ show_transaction_sizes(struct transaction *trans, size_t cols)
}
int
dist_upgrade(struct xbps_handle *xhp, size_t cols, bool yes, bool drun)
dist_upgrade(struct xbps_handle *xhp, int cols, bool yes, bool drun)
{
int rv = 0;
@@ -256,7 +256,7 @@ update_pkg(struct xbps_handle *xhp, const char *pkgname)
}
int
exec_transaction(struct xbps_handle *xhp, size_t maxcols, bool yes, bool drun)
exec_transaction(struct xbps_handle *xhp, int maxcols, bool yes, bool drun)
{
prop_array_t mdeps, cflicts;
struct transaction *trans;

View File

@@ -35,7 +35,7 @@
#include <xbps_api.h>
#include "defs.h"
size_t
int
get_maxcols(void)
{
struct winsize ws;
@@ -47,9 +47,9 @@ get_maxcols(void)
}
void
print_package_line(const char *str, size_t maxcols, bool reset)
print_package_line(const char *str, int maxcols, bool reset)
{
static size_t cols;
static int cols;
static bool first;
if (reset) {

View File

@@ -49,7 +49,7 @@ check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
{
prop_dictionary_t pkg_propsd = arg;
prop_array_t array;
size_t i;
unsigned int i;
const char *reqpkg;
bool test_broken = false;

View File

@@ -77,7 +77,7 @@ check_pkg_symlinks(struct xbps_handle *xhp, const char *pkgname, void *arg)
prop_array_t array;
prop_object_t obj;
prop_dictionary_t filesd = arg;
size_t i;
unsigned int i;
const char *file, *tgt = NULL;
char *path, *p, *buf, *buf2, *lnk, *dname, *tgt_path;
int rv;

View File

@@ -46,7 +46,7 @@ pkgdb_format_021(struct xbps_handle *xhp, const char *plist_new)
{
prop_array_t array, rdeps;
prop_dictionary_t pkgdb, pkgd;
size_t i;
unsigned int i;
char *pkgname, *plist;
plist = xbps_xasprintf("%s/pkgdb.plist", xhp->metadir);

View File

@@ -55,8 +55,8 @@ int ownedby(struct xbps_handle *, int, char **);
int repo_ownedby(struct xbps_handle *, int, char **);
/* From list.c */
size_t get_maxcols(void);
size_t find_longest_pkgver(struct xbps_handle *, prop_object_t);
int get_maxcols(void);
unsigned int find_longest_pkgver(struct xbps_handle *, prop_object_t);
int list_pkgs_in_dict(struct xbps_handle *, prop_object_t, void *, bool *);
int list_manual_pkgs(struct xbps_handle *, prop_object_t, void *, bool *);

View File

@@ -34,11 +34,11 @@
#include "defs.h"
struct list_pkgver_cb {
size_t pkgver_len;
size_t maxcols;
int pkgver_len;
int maxcols;
};
size_t
int
get_maxcols(void)
{
struct winsize ws;
@@ -58,7 +58,7 @@ list_pkgs_in_dict(struct xbps_handle *xhp,
struct list_pkgver_cb *lpc = arg;
const char *pkgver, *short_desc, *state_str;
char tmp[255], *out = NULL;
size_t i, len = 0;
int i, len = 0;
pkg_state_t state;
(void)xhp;
@@ -167,8 +167,8 @@ repo_list_uri_cb(struct xbps_repo *repo, void *arg, bool *done)
(void)arg;
(void)done;
printf("%s (%zu packages)\n", repo->uri,
(size_t)prop_dictionary_count(repo->idx));
printf("%s (%u packages)\n", repo->uri,
prop_dictionary_count(repo->idx));
return 0;
}
@@ -189,7 +189,7 @@ repo_list(struct xbps_handle *xhp)
struct fflongest {
prop_dictionary_t d;
size_t len;
unsigned int len;
};
static int
@@ -201,7 +201,7 @@ _find_longest_pkgver_cb(struct xbps_handle *xhp,
struct fflongest *ffl = arg;
prop_dictionary_t pkgd;
const char *pkgver;
size_t len;
unsigned int len;
(void)xhp;
(void)loop_done;
@@ -219,7 +219,7 @@ _find_longest_pkgver_cb(struct xbps_handle *xhp,
return 0;
}
size_t
unsigned int
find_longest_pkgver(struct xbps_handle *xhp, prop_object_t o)
{
struct fflongest ffl;

View File

@@ -128,7 +128,7 @@ repo_match_files_by_pattern(prop_array_t files,
struct ffdata *ffd)
{
const char *filestr;
size_t i;
unsigned int i;
int x;
for (i = 0; i < prop_array_count(files); i++) {

View File

@@ -47,7 +47,7 @@
struct search_data {
int npatterns;
char **patterns;
size_t maxcols;
int maxcols;
prop_array_t results;
};
@@ -56,7 +56,7 @@ print_results(struct xbps_handle *xhp, struct search_data *sd)
{
const char *pkgver, *desc, *inststr;
char tmp[256], *out;
size_t i, j, tlen = 0, len = 0;
unsigned int i, j, tlen = 0, len = 0;
/* Iterate over results array and find out largest pkgver string */
for (i = 0; i < prop_array_count(sd->results); i++) {
@@ -80,7 +80,7 @@ print_results(struct xbps_handle *xhp, struct search_data *sd)
inststr = "[-]";
len = strlen(inststr) + strlen(tmp) + strlen(desc) + 3;
if (len > sd->maxcols) {
if ((int)len > sd->maxcols) {
out = malloc(sd->maxcols+1);
assert(out);
snprintf(out, sd->maxcols-3, "%s %s %s",
@@ -103,7 +103,7 @@ search_pkgs_cb(struct xbps_repo *repo, void *arg, bool *done)
prop_dictionary_keysym_t ksym;
struct search_data *sd = arg;
const char *pkgver, *desc;
size_t i;
unsigned int i;
int x;
(void)done;
@@ -120,7 +120,7 @@ search_pkgs_cb(struct xbps_repo *repo, void *arg, bool *done)
provides = prop_dictionary_get(pkgd, "provides");
for (x = 0; x < sd->npatterns; x++) {
size_t j;
unsigned int j;
bool vpkgfound = false;
for (j = 0; j < prop_array_count(provides); j++) {

View File

@@ -40,7 +40,7 @@ print_rdeps(struct xbps_handle *xhp, prop_array_t rdeps,
prop_array_t currdeps;
prop_dictionary_t pkgd;
const char *pkgdep;
size_t i;
unsigned int i;
int j;
if (!origin)
@@ -98,7 +98,7 @@ show_pkg_revdeps(struct xbps_handle *xhp, const char *pkg)
{
prop_array_t reqby;
const char *pkgdep;
size_t i;
unsigned int i;
if ((reqby = xbps_pkgdb_get_pkg_revdeps(xhp, pkg)) != NULL) {
for (i = 0; i < prop_array_count(reqby); i++) {

View File

@@ -43,7 +43,7 @@ print_value_obj(const char *keyname, prop_object_t obj,
prop_array_t allkeys;
prop_object_t obj2, keysym;
const char *ksymname, *value;
size_t i;
unsigned int i;
char size[8];
if (indent == NULL)
@@ -151,7 +151,7 @@ static void
print_srcrevs(const char *keyname, prop_string_t obj)
{
const char *str = prop_string_cstring_nocopy(obj);
size_t i;
unsigned int i;
/* parse string appending a \t after EOL */
printf("%s:\n ", keyname);
@@ -170,7 +170,7 @@ show_pkg_info(prop_dictionary_t dict)
prop_array_t all_keys;
prop_object_t obj, keysym;
const char *keyname;
size_t i;
unsigned int i;
all_keys = prop_dictionary_all_keys(dict);
for (i = 0; i < prop_array_count(all_keys); i++) {
@@ -201,7 +201,7 @@ show_pkg_files(prop_dictionary_t filesd)
prop_object_t obj;
prop_dictionary_keysym_t ksym;
const char *keyname, *file;
size_t i, x;
unsigned int i, x;
if (prop_object_type(filesd) != PROP_TYPE_DICTIONARY)
return EINVAL;

View File

@@ -183,12 +183,12 @@ cachedir_clean(struct xbps_handle *xhp)
}
static int
remove_pkg(struct xbps_handle *xhp, const char *pkgname, size_t cols,
remove_pkg(struct xbps_handle *xhp, const char *pkgname, int cols,
bool recursive)
{
prop_array_t reqby;
const char *pkgver;
size_t x;
unsigned int x;
int rv;
rv = xbps_transaction_remove_pkg(xhp, pkgname, recursive);
@@ -243,7 +243,7 @@ main(int argc, char **argv)
int i, c, flags, rv;
bool yes, drun, recursive, ignore_revdeps, clean_cache;
bool orphans, reqby_force;
size_t maxcols;
int maxcols;
rootdir = cachedir = conffile = NULL;
flags = rv = 0;

View File

@@ -54,7 +54,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
const char *oldpkgver, *arch, *oldarch;
char *pkgver, *pkgname, *sha256, *repodir, *buf;
char *tmprepodir;
size_t x;
unsigned int x;
int i, rv, ret = 0;
bool flush = false, found = false;

View File

@@ -143,7 +143,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
prop_dictionary_t idx, idxfiles;
const char *keyname;
char *pkgname;
size_t x, pkgcount, slicecount;
unsigned int x, pkgcount, slicecount;
int i, maxthreads, rv = 0;
bool flush = false;

View File

@@ -138,7 +138,7 @@ remove_obsoletes(struct xbps_handle *xhp, const char *repodir)
struct dirent *dp;
char *ext;
int i, maxthreads, rv = 0;
size_t slicecount, pkgcount;
unsigned int slicecount, pkgcount;
repo = xbps_repo_open(xhp, repodir);
if (repo == NULL) {