}
return (int)ldns_buffer_read_u8(buffer);
}
+
+void
+ldns_buffer_copy(ldns_buffer* result, ldns_buffer* from)
+{
+ size_t tocopy = ldns_buffer_limit(from);
+ if(tocopy > ldns_buffer_capacity(result))
+ tocopy = ldns_buffer_capacity(result);
+ ldns_buffer_clear(result);
+ ldns_buffer_write(result, ldns_buffer_begin(from), tocopy);
+ ldns_buffer_flip(result);
+}
*/
void *ldns_buffer_export(ldns_buffer *buffer);
+/**
+ * Copy contents of the other buffer to this buffer. Silently truncated
+ * if this buffer is too small.
+ * @param[result] resulting buffer which is copied to.
+ * @param[from] what to copy to result.
+ */
+void ldns_buffer_copy(ldns_buffer* result, ldns_buffer* from);
+
#endif /* LDNS_BUFFER_H */