in src/umockcallrecorder.c [558:591]
UMOCKCALL_HANDLE umockcallrecorder_get_last_expected_call(UMOCKCALLRECORDER_HANDLE umock_call_recorder)
{
UMOCKCALL_HANDLE result;
if (umock_call_recorder == NULL)
{
/* Codes_SRS_UMOCKCALLRECORDER_01_033: [ If umock_call_recorder is NULL, umockcallrecorder_get_last_expected_call shall fail and return NULL. ]*/
UMOCK_LOG("umockcallrecorder: NULL umock_call_recorder in get last expected calls.");
result = NULL;
}
else
{
/* Codes_SRS_UMOCKCALLRECORDER_01_079: [ If a lock was created for the call recorder, umockcallrecorder_get_last_expected_call shall acquire the lock in shared mode. ]*/
internal_lock_acquire_shared_if_needed(umock_call_recorder);
{
if (umock_call_recorder->expected_call_count == 0)
{
/* Codes_SRS_UMOCKCALLRECORDER_01_034: [ If no expected call has been recorded for umock_call_recorder then umockcallrecorder_get_last_expected_call shall fail and return NULL. ]*/
UMOCK_LOG("umockcallrecorder: No expected calls recorded.");
result = NULL;
}
else
{
/* Codes_SRS_UMOCKCALLRECORDER_01_032: [ umockcallrecorder_get_last_expected_call shall return the last expected call for the umock_call_recorder call recorder. ]*/
result = umock_call_recorder->expected_calls[umock_call_recorder->expected_call_count - 1].umockcall;
}
/* Codes_SRS_UMOCKCALLRECORDER_01_080: [ If a lock was created for the call recorder, umockcallrecorder_get_last_expected_call shall release the shared lock. ]*/
internal_lock_release_shared_if_needed(umock_call_recorder);
}
}
return result;
}