Added COLD_BLOCK and HOT_BLOCK (for now), not sure if they work but they"re added.

Marked the error-handling routine of `_map_handle_err()` as `COLD_BLOCK`.

Fortune for naka's current commit: Future blessing − 末吉
master
Avril 3 years ago
parent 145781a293
commit 2ed48ec977
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -88,6 +88,11 @@
__attribute__((hot)); \
expr; \
})
// Use like: COLD_BLOCK { ... }
// XXX: I'm not exactly sure if these hacks work.. Should test.
#define COLD_BLOCK if(UNLIKELY(1))
// Use like: HOT_BLOCK { ... }
#define HOT_BLOCK if(LIKELY(1))
/// Equivalent to GNU C `x ?: y` operator.
#define TERN_OR(x, y) ({ let _x = (x); _x ? _x : (y); })

@ -53,7 +53,7 @@ const char* map_error_str(map_result_t res);
_mixin int _map_handle_err(const char* stmt, const char* file, int line, const char* func, map_result_t res)
{
if(res == MAP_SUCCESS) return 1;
else {
else COLD_BLOCK {
const char* err = map_error_str(res);
ERROR("mapping failed at %s:%d->%s(): on stmt `%s`", file, line, func, stmt);
switch(res) {

Loading…
Cancel
Save