From: Daniel Golle Date: Mon, 2 Nov 2020 16:43:02 +0000 (+0000) Subject: libopkg: tighten length of fields in struct abstract_pkg X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=532f92debcc24fae94246f9a40ef8aca7547930c;p=project%2Fopkg-lede.git libopkg: tighten length of fields in struct abstract_pkg Should reduce the size of that struct and hence memory consumption during dependency resolution (48 bytes vs. 56 bytes on 64-bit). Suggested-by: Jo-Philipp Wich Signed-off-by: Daniel Golle --- diff --git a/libopkg/pkg.h b/libopkg/pkg.h index 600fc9e..4ce13ea 100644 --- a/libopkg/pkg.h +++ b/libopkg/pkg.h @@ -105,17 +105,17 @@ enum pkg_fields { struct abstract_pkg { char *name; - int dependencies_checked; pkg_vec_t *pkgs; - pkg_state_status_t state_status; - pkg_state_flag_t state_flag; + int dependencies_checked:1; + pkg_state_status_t state_status:4; + pkg_state_flag_t state_flag:11; /* XXX: This should be abstract_pkg_vec_t for consistency. */ struct abstract_pkg **depended_upon_by; abstract_pkg_vec_t *provided_by; abstract_pkg_vec_t *replaced_by; -}; +} __attribute__((__packed__)) ; #include "pkg_depends.h"