copy.cc (388B)
1 #include "netbuffer" 2 3 void Netbuffer::copy (Netbuffer const &other) { 4 debugmsg("Netbuffer: copying other\n"); 5 6 buf_sz = other.buf_sz; 7 buf_alloced = other.buf_alloced; 8 LOCK_MALLOC; 9 buf_data = (char*)malloc(buf_alloced); 10 UNLOCK_MALLOC; 11 if (!buf_data) 12 throw Error("Memory fault in Netbuffer::copy"); 13 14 memcpy (buf_data, other.buf_data, buf_alloced); 15 }