types: add a scoped region_t

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-16 20:07:25 +01:00
parent cebeb38c1c
commit a320091753
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
1 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,14 @@ typedef pixman_box32_t rect_t;
RC_TYPE(region_t, rc_region, pixman_region32_init, pixman_region32_fini, static inline)
static inline void region_free(region_t *region) {
if (region) {
pixman_region32_fini(region);
}
}
#define scoped_region_t cleanup(region_free) region_t
static inline void dump_region(const region_t *x) {
if (log_get_level_tls() > LOG_LEVEL_TRACE) {
return;