Skip to content

Commit

Permalink
C4AulFuncMap::GetFunc: Remove unused After parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Jul 16, 2023
1 parent 39cd868 commit ec522eb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
16 changes: 3 additions & 13 deletions src/C4Aul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ C4AulFunc *C4AulScript::GetOverloadedFunc(C4AulFunc *ByFunc)
if (SEqual(ByFunc->Name, f->Name)) break;
f = f->Prev;
}
#ifndef NDEBUG
C4AulFunc *f2 = Engine ? Engine->GetFunc(ByFunc->Name, this, ByFunc) : nullptr;
assert(f == f2);
#endif
// nothing found? then search owner, if existent
if (!f && Owner)
{
Expand All @@ -292,7 +288,7 @@ C4AulFunc *C4AulScript::GetFuncRecursive(const char *pIdtf)

C4AulFunc *C4AulScript::GetFunc(const char *pIdtf)
{
return Engine ? Engine->GetFunc(pIdtf, this, nullptr) : nullptr;
return Engine ? Engine->GetFunc(pIdtf, this) : nullptr;
}

C4AulScriptFunc *C4AulScript::GetSFuncWarn(const char *pIdtf, C4AulAccess AccNeeded, const char *WarnStr)
Expand Down Expand Up @@ -549,17 +545,11 @@ C4AulFunc *C4AulFuncMap::GetFirstFunc(const char *Name)
return Func;
}

C4AulFunc *C4AulFuncMap::GetFunc(const char *Name, const C4AulScript *Owner, const C4AulFunc *After)
C4AulFunc *C4AulFuncMap::GetFunc(const char *Name, const C4AulScript *Owner)
{
if (!Name) return nullptr;
C4AulFunc *Func = Funcs[Hash(Name) % Capacity];
if (After)
{
while (Func && Func != After)
Func = Func->MapNext;
if (Func)
Func = Func->MapNext;
}

while (Func && (Func->Owner != Owner || !SEqual(Name, Func->Name)))
Func = Func->MapNext;
return Func;
Expand Down
6 changes: 3 additions & 3 deletions src/C4Aul.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class C4AulFuncMap
public:
C4AulFuncMap();
~C4AulFuncMap();
C4AulFunc *GetFunc(const char *Name, const C4AulScript *Owner, const C4AulFunc *After);
C4AulFunc *GetFunc(const char *Name, const C4AulScript *Owner);
C4AulFunc *GetFirstFunc(const char *Name);

private:
Expand Down Expand Up @@ -556,9 +556,9 @@ class C4AulScriptEngine : public C4AulScript
return FuncLookUp.GetFirstFunc(Name);
}

C4AulFunc *GetFunc(const char *Name, const C4AulScript *Owner, const C4AulFunc *After)
C4AulFunc *GetFunc(const char *Name, const C4AulScript *Owner)
{
return FuncLookUp.GetFunc(Name, Owner, After);
return FuncLookUp.GetFunc(Name, Owner);
}

// For the list of functions in the PropertyDlg
Expand Down
2 changes: 1 addition & 1 deletion src/C4AulParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3191,7 +3191,7 @@ bool C4AulParseState::Parse_Expression3()
// search a function with the given name
if (eCallType == AB_CALLGLOBAL)
{
pFunc = a->Engine->GetFunc(Idtf, a->Engine, nullptr);
pFunc = a->Engine->GetFunc(Idtf, a->Engine);
// allocate space for return value, otherwise the call-target-variable is used, which is not present here
AddBCC(AB_STACK, +1);
}
Expand Down

0 comments on commit ec522eb

Please sign in to comment.