MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / FindOrAddBuiltInVar

Method FindOrAddBuiltInVar

source/script.cpp:7312–7327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7310
7311
7312Var *Script::FindOrAddBuiltInVar(LPCTSTR aVarName, VarEntry *aVarEntry)
7313{
7314 int insert_pos;
7315 if (Var *found = mVars.Find(aVarName, &insert_pos))
7316 return found;
7317 LPTSTR name = SimpleHeap::Malloc(aVarName);
7318 if (!name)
7319 return nullptr;
7320 Var *the_new_var = new Var(name, aVarEntry, VAR_DECLARE_GLOBAL);
7321 if (!the_new_var || !mVars.Insert(the_new_var, insert_pos))
7322 {
7323 MemoryError();
7324 return nullptr;
7325 }
7326 return the_new_var;
7327}
7328
7329
7330

Callers

nothing calls this directly

Calls 3

MemoryErrorFunction · 0.85
FindMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected