diff options
author | Famiu Haque <famiuhaque@proton.me> | 2023-10-14 20:02:42 +0600 |
---|---|---|
committer | Famiu Haque <famiuhaque@proton.me> | 2023-10-17 00:08:47 +0600 |
commit | f1a58a8dcc241e18305e7c103fb97cec64a3e46d (patch) | |
tree | e5b526d35a3d0000b68b634f716ac05a0fa28b4a /src/nvim/option_defs.h | |
parent | af010e23f38a23bb74ea5b61e1b1a05e76410b5f (diff) | |
download | rneovim-f1a58a8dcc241e18305e7c103fb97cec64a3e46d.tar.gz rneovim-f1a58a8dcc241e18305e7c103fb97cec64a3e46d.tar.bz2 rneovim-f1a58a8dcc241e18305e7c103fb97cec64a3e46d.zip |
refactor(options): make `os_oldval` and `os_newval` use `OptValData`
Diffstat (limited to 'src/nvim/option_defs.h')
-rw-r--r-- | src/nvim/option_defs.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 7d5cf3aabe..970615535e 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -17,16 +17,17 @@ typedef enum { kOptValTypeString, } OptValType; +typedef union { + // boolean options are actually tri-states because they have a third "None" value. + TriState boolean; + OptInt number; + String string; +} OptValData; + /// Option value typedef struct { OptValType type; - - union { - // boolean options are actually tri-states because they have a third "None" value. - TriState boolean; - OptInt number; - String string; - } data; + OptValData data; } OptVal; /// :set operator types @@ -46,19 +47,10 @@ typedef struct { int os_idx; int os_flags; - /// old value of the option (can be a string, number or a boolean) - union { - const OptInt number; - const bool boolean; - const char *string; - } os_oldval; - - /// new value of the option (can be a string, number or a boolean) - union { - const OptInt number; - const bool boolean; - const char *string; - } os_newval; + /// Old value of the option. + OptValData os_oldval; + /// New value of the option. + OptValData os_newval; /// When set by the called function: Stop processing the option further. /// Currently only used for boolean options. |