One way to record an error, and a name that reads as a query
dpm_module_info_of becomes dpm_get_module_info, joining the other two readers on the context in stating that a call fetches a value. Recording an error had two entry points doing the same write: the exported dpm_set_last_error and an internal dpm_core::set_last_error taking a std::string. The internal one is gone and the loader calls the exported function, so a reason reaches the context by one path whether a module or the library records it.
This commit is contained in:
@@ -67,8 +67,8 @@ struct dpm_ctx {
|
||||
* @brief Internal implementation of libdpm-core.so
|
||||
*
|
||||
* Holds what the library's translation units share with each other and
|
||||
* with nothing else: the loader, the configuration reader, the error
|
||||
* recorder, and the version parser. It is declared in include/internal/,
|
||||
* with nothing else: the loader, the configuration reader, the value
|
||||
* sanitizers, and the version parser. It is declared in include/internal/,
|
||||
* which is never installed, so a consumer or a module cannot name any of
|
||||
* it.
|
||||
*
|
||||
@@ -82,12 +82,3 @@ struct dpm_ctx {
|
||||
* unnamed namespace instead, which gives them internal linkage and keeps
|
||||
* them from colliding across files.
|
||||
*/
|
||||
namespace dpm_core {
|
||||
/**
|
||||
* @brief Records a failure reason on the context
|
||||
*
|
||||
* @param ctx The libdpm-core.so context; NULL is a no-op
|
||||
* @param msg The failure description
|
||||
*/
|
||||
void set_last_error(dpm_ctx* ctx, const std::string& msg);
|
||||
} // namespace dpm_core
|
||||
|
||||
Reference in New Issue
Block a user