ruby-changes:65456
From: Nobuyoshi <ko1@a...>
Date: Fri, 12 Mar 2021 18:14:54 +0900 (JST)
Subject: [ruby-changes:65456] 90c12defb3 (master): Constified variables for getenv
https://git.ruby-lang.org/ruby.git/commit/?id=90c12defb3 From 90c12defb3f2505f53c79e910d2f5a348a16de50 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 12 Mar 2021 16:46:40 +0900 Subject: Constified variables for getenv --- cont.c | 2 +- dln_find.c | 2 +- gc.c | 4 ++-- ruby.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cont.c b/cont.c index e8ac786..e029426 100644 --- a/cont.c +++ b/cont.c @@ -3053,7 +3053,7 @@ Init_Cont(void) https://github.com/ruby/ruby/blob/trunk/cont.c#L3053 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 ca62441..6fe847e 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, https://github.com/ruby/ruby/blob/trunk/dln_find.c#L218 dp[1] == '\\' || #endif dp[1] == '/')) { - char *home; + const char *home; home = getenv("HOME"); if (home != NULL) { diff --git a/gc.c b/gc.c index b9f49db..5ec317d 100644 --- a/gc.c +++ b/gc.c @@ -10013,7 +10013,7 @@ gc_get_auto_compact(rb_execution_context_t *ec, VALUE _) https://github.com/ruby/ruby/blob/trunk/gc.c#L10013 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) https://github.com/ruby/ruby/blob/trunk/gc.c#L10071 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) { diff --git a/ruby.c b/ruby.c index f297c2b..113e895 100644 --- a/ruby.c +++ b/ruby.c @@ -1803,7 +1803,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1803 opt->script = "-"; } else if (opt->do_search) { - char *path = getenv("RUBYPATH"); + const char *path = getenv("RUBYPATH"); opt->script = 0; if (path) { -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/