summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbustico2011-01-26 15:29:29 +0000
committerbustico2011-01-26 15:29:29 +0000
commit8fda9a9ea3493a32983935daf634e05e4cc81355 (patch)
treecca7e390f604225e9fc5b09580428164f22f8d5b
parent018db51fa49c2761516f4377a4958a2ce5b91fe3 (diff)
downloadivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.zip
ivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.tar.gz
ivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.tar.bz2
ivy-cplusplus-8fda9a9ea3493a32983935daf634e05e4cc81355.tar.xz
- remove arbitrary limit of size on the send buffer
-rw-r--r--Ivy.cxx13
-rw-r--r--Ivycpp.h3
2 files changed, 10 insertions, 6 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);
}
diff --git a/Ivycpp.h b/Ivycpp.h
index c78f19e..55a429d 100644
--- a/Ivycpp.h
+++ b/Ivycpp.h
@@ -24,6 +24,7 @@ namespace IvyC
#include <Ivy/ivysocket.h>
#include <Ivy/ivy.h>
+ #include <Ivy/ivybuffer.h>
}
#include "IvyCallback.h"
@@ -49,7 +50,7 @@ public:
__attribute__((format(printf,2,3)));
static void UnbindMsg( int id );
- static int SendMsg(const char * message, ... )
+ static int SendMsg(const char *fmt, ... )
__attribute__((format(printf,1,2))) ;
static void SendDirectMsg( IvyApplication *app, int id,
const char *message);