refactor(IWYU): create {ex_getln,rbuffer,os/fileio}_defs.h (#26338)

This commit is contained in:
zeertzjq
2023-12-01 08:06:37 +08:00
committed by GitHub
parent b32b5b2711
commit 09e93d7c4d
15 changed files with 174 additions and 153 deletions

View File

@@ -29,27 +29,12 @@ RBuffer *rbuffer_new(size_t capacity)
return rv;
}
void rbuffer_free(RBuffer *buf)
void rbuffer_free(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
{
xfree(buf->temp);
xfree(buf);
}
size_t rbuffer_size(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
{
return buf->size;
}
size_t rbuffer_capacity(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
{
return (size_t)(buf->end_ptr - buf->start_ptr);
}
size_t rbuffer_space(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
{
return rbuffer_capacity(buf) - buf->size;
}
/// Return a pointer to a raw buffer containing the first empty slot available
/// for writing. The second argument is a pointer to the maximum number of
/// bytes that could be written.