loader: Make evmc_last_error_msg() return error only once

This commit is contained in:
Paweł Bylica 2019-04-17 07:40:59 +02:00
parent bde20b1f4c
commit caf6c2a1bd
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
2 changed files with 6 additions and 2 deletions

View File

@ -105,10 +105,12 @@ struct evmc_instance* evmc_load_and_create(const char* filename,
/**
* Returns the human-readable message describing the most recent error
* that occurred in EVMC loading.
* that occurred in EVMC loading since the last call to this function.
*
* In case any loading function returned ::EVMC_LOADER_SUCCESS this function always returns NULL.
* In case of error code other than success returned, this function MAY return the error message.
* Calling this function "consumes" the error message and the function will return NULL
* from subsequent invocations.
* This function is not thread-safe.
*
* @return Error message or NULL if no additional information is available.

View File

@ -140,7 +140,9 @@ exit:
const char* evmc_last_error_msg()
{
return last_error_msg;
const char* m = last_error_msg;
last_error_msg = NULL;
return m;
}
struct evmc_instance* evmc_load_and_create(const char* filename,