From e6bdf57820121b6eac9f35c8ef53a4e7a76205e1 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 20 May 2018 18:18:40 -0400 Subject: Better hal_core_alloc() semantics, assert() and printf() cleanup. Various fixes extracted from the abandoned(-for-now?) reuse-cores branch, principally: * Change hal_core_alloc*() to support core reuse and to pick the least-recently-used core of a particular type otherwise; * Replace assert() and printf() calls with hal_assert() and hal_log(), respectively. assert() is particularly useless on the HSM, since it sends its error message into hyperspace then hangs the HSM. --- rpc_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rpc_client.c') diff --git a/rpc_client.c b/rpc_client.c index e968369..13ea265 100644 --- a/rpc_client.c +++ b/rpc_client.c @@ -45,7 +45,7 @@ #if HAL_RPC_CLIENT_DEBUG #include -#define check(op) do { const hal_error_t _err_ = (op); if (_err_ != HAL_OK) { printf("%s returned %d (%s)\n", #op, _err_, hal_error_string(_err_)); return _err_; } } while (0) +#define check(op) do { const hal_error_t _err_ = (op); if (_err_ != HAL_OK) { hal_log(HAL_LOG_DEBUG, "%s returned %d (%s)", #op, _err_, hal_error_string(_err_)); return _err_; } } while (0) #else #define check(op) do { const hal_error_t _err_ = (op); if (_err_ != HAL_OK) { return _err_; } } while (0) #endif @@ -73,14 +73,14 @@ static hal_error_t read_matching_packet(const rpc_func_num_t expected_func, size_t ilen = inbuf_max; hal_error_t err; - assert(inbuf != NULL && iptr != NULL && ilimit != NULL); + hal_assert(inbuf != NULL && iptr != NULL && ilimit != NULL); do { if ((err = hal_rpc_recv(inbuf, &ilen)) != HAL_OK) return err; - assert(ilen <= inbuf_max); + hal_assert(ilen <= inbuf_max); *iptr = inbuf; *ilimit = inbuf + ilen; -- cgit v1.2.3