1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

log: log_oom() must be a macro

This commit is contained in:
Michal Schmidt 2012-07-26 14:07:27 +02:00
parent e239cd8de0
commit cd6f1c0f87

View File

@ -103,10 +103,11 @@ int log_dump_internal(
#define log_warning(...) log_meta(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__) #define log_warning(...) log_meta(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_error(...) log_meta(LOG_ERR, __FILE__, __LINE__, __func__, __VA_ARGS__) #define log_error(...) log_meta(LOG_ERR, __FILE__, __LINE__, __func__, __VA_ARGS__)
static inline int log_oom(void) { /* This must be a macro for __LINE__ etc. to work */
log_error("Out of memory."); #define log_oom() ({ \
return -ENOMEM; log_error("Out of memory."); \
} -ENOMEM; \
})
/* This modifies the buffer passed! */ /* This modifies the buffer passed! */
#define log_dump(level, buffer) log_dump_internal(level, __FILE__, __LINE__, __func__, buffer) #define log_dump(level, buffer) log_dump_internal(level, __FILE__, __LINE__, __func__, buffer)