v0.30.0
BREAKING CHANGES
Macros were removed for better code clarity. They relied on hidden variables, which made the code fragile and easy to misuse, especially in the async operations. If the expected variable was not in scope, the macro would silently fail or produce misleading behavior. Additionally, they caused poor debugging experiences and could have surprising side effects. static inline
functions are now used instead where necessary. However, developers can define their own macros.
// BEFORE
send_text(200, "Hello, World!);
send_json(200, json_string);
send_cbor(200, buf, len);
get_params("slug");
get_query("query");
get_headers("header");
then(context, work_fn, done_fn);
// NOW
send_text(res, 200, "Hello, World!);
send_json(res, 200, json_string);
send_cbor(res, 200, buf, len);
get_params(req, "slug");
get_query(req, "query");
get_headers(req, "header");
then(context, success, error, work_fn, done_fn);
This change was critical, as data frequently passes through context structures, and macros introduce a high risk of misuse and hidden bugs.
NEWS
Four new functions have been added:
- Req *copy_req(const Req *original);
- Res *copy_res(const Res *original);
- void destroy_req(Req *req);
- void destroy_res(Res *res);
These functions allow deep copying and proper destruction of Req
and Res
objects during asynchronous operations. This change prevents dangling pointer issues caused by shallow copy and improves memory safety.