Use GNUC format attribute on print functions

Closes #1059
This commit is contained in:
Campbell Barton 2014-07-18 11:25:41 +10:00 committed by TingPing
parent 21c0e47869
commit 93caf4c7b4
5 changed files with 26 additions and 10 deletions

View File

@ -88,11 +88,19 @@ struct _hexchat_plugin
void (*hexchat_print) (hexchat_plugin *ph,
const char *text);
void (*hexchat_printf) (hexchat_plugin *ph,
const char *format, ...);
const char *format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
;
void (*hexchat_command) (hexchat_plugin *ph,
const char *command);
void (*hexchat_commandf) (hexchat_plugin *ph,
const char *format, ...);
const char *format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
;
int (*hexchat_nickcmp) (hexchat_plugin *ph,
const char *s1,
const char *s2);
@ -254,7 +262,11 @@ hexchat_print (hexchat_plugin *ph,
void
hexchat_printf (hexchat_plugin *ph,
const char *format, ...);
const char *format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
;
void
hexchat_command (hexchat_plugin *ph,
@ -262,7 +274,11 @@ hexchat_command (hexchat_plugin *ph,
void
hexchat_commandf (hexchat_plugin *ph,
const char *format, ...);
const char *format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
;
int
hexchat_nickcmp (hexchat_plugin *ph,

View File

@ -273,7 +273,7 @@ tcp_send (server *serv, char *buf)
}*/
void
tcp_sendf (server *serv, char *fmt, ...)
tcp_sendf (server *serv, const char *fmt, ...)
{
va_list args;
/* keep this buffer in BSS. Converting UTF-8 to ISO-8859-x might make the

View File

@ -25,7 +25,7 @@ extern GSList *serv_list;
/* eventually need to keep the tcp_* functions isolated to server.c */
int tcp_send_len (server *serv, char *buf, int len);
int tcp_send (server *serv, char *buf);
void tcp_sendf (server *serv, char *fmt, ...);
void tcp_sendf (server *serv, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
int tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int len);
server *server_new (void);

View File

@ -927,7 +927,7 @@ PrintText (session *sess, char *text)
}
void
PrintTextf (session *sess, char *format, ...)
PrintTextf (session *sess, const char *format, ...)
{
va_list args;
char *buf;
@ -941,7 +941,7 @@ PrintTextf (session *sess, char *format, ...)
}
void
PrintTextTimeStampf (session *sess, time_t timestamp, char *format, ...)
PrintTextTimeStampf (session *sess, time_t timestamp, const char *format, ...)
{
va_list args;
char *buf;

View File

@ -43,8 +43,8 @@ void scrollback_load (session *sess);
int text_word_check (char *word, int len);
void PrintText (session *sess, char *text);
void PrintTextTimeStamp (session *sess, char *text, time_t timestamp);
void PrintTextf (session *sess, char *format, ...);
void PrintTextTimeStampf (session *sess, time_t timestamp, char *format, ...);
void PrintTextf (session *sess, const char *format, ...) G_GNUC_PRINTF (2, 3);
void PrintTextTimeStampf (session *sess, time_t timestamp, const char *format, ...) G_GNUC_PRINTF (3, 4);
void log_close (session *sess);
void log_open_or_close (session *sess);
void load_text_events (void);