diff options
author | Ryo Nakamura <upa@haeena.net> | 2024-02-06 21:54:04 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2024-02-06 21:54:04 +0900 |
commit | 4f0669f8f86acb09f10ffb5af273f86d8d6ddd34 (patch) | |
tree | 65d5d0adfd90e31b77474993addeb065edfeb75c /src/util.h | |
parent | 76892a69f95f7dcf47050800385bc610f8ccf5f3 (diff) |
refactor error message-related functions
split message print fuctions (mpr_*), strerrno, and mscp_get/set_error
into print.c/h and strerrno.c/h.
ToDo: revise usages of priv_set_errv and pr_* functions.
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/util.h b/src/util.h deleted file mode 100644 index e678db0..0000000 --- a/src/util.h +++ /dev/null @@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-only */ -#ifndef _UTIL_H_ -#define _UTIL_H_ - -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <libgen.h> - -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) - - -#define pr(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) - -#define pr_info(fmt, ...) fprintf(stderr, "INFO:%s(): " fmt, \ - __func__, ##__VA_ARGS__) - -#define pr_warn(fmt, ...) fprintf(stderr, "\x1b[1m\x1b[33m" \ - "WARN:%s():\x1b[0m " fmt, \ - __func__, ##__VA_ARGS__) - -#define pr_err(fmt, ...) fprintf(stderr, "\x1b[1m\x1b[31m" \ - "ERR:%s:%d:%s():\x1b[0m " fmt, \ - basename(__FILE__), __LINE__, __func__, ##__VA_ARGS__) - -#ifdef DEBUG -#define pr_debug(fmt, ...) fprintf(stderr, "\x1b[1m\x1b[33m" \ - "DEBUG:%s():\x1b[0m " fmt, \ - __func__, ##__VA_ARGS__); -#else -#define pr_debug(fmt, ...) -#endif - - -#define min(a, b) (((a) > (b)) ? (b) : (a)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -#endif /* _UTIL_H_ */ |