diff -ur ../ntfs-3g_ntfsprogs-2015.3.14.orig/include/ntfs-3g/logging.h ./include/ntfs-3g/logging.h --- ../ntfs-3g_ntfsprogs-2015.3.14.orig/include/ntfs-3g/logging.h 2015-03-14 15:10:12.000000000 +0100 +++ ./include/ntfs-3g/logging.h 2015-07-28 14:26:42.130155915 +0200 @@ -33,6 +33,9 @@ #include "types.h" +/* AVM: logging stuff only for DEBUG builds to reduce code size */ + +#ifdef DEBUG /* Function prototype for the logging handlers */ typedef int (ntfs_log_handler)(const char *function, const char *file, int line, u32 level, void *data, const char *format, va_list args); @@ -48,23 +51,46 @@ ntfs_log_handler ntfs_log_handler_stdout __attribute__((format(printf, 6, 0))); ntfs_log_handler ntfs_log_handler_outerr __attribute__((format(printf, 6, 0))); ntfs_log_handler ntfs_log_handler_stderr __attribute__((format(printf, 6, 0))); +#else +#define ntfs_log_set_handler(handler) do {} while(0) +#endif /* Enable/disable certain log levels */ +#ifdef DEBUG u32 ntfs_log_set_levels(u32 levels); u32 ntfs_log_clear_levels(u32 levels); u32 ntfs_log_get_levels(void); +#else +#define ntfs_log_set_levels(levels) 0 +#define ntfs_log_clear_levels(levels) 0 +#define ntfs_log_get_levels(levels) 0 +#endif /* Enable/disable certain log flags */ +#ifdef DEBUG u32 ntfs_log_set_flags(u32 flags); u32 ntfs_log_clear_flags(u32 flags); u32 ntfs_log_get_flags(void); +#else +#define ntfs_log_set_flags(flags) 0 +#define ntfs_log_clear_flags(flags) 0 +#define ntfs_log_get_flags() 0 +#endif /* Turn command-line options into logging flags */ +#ifdef DEBUG BOOL ntfs_log_parse_option(const char *option); +#else +#define ntfs_log_parse_option(option) TRUE +#endif +#ifdef DEBUG int ntfs_log_redirect(const char *function, const char *file, int line, u32 level, void *data, const char *format, ...) __attribute__((format(printf, 6, 7))); +#else +#define ntfs_log_redirect(func, file, line, level, data, format, args...) 0 +#endif /* Logging levels - Determine what gets logged */ #define NTFS_LOG_LEVEL_DEBUG (1 << 0) /* x = 42 */ @@ -90,6 +116,7 @@ /* Macros to simplify logging. One for each level defined above. * Note, ntfs_log_debug/trace have effect only if DEBUG is defined. */ +#ifdef DEBUG #define ntfs_log_critical(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS) #define ntfs_log_error(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS) #define ntfs_log_info(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_INFO,NULL,FORMAT,##ARGS) @@ -98,6 +125,16 @@ #define ntfs_log_quiet(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS) #define ntfs_log_verbose(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS) #define ntfs_log_warning(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS) +#else +#define ntfs_log_critical(FORMAT, ARGS...) do {} while (0) +#define ntfs_log_error(FORMAT, ARGS...) do {} while (0) +#define ntfs_log_info(FORMAT, ARGS...) do {} while (0) +#define ntfs_log_perror(FORMAT, ARGS...) do {} while (0) +#define ntfs_log_progress(FORMAT, ARGS...) do {} while (0) +#define ntfs_log_quiet(FORMAT, ARGS...) do {} while (0) +#define ntfs_log_verbose(FORMAT, ARGS...) do {} while (0) +#define ntfs_log_warning(FORMAT, ARGS...) do {} while (0) +#endif /* By default debug and trace messages are compiled into the program, * but not displayed. @@ -114,8 +151,12 @@ #define ntfs_log_leave(FORMAT, ARGS...)do {} while (0) #endif /* DEBUG */ +#ifdef DEBUG void ntfs_log_early_error(const char *format, ...) __attribute__((format(printf, 1, 2))); +#else +#define ntfs_log_early_error(FORMAT, ARGS...) do {} while (0) +#endif #endif /* _LOGGING_H_ */ diff -ur ../ntfs-3g_ntfsprogs-2015.3.14.orig/libntfs-3g/logging.c ./libntfs-3g/logging.c --- ../ntfs-3g_ntfsprogs-2015.3.14.orig/libntfs-3g/logging.c 2015-03-14 15:10:12.000000000 +0100 +++ ./libntfs-3g/logging.c 2015-07-28 14:26:42.114155915 +0200 @@ -21,6 +21,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef DEBUG /* AVM: logging stuff only for DEBUG builds to reduce code size */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -635,3 +637,4 @@ return FALSE; } +#endif /* DEBUG */