- /* Process found message */
- if(nulfound == 1) {
- char *newbuf;
-
- if(i == 0) {
- /* problem */
- WARN("received empty message");
- }
- *msg = strndup(*recv_buf, i);
-
- /* Remove processed message from buffer */
- newbuf = (char *) malloc(*recv_buf_size - (i+1));
- memcpy(newbuf, *recv_buf + (i+1), *recv_buf_size - (i+1));
- free(*recv_buf);
- *recv_buf = newbuf;
- *recv_buf_size -= (i+1);
- *recv_buf_alloc -= (i+1);
-
- return 1;