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:
2026-08-19 02:34:28 -04:00
parent 50d71ca55f
commit 71d409b5c7
9 changed files with 21 additions and 44 deletions

View File

@@ -154,7 +154,7 @@ typedef struct dpm_open_overrides {
/**
* @brief What the library read from a module at load
*
* Filled by dpm_module_info_of() and by dpm_cursor_next(). The string
* Filled by dpm_get_module_info() and by dpm_cursor_next(). The string
* pointers remain valid until the context is closed.
*/
typedef struct dpm_module_info {
@@ -215,7 +215,7 @@ void dpm_close(dpm_ctx* ctx);
* calls return the same handle.
*
* Version compatibility is the caller's judgement: read the loaded
* module's version with dpm_module_info_of() and decide whether it is
* module's version with dpm_get_module_info() and decide whether it is
* acceptable.
*
* @param ctx The libdpm-core.so context
@@ -240,8 +240,8 @@ dpm_module* dpm_require(dpm_ctx* ctx, const char* name);
* @return 0 on success, nonzero if the module cannot be reported on
*/
DPM_PUBLIC_ABI_EXPORT
int dpm_module_info_of(dpm_ctx* ctx, dpm_module* mod,
dpm_module_info* out);
int dpm_get_module_info(dpm_ctx* ctx, dpm_module* mod,
dpm_module_info* out);
/**
* @brief Dispatches a command to a module
@@ -399,7 +399,7 @@ const char* dpm_get_last_error(dpm_ctx* ctx);
*
* dpm_module_execute is the only entry through which a module performs
* work. The other two are what it reports about itself; the library
* reads both at load and serves them through dpm_module_info_of.
* reads both at load and serves them through dpm_get_module_info.
*/
#ifdef __cplusplus