+ omsg = msg;
+ rmr_get_src( omsg, osrc );
+ msg = rmr_realloc_payload( msg, need, copy, clone ); // reallocate the message with a payload big enough or clone if set
+ rmr_get_src( msg, nsrc );
+
+ if( msg->len != old_len ) {
+ fprintf( stderr, "[ERR] after realloc len=%d didn't match old len=%d\n", msg->len, old_len );
+ }
+ if( strcmp( osrc, nsrc ) != 0 ) {
+ fprintf( stderr, "[ERR] realloc source strings don't match (%s) new=(%s)\n", osrc, nsrc );
+ } else {
+ if( verbose ) {
+ fprintf( stderr, "[OK] realloc source strings match (%s) new=(%s)\n", osrc, nsrc );
+ }
+ }
+
+ if( copy ) {
+ if( memcmp( omsg->payload, msg->payload, rmr_payload_size( omsg ) ) != 0 ) {
+ fprintf( stderr, "[ERR] realloc payload contents don't match %d bytes\n", rmr_payload_size( omsg ) );
+ //spew( omsg->payload, rmr_payload_size( omsg ) );
+ //fprintf( stderr, "\n---\n\n" );
+ //spew( msg->payload, rmr_payload_size( omsg ) );
+ exit( 1 );
+ }
+ }
+
+ if( clone ) {
+ rmr_free_msg( omsg ); // we're done with the old msg, and must free b/c we cloned it
+ }