diff --git a/src/builtin_history.cpp b/src/builtin_history.cpp index 583657ae9..09610b3c7 100644 --- a/src/builtin_history.cpp +++ b/src/builtin_history.cpp @@ -28,12 +28,12 @@ static const enum_map 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; diff --git a/src/builtin_status.cpp b/src/builtin_status.cpp index c11aa4a5d..fe253ecfd 100644 --- a/src/builtin_status.cpp +++ b/src/builtin_status.cpp @@ -90,11 +90,11 @@ static maybe_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 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 diff --git a/src/tinyexpr.cpp b/src/tinyexpr.cpp index e4ae70a34..e4afe469b 100644 --- a/src/tinyexpr.cpp +++ b/src/tinyexpr.cpp @@ -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; diff --git a/src/wgetopt.h b/src/wgetopt.h index f5de1a57a..ae5ed0b21 100644 --- a/src/wgetopt.h +++ b/src/wgetopt.h @@ -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;