mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
rearrange structure fields
Putting larger members before smaller ones will reduce structure sizes. bools are 1 byte. on 64bit systems I think they reduced: wgetopt.h:46: 64 to 56 bytes builtin_history.cpp:30: 48 to 32 bytes builtin_status.cpp:91: 32 to 24 bytes tinyexpr.cpp:69: 40 to 32 bytes
This commit is contained in:
parent
bc66921ac9
commit
09e8f0fd7c
4 changed files with 14 additions and 16 deletions
|
@ -28,12 +28,12 @@ static const enum_map<hist_cmd_t> hist_enum_map[] = {
|
|||
{HIST_SAVE, L"save"}, {HIST_SEARCH, L"search"}, {HIST_UNDEF, NULL}};
|
||||
|
||||
struct history_cmd_opts_t {
|
||||
bool print_help = false;
|
||||
hist_cmd_t hist_cmd = HIST_UNDEF;
|
||||
history_search_type_t search_type = (history_search_type_t)-1;
|
||||
size_t max_items = SIZE_MAX;
|
||||
bool history_search_type_defined = false;
|
||||
const wchar_t *show_time_format = NULL;
|
||||
size_t max_items = SIZE_MAX;
|
||||
bool print_help = false;
|
||||
bool history_search_type_defined = false;
|
||||
bool case_sensitive = false;
|
||||
bool null_terminate = false;
|
||||
bool reverse = false;
|
||||
|
|
|
@ -90,11 +90,11 @@ static maybe_t<job_control_t> job_control_str_to_mode(const wchar_t *mode, wchar
|
|||
}
|
||||
|
||||
struct status_cmd_opts_t {
|
||||
bool print_help{false};
|
||||
int level{1};
|
||||
maybe_t<job_control_t> new_job_control_mode{};
|
||||
const wchar_t *feature_name{};
|
||||
status_cmd_t status_cmd{STATUS_UNDEF};
|
||||
bool print_help{false};
|
||||
};
|
||||
|
||||
/// Note: Do not add new flags that represent subcommands. We're encouraging people to switch to
|
||||
|
|
|
@ -67,11 +67,10 @@ typedef struct te_builtin {
|
|||
} te_builtin;
|
||||
|
||||
typedef struct state {
|
||||
union {double value; const void *function;};
|
||||
const char *start;
|
||||
const char *next;
|
||||
int type;
|
||||
union {double value; const void *function;};
|
||||
|
||||
te_error_type_t error;
|
||||
} state;
|
||||
|
||||
|
|
|
@ -45,9 +45,6 @@ Cambridge, MA 02139, USA. */
|
|||
|
||||
class wgetopter_t {
|
||||
private:
|
||||
bool initialized = false;
|
||||
bool missing_arg_return_colon = false;
|
||||
|
||||
void exchange(wchar_t **argv);
|
||||
void _wgetopt_initialize(const wchar_t *optstring);
|
||||
int _wgetopt_internal(int argc, wchar_t **argv, const wchar_t *optstring,
|
||||
|
@ -60,6 +57,8 @@ class wgetopter_t {
|
|||
int *exact, int *ambig, int *indfound);
|
||||
void _update_long_opt(int argc, wchar_t **argv, const struct woption *pfound, wchar_t *nameend,
|
||||
int *longind, int option_index, int *retval);
|
||||
bool initialized = false;
|
||||
bool missing_arg_return_colon = false;
|
||||
|
||||
public:
|
||||
// For communication from `getopt' to the caller. When `getopt' finds an option that takes an
|
||||
|
@ -69,6 +68,13 @@ class wgetopter_t {
|
|||
|
||||
const wchar_t *shortopts = nullptr;
|
||||
|
||||
// The next char to be scanned in the option-element in which the last option character we
|
||||
// returned was found. This allows us to pick up the scan where we left off.
|
||||
//
|
||||
// If this is zero, or a null string, it means resume the scan by advancing to the next
|
||||
// ARGV-element.
|
||||
wchar_t *nextchar = nullptr;
|
||||
|
||||
// Index in ARGV of the next element to be scanned. This is used for communication to and from
|
||||
// the caller and for communication between successive calls to `getopt'.
|
||||
//
|
||||
|
@ -83,13 +89,6 @@ class wgetopter_t {
|
|||
// XXX 1003.2 says this must be 1 before any call.
|
||||
int woptind = 0;
|
||||
|
||||
// The next char to be scanned in the option-element in which the last option character we
|
||||
// returned was found. This allows us to pick up the scan where we left off.
|
||||
//
|
||||
// If this is zero, or a null string, it means resume the scan by advancing to the next
|
||||
// ARGV-element.
|
||||
wchar_t *nextchar = nullptr;
|
||||
|
||||
// Callers store zero here to inhibit the error message for unrecognized options.
|
||||
int wopterr = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue