diff options
Diffstat (limited to 'jsonpath.c')
| -rw-r--r-- | jsonpath.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -20,10 +20,10 @@ * This element is used so an otherwise empty JSONPath list won't be NULL. * This allows us to use NULL to indicate an invalid JSONPath. * - * This function returns the second cell, - * making sure the first is of type JP_ROOT. + * This function returns the first cell, + * making sure it is of type JP_ROOT. */ -static ListCell *jp_head(JSONPath *jp) +static ListCell *jp_root(JSONPath *jp) { ListCell *cell; jp_element *elem; @@ -34,11 +34,19 @@ static ListCell *jp_head(JSONPath *jp) elem = lfirst(cell); Assert(elem->type == JP_ROOT); - cell = lnext(cell); return cell; } /* + * This function returns the second cell of a JSONPath list + * (the first cell after the JP_ROOT). + */ +static ListCell *jp_head(JSONPath *jp) +{ + return lnext(jp_root(jp)); +} + +/* * Note that skip_spaces differs from skip_whitespace in json.c * in that this function treats '\f' and '\v' as whitespace. * This is because JSON does not accept these characters as |
