Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: move errExit macro into inline function #6217

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@
// dbus proxy path used by firejail and firemon
#define XDG_DBUS_PROXY_PATH "/usr/bin/xdg-dbus-proxy"

#define errExit(msg) do { \
char msgout[500]; \
snprintf(msgout, 500, "Error %s:%d: %s: %s", \
__FILE__, __LINE__, __func__, msg); \
perror(msgout); \
exit(1); \
} while (0)
#define errExit(msg) _errExit(__FILE__, __LINE__, __func__, msg)

static inline void __attribute__((noreturn))
_errExit(const char *fname, int lineno, const char *func, const char *msg) {
char msgout[500];
snprintf(msgout, 500, "Error %s:%d: %s: %s", fname, lineno, func, msg);
perror(msgout);
exit(1);
}

// macro to print ip addresses in a printf statement
#define PRINT_IP(A) \
Expand Down