summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-03-12 16:46:40 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-03-12 17:13:53 +0900
commit90c12defb3f2505f53c79e910d2f5a348a16de50 (patch)
treee852ea34dd6945799164cc5e582085a0ec34c080
parent2ea600f9a646a9517b99d7875bef863f60872ece (diff)
Constified variables for getenv
-rw-r--r--cont.c2
-rw-r--r--dln_find.c2
-rw-r--r--gc.c4
-rw-r--r--ruby.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/cont.c b/cont.c
index e8ac786031..e02942681a 100644
--- a/cont.c
+++ b/cont.c
@@ -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) {
diff --git a/gc.c b/gc.c
index b9f49db600..5ec317ddc7 100644
--- a/gc.c
+++ b/gc.c
@@ -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) {
diff --git a/ruby.c b/ruby.c
index f297c2b0a8..113e895bb2 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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) {