Constified variables for getenv

This commit is contained in:
Nobuyoshi Nakada 2021-03-12 16:46:40 +09:00
parent 2ea600f9a6
commit 90c12defb3
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
4 changed files with 5 additions and 5 deletions

2
cont.c
View File

@ -3053,7 +3053,7 @@ Init_Cont(void)
fiber_initialize_keywords[0] = rb_intern_const("blocking"); fiber_initialize_keywords[0] = rb_intern_const("blocking");
fiber_initialize_keywords[1] = rb_intern_const("pool"); 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) { if (fiber_shared_fiber_pool_free_stacks) {
shared_fiber_pool.free_stacks = atoi(fiber_shared_fiber_pool_free_stacks); shared_fiber_pool.free_stacks = atoi(fiber_shared_fiber_pool_free_stacks);
} }

View File

@ -218,7 +218,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
dp[1] == '\\' || dp[1] == '\\' ||
#endif #endif
dp[1] == '/')) { dp[1] == '/')) {
char *home; const char *home;
home = getenv("HOME"); home = getenv("HOME");
if (home != NULL) { if (home != NULL) {

4
gc.c
View File

@ -10013,7 +10013,7 @@ gc_get_auto_compact(rb_execution_context_t *ec, VALUE _)
static int static int
get_envparam_size(const char *name, size_t *default_value, size_t lower_bound) 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; ssize_t val;
if (ptr != NULL && *ptr) { if (ptr != NULL && *ptr) {
@ -10071,7 +10071,7 @@ get_envparam_size(const char *name, size_t *default_value, size_t lower_bound)
static int static int
get_envparam_double(const char *name, double *default_value, double lower_bound, double upper_bound, int accept_zero) 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; double val;
if (ptr != NULL && *ptr) { if (ptr != NULL && *ptr) {

2
ruby.c
View File

@ -1803,7 +1803,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
opt->script = "-"; opt->script = "-";
} }
else if (opt->do_search) { else if (opt->do_search) {
char *path = getenv("RUBYPATH"); const char *path = getenv("RUBYPATH");
opt->script = 0; opt->script = 0;
if (path) { if (path) {