diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-01-02 12:54:02 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-01-02 12:54:02 +0000 |
commit | a746483fd8eda59a0f42719186912ceabba2f4ac (patch) | |
tree | 41bcf9c9781d572ba675c2a233e969956ed5accf /source3 | |
parent | e030b91bf8416654007daa1f493b36fb59cf5b58 (diff) | |
download | samba-a746483fd8eda59a0f42719186912ceabba2f4ac.tar.gz samba-a746483fd8eda59a0f42719186912ceabba2f4ac.tar.bz2 samba-a746483fd8eda59a0f42719186912ceabba2f4ac.zip |
Add PRINTF_ATTRIBUTE() to a few more printf() style functions. Aids in
compiler-based argument checking.
(This used to be commit 16fe928e68623a878b125910ff83df500a29d0ce)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/includes.h | 9 | ||||
-rw-r--r-- | source3/include/xfile.h | 2 | ||||
-rw-r--r-- | source3/lib/dprintf.c | 2 | ||||
-rw-r--r-- | source3/lib/system.c | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 2 | ||||
-rw-r--r-- | source3/lib/util_str.c | 4 | ||||
-rw-r--r-- | source3/lib/xfile.c | 4 |
7 files changed, 18 insertions, 7 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h index 9b19904962..29580a9192 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1160,6 +1160,15 @@ int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4); int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3); #endif +void sys_adminlog(int priority, const char *format_str, ...) PRINTF_ATTRIBUTE(2,3); + +int pstr_sprintf(pstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +int fstr_sprintf(fstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); + +int d_vfprintf(FILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0); + +int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0); + /* we used to use these fns, but now we have good replacements for snprintf and vsnprintf */ #define slprintf snprintf diff --git a/source3/include/xfile.h b/source3/include/xfile.h index a573b59a4a..89fa9d1e11 100644 --- a/source3/include/xfile.h +++ b/source3/include/xfile.h @@ -44,4 +44,6 @@ extern XFILE *x_stdin, *x_stdout, *x_stderr; #define x_getc(f) x_fgetc(f) +int x_vfprintf(XFILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0); +int x_fprintf(XFILE *f, const char *format, ...) PRINTF_ATTRIBUTE(2, 3); #endif /* _XFILE_H_ */ diff --git a/source3/lib/dprintf.c b/source3/lib/dprintf.c index f0f09e199d..70387bbd61 100644 --- a/source3/lib/dprintf.c +++ b/source3/lib/dprintf.c @@ -31,7 +31,7 @@ #include "includes.h" -int d_vfprintf(FILE *f, const char *format, va_list ap) + int d_vfprintf(FILE *f, const char *format, va_list ap) { char *p, *p2; int ret, maxlen, clen; diff --git a/source3/lib/system.c b/source3/lib/system.c index fed9b117ca..18cccda935 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1233,7 +1233,7 @@ int sys_dup2(int oldfd, int newfd) Wrapper for Admin Logs. ****************************************************************************/ -void sys_adminlog(int priority, const char *format_str, ...) + void sys_adminlog(int priority, const char *format_str, ...) { va_list ap; int ret; diff --git a/source3/lib/util.c b/source3/lib/util.c index 39c58534cd..67de9e4bf2 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2080,7 +2080,7 @@ char *smb_xstrndup(const char *s, size_t n) vasprintf that aborts on malloc fail */ -int smb_xvasprintf(char **ptr, const char *format, va_list ap) + int smb_xvasprintf(char **ptr, const char *format, va_list ap) { int n; va_list ap2; diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index a76278e532..7ffd71bde9 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1116,7 +1116,7 @@ char *binary_string(char *buf, int len) Just a typesafety wrapper for snprintf into a pstring. ********************************************************************/ -int pstr_sprintf(pstring s, const char *fmt, ...) + int pstr_sprintf(pstring s, const char *fmt, ...) { va_list ap; int ret; @@ -1131,7 +1131,7 @@ int pstr_sprintf(pstring s, const char *fmt, ...) Just a typesafety wrapper for snprintf into a fstring. ********************************************************************/ -int fstr_sprintf(fstring s, const char *fmt, ...) + int fstr_sprintf(fstring s, const char *fmt, ...) { va_list ap; int ret; diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c index 7621712e9a..57f3e27638 100644 --- a/source3/lib/xfile.c +++ b/source3/lib/xfile.c @@ -184,7 +184,7 @@ int x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) } /* thank goodness for asprintf() */ -int x_vfprintf(XFILE *f, const char *format, va_list ap) + int x_vfprintf(XFILE *f, const char *format, va_list ap) { char *p; int len, ret; @@ -199,7 +199,7 @@ int x_vfprintf(XFILE *f, const char *format, va_list ap) return ret; } -int x_fprintf(XFILE *f, const char *format, ...) + int x_fprintf(XFILE *f, const char *format, ...) { va_list ap; int ret; |