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

@@ -39,7 +39,7 @@ xbps_entry_is_a_conf_file(prop_dictionary_t propsd,
{
prop_array_t array;
const char *cffile;
size_t i;
unsigned int i;
assert(prop_object_type(propsd) == PROP_TYPE_DICTIONARY);
assert(entry_pname != NULL);

View File

@@ -37,7 +37,7 @@ merge_filelist(prop_dictionary_t d)
{
prop_array_t a, result;
prop_dictionary_t filed;
size_t i;
unsigned int i;
result = prop_array_create();
assert(result);
@@ -78,7 +78,7 @@ xbps_find_pkg_obsoletes(struct xbps_handle *xhp,
prop_array_t instfiles, newfiles, obsoletes;
prop_object_t obj, obj2;
prop_string_t oldstr, newstr;
size_t i, x;
unsigned int i, x;
const char *oldhash;
char *file;
int rv = 0;

View File

@@ -68,7 +68,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, prop_array_t orphans_user)
prop_object_iterator_t iter;
const char *curpkgver, *deppkgver, *reqbydep;
bool automatic = false;
size_t i, x, j, cnt, reqbycnt;
unsigned int i, x, j, cnt, reqbycnt;
(void)orphans_user;

View File

@@ -115,7 +115,10 @@ xbps_pkg_exec_script(struct xbps_handle *xhp,
bool update)
{
prop_data_t data;
void *buf;
size_t buflen;
const char *pkgver;
int rv;
assert(xhp);
assert(d);
@@ -128,6 +131,10 @@ xbps_pkg_exec_script(struct xbps_handle *xhp,
prop_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
return xbps_pkg_exec_buffer(xhp, prop_data_data(data),
prop_data_size(data), pkgver, action, update);
buf = prop_data_data(data);
buflen = prop_data_size(data);
rv = xbps_pkg_exec_buffer(xhp, buf, buflen, pkgver, action, update);
free(buf);
return rv;
}

View File

@@ -166,6 +166,7 @@ xbps_set_pkg_state_installed(struct xbps_handle *xhp,
return EINVAL;
}
free(pkgname);
prop_object_release(pkgd);
} else {
if ((rv = set_new_state(pkgd, state)) != 0)
return rv;

View File

@@ -57,7 +57,7 @@ find_pkg_symlink_target(prop_dictionary_t d, const char *file)
{
prop_array_t links;
prop_object_t obj;
size_t i;
unsigned int i;
const char *pkgfile, *tgt = NULL;
char *rfile;
@@ -147,6 +147,7 @@ create_pkg_metaplist(struct xbps_handle *xhp, const char *pkgname, const char *p
pkgver, buf, strerror(errno));
}
free(buf);
prop_object_release(pkg_metad);
return rv;
}

View File

@@ -143,7 +143,7 @@ xbps_pkgdb_foreach_reverse_cb(struct xbps_handle *xhp,
prop_array_t allkeys;
prop_object_t obj;
prop_dictionary_t pkgd;
size_t i;
unsigned int i;
int rv;
bool done = false;

View File

@@ -110,7 +110,7 @@ xbps_callback_array_iter_in_dict(struct xbps_handle *xhp,
{
prop_object_t obj;
prop_array_t array;
size_t i;
unsigned int i;
int rv = 0;
bool cbloop_done = false;
@@ -212,7 +212,7 @@ array_replace_dict(prop_array_t array,
bool bypattern)
{
prop_object_t obj;
size_t i;
unsigned int i;
const char *curpkgver;
char *curpkgname;

View File

@@ -183,7 +183,7 @@ vpkg_user_conf(struct xbps_handle *xhp,
{
const char *vpkgver, *pkg = NULL;
char *vpkgname = NULL, *tmp;
size_t i, j, cnt;
unsigned int i, j, cnt;
if (xhp->cfg == NULL)
return NULL;

View File

@@ -38,7 +38,7 @@ remove_obj_from_array(prop_array_t array, const char *str, int mode)
prop_object_t obj;
const char *curname, *pkgdep;
char *curpkgname;
size_t idx = 0;
unsigned int idx = 0;
bool found = false;
assert(prop_object_type(array) == PROP_TYPE_ARRAY);

View File

@@ -64,7 +64,7 @@ add_missing_reqdep(struct xbps_handle *xhp, const char *reqpkg)
prop_string_t reqpkg_str;
prop_object_iterator_t iter = NULL;
prop_object_t obj;
size_t idx = 0;
unsigned int idx = 0;
bool add_pkgdep, pkgfound, update_pkgdep;
int rv = 0;
@@ -150,14 +150,14 @@ find_repo_deps(struct xbps_handle *xhp,
prop_array_t unsorted, /* array of unsorted deps */
prop_array_t pkg_rdeps_array, /* current pkg rundeps array */
const char *curpkg, /* current pkgver */
size_t *depth) /* max recursion depth */
unsigned short *depth) /* max recursion depth */
{
prop_dictionary_t curpkgd, tmpd;
prop_object_t obj;
prop_object_iterator_t iter;
prop_array_t curpkgrdeps;
pkg_state_t state;
size_t x;
unsigned int x;
const char *reqpkg, *pkgver_q, *reason = NULL;
char *pkgname, *reqpkgname;
int rv = 0;
@@ -389,7 +389,7 @@ xbps_repository_find_deps(struct xbps_handle *xhp,
{
prop_array_t pkg_rdeps;
const char *pkgver;
size_t depth = 0;
unsigned short depth = 0;
pkg_rdeps = prop_dictionary_get(repo_pkgd, "run_depends");
if (prop_object_type(pkg_rdeps) != PROP_TYPE_ARRAY)

View File

@@ -119,7 +119,7 @@ int
xbps_rpool_sync(struct xbps_handle *xhp, const char *uri)
{
const char *repouri;
size_t i;
unsigned int i;
if (xhp->cfg == NULL)
return ENOTSUP;

View File

@@ -193,7 +193,7 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
char *pkgname;
bool foundhold = false, newpkg_found = false;
int rv = 0;
size_t x;
unsigned int x;
if ((rv = xbps_pkgdb_init(xhp)) != 0)
return rv;
@@ -273,7 +273,7 @@ xbps_transaction_remove_pkg(struct xbps_handle *xhp,
prop_array_t unsorted, orphans, orphans_pkg, reqby;
prop_object_t obj;
const char *pkgver;
size_t count;
unsigned int count;
int rv = 0;
assert(pkgname != NULL);
@@ -351,7 +351,7 @@ xbps_transaction_autoremove_pkgs(struct xbps_handle *xhp)
prop_array_t orphans, unsorted;
prop_object_t obj;
const char *pkgver;
size_t count;
unsigned int count;
int rv = 0;
orphans = xbps_find_pkg_orphans(xhp, NULL);

View File

@@ -43,7 +43,7 @@ xbps_transaction_package_replace(struct xbps_handle *xhp)
const char *pattern, *pkgver, *curpkgver;
char *buf, *pkgname, *curpkgname;
bool instd_auto, sr;
size_t i;
unsigned int i;
unsorted = prop_dictionary_get(xhp->transd, "unsorted_deps");

View File

@@ -87,11 +87,11 @@ pkgdep_find(const char *pkg)
return NULL;
}
static ssize_t
static int32_t
pkgdep_find_idx(const char *pkg)
{
struct pkgdep *pd, *pd_new;
ssize_t idx = 0;
int32_t idx = 0;
const char *pkgver, *tract;
TAILQ_FOREACH_SAFE(pd, &pkgdep_list, pkgdep_entries, pd_new) {
@@ -167,8 +167,8 @@ sort_pkg_rundeps(struct xbps_handle *xhp,
prop_dictionary_t curpkgd;
struct pkgdep *lpd, *pdn;
const char *str, *tract;
ssize_t pkgdepidx, curpkgidx;
size_t i, idx = 0;
int32_t pkgdepidx, curpkgidx;
uint32_t i, idx = 0;
int rv = 0;
xbps_dbg_printf_append(xhp, "\n");
@@ -258,7 +258,7 @@ xbps_transaction_sort(struct xbps_handle *xhp)
prop_array_t provides, sorted, unsorted, rundeps;
prop_object_t obj;
struct pkgdep *pd;
size_t i, j, ndeps = 0, cnt = 0;
unsigned int i, j, ndeps = 0, cnt = 0;
const char *pkgname, *pkgver, *tract, *vpkgdep;
int rv = 0;
bool vpkg_found;

View File

@@ -121,7 +121,7 @@ xbps_pkg_name(const char *pkg)
{
const char *p;
char *buf;
size_t len;
unsigned int len;
if ((p = strrchr(pkg, '-')) == NULL)
return NULL;
@@ -143,7 +143,7 @@ char *
xbps_pkgpattern_name(const char *pkg)
{
char *res, *pkgname;
size_t len;
unsigned int len;
assert(pkg != NULL);