in src/umock_c.c [264:305]
int umock_c_set_call_recorder(UMOCKCALLRECORDER_HANDLE call_recorder)
{
int result;
if (umock_c_state != UMOCK_C_STATE_INITIALIZED)
{
/* Codes_SRS_UMOCK_C_01_033: [ If the module is not initialized, umock_c_set_call_recorder shall return a non-zero value. ]*/
UMOCK_LOG("umock_c_set_call_recorder: Cannot set the call recorder, umock_c not initialized.");
result = __LINE__;
}
else if (call_recorder == NULL)
{
/* Codes_SRS_UMOCK_C_01_030: [ If call_recorder is NULL, umock_c_set_call_recorder shall return a non-zero value. ]*/
UMOCK_LOG("umock_c_set_call_recorder: NULL call_recorder.");
result = __LINE__;
}
else
{
UMOCKCALLRECORDER_HANDLE new_call_recorder;
/* Codes_SRS_UMOCK_C_01_028: [ umock_c_set_call_recorder shall replace the currently used call recorder with the one identified by the call_recorder argument. ]*/
/* Codes_SRS_UMOCK_C_01_031: [ umock_c_set_call_recorder shall make a copy of call_recorder by calling umockcallrecorder_clone and use the copy for future actions. ]*/
new_call_recorder = umockcallrecorder_clone(call_recorder);
if (new_call_recorder == NULL)
{
/* Codes_SRS_UMOCK_C_01_032: [ If umockcallrecorder_clone fails, umock_c_set_call_recorder shall return a non-zero value. ]*/
UMOCK_LOG("umock_c_set_call_recorder: Failed cloning call recorder.");
result = __LINE__;
}
else
{
/* Codes_SRS_UMOCK_C_01_034: [ The previously used call recorder shall be destroyed by calling umockcallrecorder_destroy. ]*/
umockcallrecorder_destroy(umock_call_recorder);
umock_call_recorder = new_call_recorder;
/* Codes_SRS_UMOCK_C_01_029: [ On success, umock_c_set_call_recorder shall return 0. ]*/
result = 0;
}
}
return result;
}