fix build error in config.hpp when included by C-files (like the ed25519 source for instance)

This commit is contained in:
Arvid Norberg 2014-03-09 00:49:36 +00:00
parent 3c47177bfe
commit 80011a4715
2 changed files with 9 additions and 3 deletions

View File

@ -3,7 +3,7 @@
#include <stddef.h>
#include "libtorrent/config.hpp"
#include "libtorrent/config.hpp" // for TORRENT_EXPORT
#ifdef __cplusplus
extern "C" {

View File

@ -355,11 +355,17 @@ POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
// internal
inline int snprintf(char* buf, int len, char const* fmt, ...)
#ifdef __cplusplus
inline
#else
static
#endif
int snprintf(char* buf, int len, char const* fmt, ...)
{
va_list lp;
int ret;
va_start(lp, fmt);
int ret = _vsnprintf(buf, len, fmt, lp);
ret = _vsnprintf(buf, len, fmt, lp);
va_end(lp);
if (ret < 0) { buf[len-1] = 0; ret = len-1; }
return ret;