mirror of
git://jb55.com/damus
synced 2024-10-06 03:33:22 +00:00
c: move parse_digit to remove warning
This commit is contained in:
parent
a6745af519
commit
51cd34c9c2
@ -110,21 +110,6 @@ static inline int peek_char(struct cursor *cur, int ind) {
|
|||||||
return *(cur->p + 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) {
|
static inline int pull_byte(struct cursor *cur, u8 *byte) {
|
||||||
if (cur->p >= cur->end)
|
if (cur->p >= cur->end)
|
||||||
|
@ -12,6 +12,22 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
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) {
|
static int parse_mention_index(struct cursor *cur, struct block *block) {
|
||||||
int d1, d2, d3, ind;
|
int d1, d2, d3, ind;
|
||||||
const u8 *start = cur->p;
|
const u8 *start = cur->p;
|
||||||
|
Loading…
Reference in New Issue
Block a user