diff --git a/src/libstore-c/nix_api_store.cc b/src/libstore-c/nix_api_store.cc index 93e1626a1..d80ba332e 100644 --- a/src/libstore-c/nix_api_store.cc +++ b/src/libstore-c/nix_api_store.cc @@ -62,7 +62,7 @@ nix_err nix_store_get_uri(nix_c_context * context, Store * store, void * callbac context->last_err_code = NIX_OK; try { auto res = store->ptr->getUri(); - return call_nix_observe_string(res, callback, user_data); + return call_nix_get_string_callback(res, callback, user_data); } NIXC_CATCH_ERRS } @@ -73,7 +73,7 @@ nix_err nix_store_get_version(nix_c_context * context, Store * store, void * cal context->last_err_code = NIX_OK; try { auto res = store->ptr->getVersion(); - return call_nix_observe_string(res.value_or(""), callback, user_data); + return call_nix_get_string_callback(res.value_or(""), callback, user_data); } NIXC_CATCH_ERRS } diff --git a/src/libstore-c/nix_api_store.h b/src/libstore-c/nix_api_store.h index 25175de44..1309f99b7 100644 --- a/src/libstore-c/nix_api_store.h +++ b/src/libstore-c/nix_api_store.h @@ -73,7 +73,7 @@ void nix_store_free(Store * store); * @param[in] store nix store reference * @param[in] callback Called with the URI. * @param[in] user_data optional, arbitrary data, passed to the callback when it's called. - * @see nix_observe_string + * @see nix_get_string_callback * @return error code, NIX_OK on success. */ nix_err nix_store_get_uri(nix_c_context * context, Store * store, void * callback, void * user_data); @@ -133,7 +133,7 @@ nix_err nix_store_realise( * @param[in] store nix store reference * @param[in] callback Called with the version. * @param[in] user_data optional, arbitrary data, passed to the callback when it's called. - * @see nix_observe_string + * @see nix_get_string_callback * @return error code, NIX_OK on success. */ nix_err nix_store_get_version(nix_c_context * context, Store * store, void * callback, void * user_data); diff --git a/src/libutil-c/nix_api_util.cc b/src/libutil-c/nix_api_util.cc index ed542059d..8d0f7ac38 100644 --- a/src/libutil-c/nix_api_util.cc +++ b/src/libutil-c/nix_api_util.cc @@ -72,7 +72,7 @@ nix_err nix_setting_get(nix_c_context * context, const char * key, void * callba std::map settings; nix::globalConfig.getSettings(settings); if (settings.contains(key)) { - return call_nix_observe_string(settings[key].value, callback, user_data); + return call_nix_get_string_callback(settings[key].value, callback, user_data); } else { return nix_set_err_msg(context, NIX_ERR_KEY, "Setting not found"); } @@ -122,7 +122,7 @@ nix_err nix_err_name(nix_c_context * context, const nix_c_context * read_context if (read_context->last_err_code != NIX_ERR_NIX_ERROR) { return nix_set_err_msg(context, NIX_ERR_UNKNOWN, "Last error was not a nix error"); } - return call_nix_observe_string(read_context->name, callback, user_data); + return call_nix_get_string_callback(read_context->name, callback, user_data); } nix_err nix_err_info_msg(nix_c_context * context, const nix_c_context * read_context, void * callback, void * user_data) @@ -132,7 +132,7 @@ nix_err nix_err_info_msg(nix_c_context * context, const nix_c_context * read_con if (read_context->last_err_code != NIX_ERR_NIX_ERROR) { return nix_set_err_msg(context, NIX_ERR_UNKNOWN, "Last error was not a nix error"); } - return call_nix_observe_string(read_context->info->msg.str(), callback, user_data); + return call_nix_get_string_callback(read_context->info->msg.str(), callback, user_data); } nix_err nix_err_code(const nix_c_context * read_context) @@ -141,8 +141,8 @@ nix_err nix_err_code(const nix_c_context * read_context) } // internal -nix_err call_nix_observe_string(const std::string str, void * callback, void * user_data) +nix_err call_nix_get_string_callback(const std::string str, void * callback, void * user_data) { - ((nix_observe_string) callback)(str.c_str(), str.size(), user_data); + ((nix_get_string_callback) callback)(str.c_str(), str.size(), user_data); return NIX_OK; } diff --git a/src/libutil-c/nix_api_util.h b/src/libutil-c/nix_api_util.h index fc6dc8655..cb506ca90 100644 --- a/src/libutil-c/nix_api_util.h +++ b/src/libutil-c/nix_api_util.h @@ -124,9 +124,9 @@ typedef struct nix_c_context nix_c_context; * * @param[in] start the string to copy. * @param[in] n the string length. - * @param[in] user_data optional, arbitrary data, passed to the nix_observe_string when it's called. + * @param[in] user_data optional, arbitrary data, passed to the nix_get_string_callback when it's called. */ -typedef void (*nix_observe_string)(const char * start, unsigned int n, void * user_data); +typedef void (*nix_get_string_callback)(const char * start, unsigned int n, void * user_data); // Function prototypes @@ -171,7 +171,7 @@ nix_err nix_libutil_init(nix_c_context * context); * @param[in] key The key of the setting to retrieve. * @param[in] callback Called with the setting value. * @param[in] user_data optional, arbitrary data, passed to the callback when it's called. - * @see nix_observe_string + * @see nix_get_string_callback * @return NIX_ERR_KEY if the setting is unknown, or NIX_OK if the setting was retrieved * successfully. */ @@ -238,7 +238,7 @@ const char * nix_err_msg(nix_c_context * context, const nix_c_context * ctx, uns * @param[in] read_context the context to retrieve the error message from. * @param[in] callback Called with the error message. * @param[in] user_data optional, arbitrary data, passed to the callback when it's called. - * @see nix_observe_string + * @see nix_get_string_callback * @return NIX_OK if there were no errors, an error code otherwise. */ nix_err @@ -257,7 +257,7 @@ nix_err_info_msg(nix_c_context * context, const nix_c_context * read_context, vo * @param[in] read_context the context to retrieve the error message from * @param[in] callback Called with the error name. * @param[in] user_data optional, arbitrary data, passed to the callback when it's called. - * @see nix_observe_string + * @see nix_get_string_callback * @return NIX_OK if there were no errors, an error code otherwise. */ nix_err nix_err_name(nix_c_context * context, const nix_c_context * read_context, void * callback, void * user_data); diff --git a/src/libutil-c/nix_api_util_internal.h b/src/libutil-c/nix_api_util_internal.h index f91d8c118..6e8eac020 100644 --- a/src/libutil-c/nix_api_util_internal.h +++ b/src/libutil-c/nix_api_util_internal.h @@ -20,16 +20,16 @@ nix_err nix_context_error(nix_c_context * context); /** * Internal use only. * - * Helper to invoke nix_observe_string + * Helper to invoke nix_get_string_callback * @param context optional, the context to store errors in if this function * fails * @param str The string to observe * @param callback Called with the observed string. * @param user_data optional, arbitrary data, passed to the callback when it's called. * @return NIX_OK if there were no errors. - * @see nix_observe_string + * @see nix_get_string_callback */ -nix_err call_nix_observe_string(const std::string str, void * callback, void * user_data); +nix_err call_nix_get_string_callback(const std::string str, void * callback, void * user_data); #define NIXC_CATCH_ERRS \ catch (...) \