lib/ofpbuf.c
/* Creates and returns a new ofpbuf whose data are copied from 'buffer'.   The
 * returned ofpbuf will additionally have 'headroom' bytes of headroom. */
Creates and returns a new ofpbuf whose data are copied from 'buffer'.   The
returned ofpbuf will additionally have 'headroom' bytes of headroom.
Creates and returns a new ofpbuf whose data are copied from ' buffer ' . The returned ofpbuf will additionally have ' headroom ' bytes of headroom .
struct ofpbuf *
ofpbuf_clone_with_headroom(const struct ofpbuf *b, size_t headroom)
{
    struct ofpbuf *new_buffer;
    new_buffer = ofpbuf_clone_data_with_headroom(b->data, b->size, headroom);
    if (b->header) {
        ptrdiff_t header_offset = (char *) b->header - (char *) b->data;
        new_buffer->header = (char *) new_buffer->data + header_offset;
    }
    if (b->msg) {
        ptrdiff_t msg_offset = (char *) b->msg - (char *) b->data;
        new_buffer->msg = (char *) new_buffer->data + msg_offset;
    }
    return new_buffer;
}
struct ofpbuf * ofpbuf_clone_with_headroom ( const struct ofpbuf * b , size_t headroom ) { struct ofpbuf * new_buffer ; new_buffer = ofpbuf_clone_data_with_headroom ( b -> data , b -> size , headroom ) ; if ( b -> header ) { ptrdiff_t header_offset = ( char * ) b -> header - ( char * ) b -> data ; new_buffer -> header = ( char * ) new_buffer -> data + header_offset ; } if ( b -> msg ) { ptrdiff_t msg_offset = ( char * ) b -> msg - ( char * ) b -> data ; new_buffer -> msg = ( char * ) new_buffer -> data + msg_offset ; } return new_buffer ; }
Creates and returns a new ofpbuf whose data are copied from 'buffer'.
Creates and returns a new ofpbuf whose data are copied from ' buffer ' .