From c30e92603c0780040fa3a974d6234dedeb5cd266 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Mon, 21 Mar 2011 09:27:51 +0200 Subject: [PATCH] ANSI C requires struct initializers to be constant expressions Closes GH-17. --- src/load.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/load.c b/src/load.c index 262bd7d..3cc7d0f 100644 --- a/src/load.c +++ b/src/load.c @@ -839,10 +839,13 @@ json_t *json_loads(const char *string, size_t flags, json_error_t *error) { lex_t lex; json_t *result; - string_data_t stream_data = {string, 0}; + string_data_t stream_data; (void)flags; /* unused */ + stream_data.data = string; + stream_data.pos = 0; + if(lex_init(&lex, string_get, (void *)&stream_data)) return NULL;