
Dear James,
In message 0102016e8e614227-a8c99a21-6a99-4611-b510-a723bc021b52-000000@eu-west-1.amazonses.com you wrote:
Add env_force_set() to provide an equivalent to 'setenv -f' that can be used programmatically.
env_set_forced() ?
-int env_set(const char *varname, const char *varvalue) +static int do_programmatic_env_set(const char *varname, const char *varvalue,
int env_flag)
{ /* before import into hashtable */ if (!(gd->flags & GD_FLG_ENV_READY)) return 1;
if (!varvalue || varvalue[0] == '\0')
return do_env_remove(varname, H_PROGRAMMATIC);
return do_env_remove(varname, H_PROGRAMMATIC | env_flag);
- return do_env_update(varname, varvalue, H_PROGRAMMATIC | env_flag);
+}
+int env_set(const char *varname, const char *varvalue) +{
- return do_programmatic_env_set(varname, varvalue, 0);
+}
- return do_env_update(varname, varvalue, H_PROGRAMMATIC);
+int env_force_set(const char *varname, const char *varvalue) +{
- return do_programmatic_env_set(varname, varvalue, H_FORCE);
}
You add another level of function nesting and add more lines of code than if just coppying the 3 C statements.
If possible, please also try not to come up with so awfully long names like do_programmatic_env_set() - hey, this is allprogrammatic what we're coding here, isn;t it?
Best regards,
Wolfgang Denk