Skip to content

Commit cc17264

Browse files
author
Edward Thomson
committed
p_snprintf: no need for arguments to a format
`snprintf` requires a _format_ but does not require _arguments_ to the format. eg: `snprintf(buf, 42, "hi")` is perfectly legal. Expand the macro to match. Without this, `p_sprintf(buf, 42, "hi")` errors with: ``` error: expected expression p_snprintf(msg, 42, "hi"); ^ src/unix/posix.h:53:34: note: expanded from macro 'p_snprintf' ^ /usr/include/secure/_stdio.h:57:73: note: expanded from macro 'snprintf' __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__) ```
1 parent 021f494 commit cc17264

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/unix/posix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern char *p_realpath(const char *, char *);
5050
#define p_strcasecmp(s1, s2) strcasecmp(s1, s2)
5151
#define p_strncasecmp(s1, s2, c) strncasecmp(s1, s2, c)
5252
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
53-
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
53+
#define p_snprintf(b, c, ...) snprintf(b, c, __VA_ARGS__)
5454
#define p_mkstemp(p) mkstemp(p)
5555
#define p_chdir(p) chdir(p)
5656
#define p_chmod(p,m) chmod(p, m)

0 commit comments

Comments
 (0)