From 51cd34c9c25bfbc2d16bc02e84704b2f837318ff Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 15 May 2023 09:59:10 -0700 Subject: [PATCH] c: move parse_digit to remove warning --- damus-c/cursor.h | 15 --------------- damus-c/damus.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/damus-c/cursor.h b/damus-c/cursor.h index 36907912..0deed48c 100644 --- a/damus-c/cursor.h +++ b/damus-c/cursor.h @@ -110,21 +110,6 @@ static inline int peek_char(struct cursor *cur, int ind) { return *(cur->p + ind); } -static int parse_digit(struct cursor *cur, int *digit) { - int c; - if ((c = peek_char(cur, 0)) == -1) - return 0; - - c -= '0'; - - if (c >= 0 && c <= 9) { - *digit = c; - cur->p++; - return 1; - } - return 0; -} - static inline int pull_byte(struct cursor *cur, u8 *byte) { if (cur->p >= cur->end) diff --git a/damus-c/damus.c b/damus-c/damus.c index 92ff5da9..8c6c60bb 100644 --- a/damus-c/damus.c +++ b/damus-c/damus.c @@ -12,6 +12,22 @@ #include #include +static int parse_digit(struct cursor *cur, int *digit) { + int c; + if ((c = peek_char(cur, 0)) == -1) + return 0; + + c -= '0'; + + if (c >= 0 && c <= 9) { + *digit = c; + cur->p++; + return 1; + } + return 0; +} + + static int parse_mention_index(struct cursor *cur, struct block *block) { int d1, d2, d3, ind; const u8 *start = cur->p;