summaryrefslogtreecommitdiff
path: root/prism/options.c
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-02-28 13:56:10 -0500
committerKevin Newton <[email protected]>2024-02-29 12:05:19 -0500
commit50e999c56d21b2c1b899cb40d1f43c664b9e94ee (patch)
treeb7dcd7d1f826a8b478fa5ca960b1d3cb4cc8a352 /prism/options.c
parentcd8d1018bbca086427f66bdba646bb4f387c32b4 (diff)
[ruby/prism] Command line options as a bitset
https://github.com/ruby/prism/commit/369ffbd57e
Diffstat (limited to 'prism/options.c')
-rw-r--r--prism/options.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/prism/options.c b/prism/options.c
index 54fd1bc014..ca0f150107 100644
--- a/prism/options.c
+++ b/prism/options.c
@@ -33,35 +33,11 @@ pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_l
}
/**
- * Sets the -p command line option on the given options struct.
+ * Sets the command line option on the given options struct.
*/
PRISM_EXPORTED_FUNCTION void
-pm_options_command_line_p_set(pm_options_t *options, bool command_line_p) {
- options->command_line_p = command_line_p;
-}
-
-/**
- * Sets the -n command line option on the given options struct.
- */
-PRISM_EXPORTED_FUNCTION void
-pm_options_command_line_n_set(pm_options_t *options, bool command_line_n) {
- options->command_line_n = command_line_n;
-}
-
-/**
- * Sets the -l command line option on the given options struct.
- */
-PRISM_EXPORTED_FUNCTION void
-pm_options_command_line_l_set(pm_options_t *options, bool command_line_l) {
- options->command_line_l = command_line_l;
-}
-
-/**
- * Sets the -a command line option on the given options struct.
- */
-PRISM_EXPORTED_FUNCTION void
-pm_options_command_line_a_set(pm_options_t *options, bool command_line_a) {
- options->command_line_a = command_line_a;
+pm_options_command_line_set(pm_options_t *options, uint8_t command_line) {
+ options->command_line = command_line;
}
/**
@@ -226,10 +202,7 @@ pm_options_read(pm_options_t *options, const char *data) {
}
options->frozen_string_literal = (*data++) ? true : false;
- options->command_line_p = (*data++) ? true : false;
- options->command_line_n = (*data++) ? true : false;
- options->command_line_l = (*data++) ? true : false;
- options->command_line_a = (*data++) ? true : false;
+ options->command_line = (uint8_t) *data++;
options->version = (pm_options_version_t) *data++;
uint32_t scopes_count = pm_options_read_u32(data);