summaryrefslogtreecommitdiff
path: root/lib/rpmfi_internal.h
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-11-19 18:17:56 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-11-19 18:17:56 +0200
commitf90f2f10155ebb010b3ff3119be31fd8600c1cb8 (patch)
treecc18da501c5449a10beb501d909452780b24bc6d /lib/rpmfi_internal.h
parent6fd987b7291fb1306297c193f4ab01bf6cd02618 (diff)
downloadlibrpm-tizen-f90f2f10155ebb010b3ff3119be31fd8600c1cb8.tar.gz
librpm-tizen-f90f2f10155ebb010b3ff3119be31fd8600c1cb8.tar.bz2
librpm-tizen-f90f2f10155ebb010b3ff3119be31fd8600c1cb8.zip
Be more intelligent about storing file user and group names
- User and group names contain an enormous amount of redundancy: typically most files and directories are owned by root:root. Store the each unique name just once into global cache and store indexes to the cache into rpmfi user + group arrays. This saves several megabytes of memory on a transaction of non-trivial size... - The cache implementation is dumb, but it's not noticeably slower than uncached version, copying megs of strings around is not cheap either. Easy enough to replace with a hash-table or such if performace becomes and issue...
Diffstat (limited to 'lib/rpmfi_internal.h')
-rw-r--r--lib/rpmfi_internal.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h
index 60d3458e1..291f78454 100644
--- a/lib/rpmfi_internal.h
+++ b/lib/rpmfi_internal.h
@@ -18,6 +18,12 @@ struct sharedFileInfo_s {
int isRemoved;
};
+/*
+ * This limits maximum unique user + group names from packages to 65535,
+ * should be plenty but easy to bump if ever needed.
+ */
+typedef uint16_t ugidx_t;
+
/**
* A package filename set.
*/
@@ -52,8 +58,8 @@ struct rpmfi_s {
/*?null?*/
const rpm_ino_t * finodes; /*!< File inodes(s) (from header) */
- const char ** fuser; /*!< File owner(s) (from header) */
- const char ** fgroup; /*!< File group(s) (from header) */
+ ugidx_t *fuser; /*!< Index to file owner(s) cache */
+ ugidx_t *fgroup; /*!< Index to file group(s) cache */
char * fstates; /*!< File state(s) (from header) */