getenv() returns a pointer to const char *. By casting it to a non-const pointer you're suppressing helpful compiler warnings that might show regressions in the future.

in 244: everything here has to be const
in 252: name is const

This is not as important as const in the function declaration.