Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overloadable attributes for vsnprintf and snprintf #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/libcompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,20 @@ CK_DLL_EXP int timer_delete(timer_t timerid);
#include <stdarg.h>

#if !HAVE_VSNPRINTF
CK_DLL_EXP int rpl_vsnprintf(char *, size_t, const char *, va_list);
CK_DLL_EXP int
#if defined(__clang__)
__attribute__((overloadable))
#endif
rpl_vsnprintf(char *, size_t, const char *, va_list);

#define vsnprintf rpl_vsnprintf
#endif
#if !HAVE_SNPRINTF
CK_DLL_EXP int rpl_snprintf(char *, size_t, const char *, ...);
CK_DLL_EXP int
#if defined(__clang__)
__attribute__((overloadable))
#endif
rpl_snprintf(char *, size_t, const char *, ...);

#define snprintf rpl_snprintf
#endif
Expand Down
6 changes: 6 additions & 0 deletions lib/snprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@ static LDOUBLE mypow10(int);
extern int errno;

int
#if defined(__clang__)
__attribute__((overloadable))
#endif
rpl_vsnprintf(char *str, size_t size, const char *format, va_list args)
{
LDOUBLE fvalue;
Expand Down Expand Up @@ -1452,6 +1455,9 @@ mypow10(int exponent)
#if !HAVE_SNPRINTF
#if HAVE_STDARG_H
int
#if defined(__clang__)
__attribute__((overloadable))
#endif
rpl_snprintf(char *str, size_t size, const char *format, ...)
#else
int
Expand Down