From: Zbigniew Jędrzejewski-Szmek Date: Tue, 9 Feb 2021 15:43:03 +0000 (+0100) Subject: core: drop bitfields in Manager object X-Git-Tag: v248-rc1~166^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec08f27069161565c52d218dcf464f55a0e15c23;p=thirdparty%2Fsystemd.git core: drop bitfields in Manager object Every bitfield may make the object a little smaller, but requires additional code when accessing the field. So it only makes sense in objects that are created in many many copies. The Manager is pretty much a singleton. -rwxrwxr-x 1 zbyszek zbyszek 4443840 Feb 9 16:14 build/systemd -rwxrwxr-x 1 zbyszek zbyszek 4442552 Feb 9 16:42 build/systemd We save 1288 bytes of code by "wasting" a few bytes on storage. (The speed advantages are probably more important, but harder to measure…) --- diff --git a/src/core/manager.h b/src/core/manager.h index 19df889dd89..e56d297908d 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -311,25 +311,25 @@ struct Manager { /* The stat() data the last time we saw /etc/localtime */ usec_t etc_localtime_mtime; - bool etc_localtime_accessible:1; + bool etc_localtime_accessible; - ManagerObjective objective:5; + ManagerObjective objective; /* Flags */ - bool dispatching_load_queue:1; + bool dispatching_load_queue; - bool taint_usr:1; + bool taint_usr; /* Have we already sent out the READY=1 notification? */ - bool ready_sent:1; + bool ready_sent; /* Have we already printed the taint line if necessary? */ - bool taint_logged:1; + bool taint_logged; /* Have we ever changed the "kernel.pid_max" sysctl? */ - bool sysctl_pid_max_changed:1; + bool sysctl_pid_max_changed; - ManagerTestRunFlags test_run_flags:8; + ManagerTestRunFlags test_run_flags; /* If non-zero, exit with the following value when the systemd * process terminate. Useful for containers: systemd-nspawn could get @@ -366,8 +366,8 @@ struct Manager { int original_log_level; LogTarget original_log_target; - bool log_level_overridden:1; - bool log_target_overridden:1; + bool log_level_overridden; + bool log_target_overridden; struct rlimit *rlimit[_RLIMIT_MAX];