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/package.h | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'lib/libalpm/package.h') diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index d883eee1..dbb3f599 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -33,30 +33,17 @@ typedef enum _pmpkgfrom_t { PKG_FROM_FILE } pmpkgfrom_t; -/* Packages */ -#define PKG_FILENAME_LEN 512 -#define PKG_NAME_LEN 256 -#define PKG_VERSION_LEN 64 -#define PKG_FULLNAME_LEN (PKG_NAME_LEN + PKG_VERSION_LEN) -#define PKG_DESC_LEN 512 -#define PKG_URL_LEN 256 -#define PKG_DATE_LEN 32 -#define PKG_TYPE_LEN 32 -#define PKG_PACKAGER_LEN 64 -#define PKG_MD5SUM_LEN 33 -#define PKG_ARCH_LEN 32 - struct __pmpkg_t { - char filename[PKG_FILENAME_LEN]; - char name[PKG_NAME_LEN]; - char version[PKG_VERSION_LEN]; - char desc[PKG_DESC_LEN]; - char url[PKG_URL_LEN]; + char *filename; + char *name; + char *version; + char *desc; + char *url; time_t builddate; time_t installdate; - char packager[PKG_PACKAGER_LEN]; - char md5sum[PKG_MD5SUM_LEN]; - char arch[PKG_ARCH_LEN]; + char *packager; + char *md5sum; + char *arch; unsigned long size; unsigned long isize; unsigned short scriptlet; -- cgit v1.2.3-70-g09d2