diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-03-14 11:20:55 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-03-14 11:20:55 +0000 |
commit | 453b91903bb4d6ab08487055254ae33a2dddaf81 (patch) | |
tree | f1c289c5815490d107fe59a9d3dda4ee3d4eef2f | |
parent | 5681c542f68232573b7fe6efa92a66457b3c6b4d (diff) | |
download | libssh-453b91903bb4d6ab08487055254ae33a2dddaf81.tar.gz libssh-453b91903bb4d6ab08487055254ae33a2dddaf81.tar.xz libssh-453b91903bb4d6ab08487055254ae33a2dddaf81.zip |
Enable printf attribute checking on GNU systems.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@272 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r-- | include/libssh/libssh.h | 9 | ||||
-rw-r--r-- | libssh/log.c | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index db524686..4fb6a306 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -41,6 +41,13 @@ typedef unsigned long long uint64_t; #define LIBSSH_VERSION "libssh-0.3-svn" +/* GCC have printf type attribute check. */ +#ifdef __GNUC__ +#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) +#else +#define PRINTF_ATTRIBUTE(a,b) +#endif /* __GNUC__ */ + #ifdef __cplusplus extern "C" { #endif @@ -158,7 +165,7 @@ enum { #define SSH_LOG_FUNCTIONS 4 // every function in and return */ /* log.c */ -void ssh_log(SSH_SESSION *session, int prioriry, char *format, ...); +void ssh_log(SSH_SESSION *session, int prioriry, const char *format, ...) PRINTF_ATTRIBUTE(3, 4); /* session.c */ SSH_SESSION *ssh_new(void); diff --git a/libssh/log.c b/libssh/log.c index fbea05d8..e4d6893e 100644 --- a/libssh/log.c +++ b/libssh/log.c @@ -33,7 +33,7 @@ * \param verbosity verbosity of the event * \param format format string of the log entry */ -void ssh_log(SSH_SESSION *session, int verbosity, char *format, ...){ +void ssh_log(SSH_SESSION *session, int verbosity, const char *format, ...) { char buffer[1024]; char buf2[256]; int min; |