support passing args to request handle for elimination of global var

This commit is contained in:
Rongsong Shen 2025-12-11 17:07:51 +08:00
parent 79124c6e5c
commit 486b38d679
8 changed files with 120 additions and 19 deletions

View file

@ -76,7 +76,8 @@ void xcecli_ctx_fini(xcecli_ctx_t c)
free(ctx);
}
int xcecli_set_handler(xcecli_ctx_t c, xce_request_handler_t handler)
int xcecli_set_handler(xcecli_ctx_t c, xce_request_handler_t handler,
void* args)
{
api_ctx_t* ctx = (api_ctx_t*)c;
@ -84,7 +85,7 @@ int xcecli_set_handler(xcecli_ctx_t c, xce_request_handler_t handler)
return -EINVAL;
}
return xce_ctx_set_handler(&(ctx->ctx), handler);
return xce_ctx_set_handler(&(ctx->ctx), handler, args);
}
int xcecli_wakeup(xcecli_ctx_t c, int status)