summaryrefslogtreecommitdiff
path: root/json-glib/json-parser.h
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2020-06-09 15:41:45 +0100
committerPhilip Withnall <withnall@endlessm.com>2020-06-09 15:43:04 +0100
commitdd7a711244e3d33e3e960cd990e9afccc6877820 (patch)
tree6cdd86fb2578dee5f5626091cdcbd78a6c45df0a /json-glib/json-parser.h
parent13142637c8132f49e1bd012786eb5f7f7c6dc986 (diff)
downloadjson-glib-dd7a711244e3d33e3e960cd990e9afccc6877820.tar.gz
json-parser: Support loading files via memory mapping
Add a new `json_parser_load_from_mapped_file()` to load JSON from files via memory mapping. It’s otherwise similar to `json_parser_load_from_file()`. It’s in the right position to be able to memory map the file it’s reading from: it reads the input once before building a `JsonNode` structure to represent it, doesn’t write to the file, and often deals with large input files. This should speed things up slightly due to reducing time spent allocating a large chunk of heap memory to load the file into, if a caller can support that. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Diffstat (limited to 'json-glib/json-parser.h')
-rw-r--r--json-glib/json-parser.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/json-glib/json-parser.h b/json-glib/json-parser.h
index 1470fbf..91fde66 100644
--- a/json-glib/json-parser.h
+++ b/json-glib/json-parser.h
@@ -153,6 +153,10 @@ JSON_AVAILABLE_IN_1_0
gboolean json_parser_load_from_file (JsonParser *parser,
const gchar *filename,
GError **error);
+JSON_AVAILABLE_IN_1_6
+gboolean json_parser_load_from_mapped_file (JsonParser *parser,
+ const gchar *filename,
+ GError **error);
JSON_AVAILABLE_IN_1_0
gboolean json_parser_load_from_data (JsonParser *parser,
const gchar *data,