From ccc1c731529de16f6fa4064fd992a8f63d7cfc26 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 11 Jan 2008 00:01:58 -0600 Subject: Use dynamic string allocation in package structures This also affects all structures with static strings, such as depmiss, conflict, etc. This should help a lot with memory usage, and hopefully make things a bit more "idiot proof". Currently our pactest pass/fail rate is identical before and after this patch. This is not to say it is a perfect patch- I have yet to pull valgrind out. However, this should be quite safe to use in all situations from here on out, and we can start plugging the memleaks. Original-work-by: Aaron Griffin Signed-off-by: Dan McGee --- lib/libalpm/deps.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/libalpm/deps.h') diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h index 75cbb5bc..b20ea92f 100644 --- a/lib/libalpm/deps.h +++ b/lib/libalpm/deps.h @@ -29,13 +29,13 @@ /* Dependency */ struct __pmdepend_t { pmdepmod_t mod; - char name[PKG_NAME_LEN]; - char version[PKG_VERSION_LEN]; + char *name; + char *version; }; /* Missing dependency */ struct __pmdepmissing_t { - char target[PKG_NAME_LEN]; + char *target; pmdepend_t depend; }; @@ -50,6 +50,7 @@ struct __pmgraph_t { pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepmod_t depmod, const char *depname, const char *depversion); +void _alpm_depmiss_free(pmdepmissing_t *miss); alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode); void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit); int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, -- cgit v1.2.3-24-g4f1b