@@ -52,40 +52,6 @@ void __btrfs_error(const char *fmt, ...)
fputc('\n', stderr);
}
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_warning_on(int condition, const char *fmt, ...)
-{
- va_list args;
-
- if (!condition)
- return 0;
-
- fputs(PREFIX_WARNING, stderr);
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fputc('\n', stderr);
-
- return 1;
-}
-
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_error_on(int condition, const char *fmt, ...)
-{
- va_list args;
-
- if (!condition)
- return 0;
-
- fputs(PREFIX_ERROR, stderr);
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fputc('\n', stderr);
-
- return 1;
-}
-
__attribute__ ((format (printf, 1, 2)))
void internal_error(const char *fmt, ...)
{
@@ -50,13 +50,11 @@
#define error_on(cond, fmt, ...) \
do { \
- if ((cond)) \
+ if ((cond)) { \
PRINT_TRACE_ON_ERROR; \
- if ((cond)) \
PRINT_VERBOSE_ERROR; \
- __btrfs_error_on((cond), (fmt), ##__VA_ARGS__); \
- if ((cond)) \
- DO_ABORT_ON_ERROR; \
+ __btrfs_error((fmt), ##__VA_ARGS__); \
+ } \
} while (0)
#define error_btrfs_util(err) \
@@ -81,11 +79,11 @@
#define warning_on(cond, fmt, ...) \
do { \
- if ((cond)) \
+ if ((cond)) { \
PRINT_TRACE_ON_ERROR; \
- if ((cond)) \
PRINT_VERBOSE_ERROR; \
- __btrfs_warning_on((cond), (fmt), ##__VA_ARGS__); \
+ __btrfs_warning((fmt), ##__VA_ARGS__); \
+ } \
} while (0)
__attribute__ ((format (printf, 1, 2)))
@@ -94,12 +92,6 @@ void __btrfs_warning(const char *fmt, ...);
__attribute__ ((format (printf, 1, 2)))
void __btrfs_error(const char *fmt, ...);
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_warning_on(int condition, const char *fmt, ...);
-
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_error_on(int condition, const char *fmt, ...);
-
__attribute__ ((format (printf, 1, 2)))
void internal_error(const char *fmt, ...);
We have different helpers for warning_on and error_on(), which take the condition and then do the printf. However we can just check the condition in the macro and call the normal warning or error helper, so clean this usage up and delete the unneeded message helpers. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- common/messages.c | 34 ---------------------------------- common/messages.h | 20 ++++++-------------- 2 files changed, 6 insertions(+), 48 deletions(-)