MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_unsetenv

Function cbm_unsetenv

src/foundation/compat.h:167–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165 return status;
166}
167static inline int cbm_unsetenv(const char *name) {
168 if (!name) {
169 return EINVAL;
170 }
171 int name_chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, name, -1, NULL, 0);
172 wchar_t *wide_name =
173 name_chars > 0 ? (wchar_t *)malloc((size_t)name_chars * sizeof(*wide_name)) : NULL;
174 if (!wide_name ||
175 MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, name, -1, wide_name, name_chars) <= 0) {
176 free(wide_name);
177 return EINVAL;
178 }
179 int status = _putenv_s(name, "");
180 if (status == 0) {
181 SetLastError(ERROR_SUCCESS);
182 if (!SetEnvironmentVariableW(wide_name, NULL) && GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
183 status = EINVAL;
184 }
185 }
186 free(wide_name);
187 return status;
188}
189#else
190#define cbm_setenv setenv
191#define cbm_unsetenv unsetenv

Callers 15

worker_set_local_envFunction · 0.85
restore_test_envFunction · 0.85
test_cli.cFile · 0.85
test_diagnostics.cFile · 0.85
tf_setup_cache_sentinelFunction · 0.85
restore_cache_dirFunction · 0.85
mcp_test_restore_envFunction · 0.85
mcp_test_gitFunction · 0.85
test_mcp.cFile · 0.85

Calls

no outgoing calls

Tested by 15

restore_test_envFunction · 0.68
tf_setup_cache_sentinelFunction · 0.68
restore_cache_dirFunction · 0.68
mcp_test_restore_envFunction · 0.68
mcp_test_gitFunction · 0.68
idxpar_recovery_checkFunction · 0.68
prune_fixture_teardownFunction · 0.68