This helps compiling with MS compiler, error seems to be
due to defining a variable within the body of the function
its allowed in c99 but not in c89. This should fix build with
MSVC 16.0.40219.1 compiler from Visual Studio 14 2015
Signed-off-by: Khem Raj <raj.khem@gmail.com>
static int is_valid_index(struct json_object *jo, const char *path, size_t *idx)
{
size_t i, len = strlen(path);
+ long int idx_val = -1;
/* this code-path optimizes a bit, for when we reference the 0-9 index range
* in a JSON array and because leading zeros not allowed
*/
}
}
- long int idx_val = strtol(path, NULL, 10);
+ idx_val = strtol(path, NULL, 10);
if (idx_val < 0)
{
errno = EINVAL;