}
struct ofpbuf *
-ofpbuf_clone(const struct ofpbuf *buffer)
+ofpbuf_clone(const struct ofpbuf *buffer)
{
- /* FIXME: reference counting. */
- struct ofpbuf *b = ofpbuf_new(buffer->size);
- ofpbuf_put(b, buffer->data, buffer->size);
+ return ofpbuf_clone_data(buffer->data, buffer->size);
+}
+
+struct ofpbuf *
+ofpbuf_clone_data(const void *data, size_t size)
+{
+ struct ofpbuf *b = ofpbuf_new(size);
+ ofpbuf_put(b, data, size);
return b;
}
struct ofpbuf *ofpbuf_new(size_t);
struct ofpbuf *ofpbuf_clone(const struct ofpbuf *);
+struct ofpbuf *ofpbuf_clone_data(const void *, size_t);
void ofpbuf_delete(struct ofpbuf *);
void *ofpbuf_at(const struct ofpbuf *, size_t offset, size_t size);