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

Method Find

source/script.cpp:6738–6760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6736
6737template<typename T, int S>
6738T *ScriptItemList<T, S>::Find(LPCTSTR aName, int *apInsertPos)
6739{
6740 // Using a binary searchable array vs a linked list speeds up dynamic function calls, on average.
6741 int left, right, mid, result;
6742 for (left = 0, right = mCount - 1; left <= right;)
6743 {
6744 mid = (left + right) / 2;
6745 result = _tcsicmp(aName, mItem[mid]->mName); // lstrcmpi() is not used: 1) avoids breaking existing scripts; 2) provides consistent behavior across multiple locales; 3) performance.
6746 if (result > 0)
6747 left = mid + 1;
6748 else if (result < 0)
6749 right = mid - 1;
6750 else // Match found.
6751 {
6752 if (apInsertPos)
6753 *apInsertPos = mid;
6754 return mItem[mid];
6755 }
6756 }
6757 if (apInsertPos)
6758 *apInsertPos = left;
6759 return NULL;
6760}
6761
6762
6763

Callers 9

OnEventMethod · 0.45
DefineClassMethod · 0.45
FindVarMethod · 0.45
FindUpVarMethod · 0.45
CountNestedFuncRefsMethod · 0.45
FindOrAddBuiltInVarMethod · 0.45
PreprocessLocalVarsMethod · 0.45
ParsePropertyNameMethod · 0.45
FindLocalVarMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected