summaryrefslogtreecommitdiff
path: root/Ivy.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Ivy.cxx')
-rw-r--r--Ivy.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/Ivy.cxx b/Ivy.cxx
index f737c4a..b4150c6 100644
--- a/Ivy.cxx
+++ b/Ivy.cxx
@@ -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);
}