Simplify code by using fscanf behvior on white space
This commit is contained in:
1 parent
b525723084
commit
1cb1d16e77
1 file changed
+2
-6
+2
-6
@@ -167,17 +167,13 @@ m_serial_json_read_boolean(m_serial_read_t serial, bool *b){
|
||||
static inline m_serial_return_code_t
|
||||
m_serial_json_read_integer(m_serial_read_t serial, long long *i){
|
||||
FILE *f = (FILE*) serial->data[0];
|
||||
int c = m_serial_json_read_skip(f);
|
||||
ungetc(c, f);
|
||||
return fscanf(f, "%lld", i) == 1 ? M_SERIAL_OK_DONE : M_SERIAL_FAIL;
|
||||
return fscanf(f, " %lld", i) == 1 ? M_SERIAL_OK_DONE : M_SERIAL_FAIL;
|
||||
}
|
||||
|
||||
static inline m_serial_return_code_t
|
||||
m_serial_json_read_float(m_serial_read_t serial, long double *r){
|
||||
FILE *f = (FILE*) serial->data[0];
|
||||
int c = m_serial_json_read_skip(f);
|
||||
ungetc(c, f);
|
||||
return fscanf(f, "%Lf", r) == 1 ? M_SERIAL_OK_DONE : M_SERIAL_FAIL;
|
||||
return fscanf(f, " %Lf", r) == 1 ? M_SERIAL_OK_DONE : M_SERIAL_FAIL;
|
||||
}
|
||||
|
||||
static inline m_serial_return_code_t m_serial_json_read_string(m_serial_read_t serial, struct string_s *s){ return M_SERIAL_FAIL; }
|
||||
|
||||
Reference in new issue
Block a user