R_API st64 r_buf_fread(RBuffer *b, ut8 *buf, const char *fmt, int n) {
	r_return_val_if_fail (b && buf && fmt, -1);
	// XXX: we assume the caller knows what he's doing
	RBuffer *dst = r_buf_new_with_pointers (buf, UT64_MAX, false);
	st64 res = buf_format (dst, b, fmt, n);
	r_buf_free (dst);
	return res;
}
R_API st64 r_buf_fread(RBuffer *b, ut8 *buf, const char *fmt, int n) {
	r_return_val_if_fail (b && buf && fmt, -1);
	 
	RBuffer *dst = r_buf_new_with_pointers (buf, UT64_MAX, false);
	st64 res = buf_format (dst, b, fmt, n);
	r_buf_free (dst);
	return res;
}