bool AVMPI_isMemoryProfilingEnabled() { #if defined (UNDER_CE) && defined(MMGC_MEMORY_PROFILER) return true; #else //read the mmgc profiling option switch const char *env = VMPI_getenv("MMGC_PROFILE"); return (env && (VMPI_strncmp(env, "1", 1) == 0)); #endif }
int VMPI_setenv(const char *name, const char *value, int overwrite) { if(!overwrite) { //VMPI_log("getenv = ["); //VMPI_log(VMPI_getenv(name)); //VMPI_log("]\n"); if(NULL != VMPI_getenv(name)) { return 0; } } return setenv_with_putenv(name, value); }
/*static*/ Stringp CStdlibClass::getenv(ScriptObject* self, Stringp name) { AvmCore *core = self->core(); Toplevel* toplevel = self->toplevel(); if( !name ) { toplevel->throwArgumentError(kNullArgumentError, "name"); } #if AVMSYSTEM_WIN32 StUTF16String nameUTF16(name); const wchar * str = VMPI_getenv16( nameUTF16.c_str() ); Stringp value = core->newStringUTF16( str ); StUTF8String valueUTF8(value); return core->newStringUTF8( valueUTF8.c_str() ); #else StUTF8String nameUTF8(name); const char * str = VMPI_getenv( nameUTF8.c_str() ); return core->newStringUTF8( str ); #endif }