Skip to content

Commit

Permalink
Fix nasa#832 Final change for override
Browse files Browse the repository at this point in the history
Removed UT_DoSetOverride.
Due to the Va function not being adopted, there is only 1 use of this
code and it does not require encapsulation.
Removed in defference to not adding more functions.
  • Loading branch information
asgibson committed Mar 5, 2021
1 parent 7878ce0 commit 6fcc3a0
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions ut_assert/src/utstubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,24 +184,6 @@ static UT_StubTableEntry_t *UT_GetStubEntry(UT_EntryKey_t FuncKey, UT_EntryType_
return (StubPtr);
}

static void UT_DoSetOverride(UT_EntryKey_t FuncKey)
{
UT_StubTableEntry_t *StubPtr;

/* check if there is already an entry */
StubPtr = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_OVERRIDE_STUB);

/* If NULL, then this is the first set, set a UT_ENTRYTYPE_OVERRIDE_STUB */
if (StubPtr == NULL)
{
StubPtr = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_UNUSED);

StubPtr->FuncKey = FuncKey;
StubPtr->EntryType = UT_ENTRYTYPE_OVERRIDE_STUB;
}

}

void UT_ResetState(UT_EntryKey_t FuncKey)
{
UT_StubTableEntry_t *StubPtr;
Expand Down Expand Up @@ -623,7 +605,19 @@ void UT_SetHookFunction(UT_EntryKey_t FuncKey, UT_HookFunc_t HookFunc, void *Use

void UT_SetHookOverrideStubFunction(UT_EntryKey_t FuncKey, UT_HookFunc_t HookFunc, void *UserObj)
{
UT_DoSetOverride(FuncKey);
UT_StubTableEntry_t *StubPtr;

/* check if there is already an entry */
StubPtr = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_OVERRIDE_STUB);

/* If NULL, then this is the first set, set a UT_ENTRYTYPE_OVERRIDE_STUB */
if (StubPtr == NULL)
{
StubPtr = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_UNUSED);

StubPtr->FuncKey = FuncKey;
StubPtr->EntryType = UT_ENTRYTYPE_OVERRIDE_STUB;
}

UT_SetHookFunction(FuncKey, HookFunc, UserObj);
}
Expand Down

0 comments on commit 6fcc3a0

Please sign in to comment.