Skip to content

Commit

Permalink
Fix #722, update UT_SetDefaultReturnValue comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zanzaben committed Jan 22, 2021
1 parent 3fa2f50 commit e248041
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 5 additions & 10 deletions ut_assert/inc/utstubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,16 @@ void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, size_t BufferSize
void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, size_t *MaxSize, size_t *Position);

/**
* Enable or disable the forced failure mode for the given stub function
*
* This triggers a constant failure mode from the stub function, if implemented.
* The stub function will invoke a given failure path as defined by
* the stub implementation.
*
* A count of the number of times the failure mode is invoked will be maintained.
* Set the default return value for the given stub function.
* User needs to use UT_ClearDefaultReturnValue to clear the value.
*
* \param FuncKey The stub function to add the return code to.
* \param Value Arbitrary failure mode value (may or may not be used by the stub)
* \param Value Arbitrary return value (may or may not be used by the stub)
*/
void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value);

/**
* Disable the forced failure mode for the given stub function
* Disable the default return for the given stub function
*
* This undoes the action of UT_SetDefaultReturnValue()
*
Expand Down Expand Up @@ -226,7 +221,7 @@ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value);
*
* \param FuncKey The stub function entry to clear.
*
* @deprecated replaced by UT_ClearDefaultReturnValue
* @deprecated replaced by UT_ClearDefaultReturnValue
*/
void UT_ClearForceFail(UT_EntryKey_t FuncKey);
#endif
Expand Down
4 changes: 2 additions & 2 deletions ut_assert/src/utstubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@ void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value)
UT_StubTableEntry_t *Rc;

/*
* First find an existing force fail entry for the function.
* First find an existing default return value entry for the function.
* In case one is already set we do not duplicate (unlike deferred codes)
*/
Rc = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_FORCE_FAIL);
if (Rc == NULL)
{
/* Creating force fail entry - repeat search and grab any unused slot */
/* Creating default return value entry - repeat search and grab any unused slot */
Rc = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_UNUSED);
}

Expand Down

0 comments on commit e248041

Please sign in to comment.