mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-09 16:21:45 +00:00
Add mg_json_get_long
This commit is contained in:
1 parent
86e57d243d
commit
c5751b0bd3
6 files changed
+42
No files matched your search
@@ -2695,6 +2695,13 @@ char *mg_json_get_hex(struct mg_str json, const char *path, int *len) {
|
||||
return result;
|
||||
}
|
||||
|
||||
long mg_json_get_long(struct mg_str json, const char *path, long dflt) {
|
||||
double dv;
|
||||
long result = dflt;
|
||||
if (mg_json_get_num(json, path, &dv)) result = (long) dv;
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef MG_ENABLE_LINES
|
||||
#line 1 "src/log.c"
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user