common.h (smbnetfs-0.6.0) | : | common.h (smbnetfs-0.6.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
/* gcc specific extension. does nothing on other compilers */ | /* gcc specific extension. does nothing on other compilers */ | |||
#if defined(__GNUC__) | #if defined(__GNUC__) | |||
#define ATTRIB(x) __attribute__ (x) | #define ATTRIB(x) __attribute__ (x) | |||
#else | #else | |||
#define ATTRIB(x) /* no attributes */ | #define ATTRIB(x) /* no attributes */ | |||
#endif | #endif | |||
extern int common_debug_level; | extern int common_debug_level; | |||
void common_init(void); | ||||
int common_set_smbnetfs_debug_level(int level); | int common_set_smbnetfs_debug_level(int level); | |||
int common_set_log_file(const char *logfile); | int common_set_log_file(const char *logfile); | |||
void common_debug_print(const char *fmt, ...) ATTRIB((format(printf, 1, 2))); | void common_debug_print(const char *fmt, ...) ATTRIB((format(printf, 1, 2))); | |||
void common_print_backtrace(void); | void common_print_backtrace(void); | |||
static inline int common_get_smbnetfs_debug_level(void){ | static inline int common_get_smbnetfs_debug_level(void){ | |||
return g_atomic_int_get(&common_debug_level); | return g_atomic_int_get(&common_debug_level); | |||
} | } | |||
skipping to change at line 43 | skipping to change at line 45 | |||
gettimeofday(&__now, NULL); \ | gettimeofday(&__now, NULL); \ | |||
char __tstamp[20]; \ | char __tstamp[20]; \ | |||
struct tm __tm; \ | struct tm __tm; \ | |||
localtime_r(&__now.tv_sec, &__tm); \ | localtime_r(&__now.tv_sec, &__tm); \ | |||
strftime(__tstamp, 20, "%Y-%m-%d %T", &__tm); \ | strftime(__tstamp, 20, "%Y-%m-%d %T", &__tm); \ | |||
common_debug_print("%.19s.%03d " fmt, __tstamp, (int)(__now.tv_usec / 1000), ## args); \ | common_debug_print("%.19s.%03d " fmt, __tstamp, (int)(__now.tv_usec / 1000), ## args); \ | |||
} | } | |||
#ifdef PRINTF_DEBUG | #ifdef PRINTF_DEBUG | |||
#include <stdio.h> | #include <stdio.h> | |||
#define DPRINTF(level, fmt, args...) { fprintf(stderr, "%d->%s: " fmt, getpid(), __FUNCTION__, ## args); fflush(stderr); } | #define DPRINTF(level, fmt, args...) dprintf(fileno(stderr), "%d->%s: " fmt, getpid(), __FUNCTION__, ## args) | |||
#else | #else | |||
#define DPRINTF(level, fmt, args...) DEBUG_PRINT(level, "%d->%s: " fmt , getpid(), __FUNCTION__, ## args) | #define DPRINTF(level, fmt, args...) DEBUG_PRINT(level, "%d->%s: " fmt , getpid(), __FUNCTION__, ## args) | |||
#endif | #endif | |||
#ifndef HAVE_STRNDUP | ||||
char* strndup(const char *s, size_t n); | ||||
#endif | ||||
#endif /* __COMMON_H__ */ | #endif /* __COMMON_H__ */ | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 3 lines changed or added |