diff options
Diffstat (limited to 'Ivy.cxx')
-rw-r--r-- | Ivy.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -231,15 +231,18 @@ void Ivy::BindDirectMsg(IvyDirectMessageCallback *callback) # .____) | | __/ | | | | | (_| | | | | | \__ \ __/ | # \_____/ \___| |_| |_| \__,_| |_| |_| |___/ |___/ */ -int Ivy::SendMsg(const char * message, ... ) +int Ivy::SendMsg(const char *fmt, ... ) { - char buffer[4096]; + static IvyC::IvyBuffer buffer = { NULL, 0, 0}; /* Use static mem to eliminate multiple call + to malloc/free */ va_list args; - va_start( args, message ); /* Initialize variable arguments. */ - vsnprintf( buffer, sizeof (buffer), message, args ); + va_start( args, fmt ); /* Initialize variable arguments. */ + buffer.offset = 0; + make_message( &buffer, fmt, args ); va_end( args); - return IvyC::IvySendMsg (buffer); + + return IvyC::IvySendMsg (buffer.data); } |