summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-01 09:33:46 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-04-01 09:33:46 -0300
commit8f45be3b0ddab6e6fd6ce8aed99e921871e9961b (patch)
treec8c4803650eb9aac3f29e5e47ffef9b0d8f22ee1
parentaaeea79c5bd531bd493aec09bd4eed0ac0ea59df (diff)
downloadjet-8f45be3b0ddab6e6fd6ce8aed99e921871e9961b.tar.gz
jet-8f45be3b0ddab6e6fd6ce8aed99e921871e9961b.zip
Inline page_is_full and delete page_is_empty
-rw-r--r--page.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/page.c b/page.c
index ec8f9b0..a8407d3 100644
--- a/page.c
+++ b/page.c
@@ -67,17 +67,8 @@ void move_gap(struct page *page, int target) {
}
}
-static inline int page_is_full(struct page *page) {
- return page->gap_start == page->gap_end;
-}
-
-static inline int page_is_empty(struct page *page) {
- return page->gap_start == page->buffer
- && page->gap_end == page->buffer + PAGE_SIZE - 1;
-}
-
void insert_into_page(struct page *page, uint8_t c) {
- if (!page_is_full(page)) {
+ if (page->gap_start != page->gap_end) {
*(page->gap_start) = c;
page->gap_start++;
}