diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-03-12 16:46:40 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-03-12 17:13:53 +0900 |
commit | 90c12defb3f2505f53c79e910d2f5a348a16de50 (patch) | |
tree | e852ea34dd6945799164cc5e582085a0ec34c080 | |
parent | 2ea600f9a646a9517b99d7875bef863f60872ece (diff) |
Constified variables for getenv
-rw-r--r-- | cont.c | 2 | ||||
-rw-r--r-- | dln_find.c | 2 | ||||
-rw-r--r-- | gc.c | 4 | ||||
-rw-r--r-- | ruby.c | 2 |
4 files changed, 5 insertions, 5 deletions
@@ -3053,7 +3053,7 @@ Init_Cont(void) fiber_initialize_keywords[0] = rb_intern_const("blocking"); fiber_initialize_keywords[1] = rb_intern_const("pool"); - char * fiber_shared_fiber_pool_free_stacks = getenv("RUBY_SHARED_FIBER_POOL_FREE_STACKS"); + const char *fiber_shared_fiber_pool_free_stacks = getenv("RUBY_SHARED_FIBER_POOL_FREE_STACKS"); if (fiber_shared_fiber_pool_free_stacks) { shared_fiber_pool.free_stacks = atoi(fiber_shared_fiber_pool_free_stacks); } diff --git a/dln_find.c b/dln_find.c index ca62441631..6fe847e601 100644 --- a/dln_find.c +++ b/dln_find.c @@ -218,7 +218,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size, dp[1] == '\\' || #endif dp[1] == '/')) { - char *home; + const char *home; home = getenv("HOME"); if (home != NULL) { @@ -10013,7 +10013,7 @@ gc_get_auto_compact(rb_execution_context_t *ec, VALUE _) static int get_envparam_size(const char *name, size_t *default_value, size_t lower_bound) { - char *ptr = getenv(name); + const char *ptr = getenv(name); ssize_t val; if (ptr != NULL && *ptr) { @@ -10071,7 +10071,7 @@ get_envparam_size(const char *name, size_t *default_value, size_t lower_bound) static int get_envparam_double(const char *name, double *default_value, double lower_bound, double upper_bound, int accept_zero) { - char *ptr = getenv(name); + const char *ptr = getenv(name); double val; if (ptr != NULL && *ptr) { @@ -1803,7 +1803,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) opt->script = "-"; } else if (opt->do_search) { - char *path = getenv("RUBYPATH"); + const char *path = getenv("RUBYPATH"); opt->script = 0; if (path) { |