diff options
Diffstat (limited to 'jsonpath.c')
| -rw-r--r-- | jsonpath.c | 45 |
1 files changed, 1 insertions, 44 deletions
@@ -1,7 +1,7 @@ #include "jsonpath.h" +#include "util.h" #include <ctype.h> -#include "mb/pg_wchar.h" /* NB: These macros evaluate their argument multiple times. */ @@ -379,49 +379,6 @@ failed: return NULL; } -static size_t -utf8_substring( - const char *src, size_t srcbytes, - size_t start, size_t length, - const char **out_start, size_t *out_bytes) -{ - const char *e = src + srcbytes; - const char *sub_start; - const char *sub_end; - size_t sub_length; - - sub_start = src; - while (start > 0 && sub_start < e) - { - sub_start += pg_utf_mblen((const unsigned char *) sub_start); - start--; - } - - sub_end = sub_start; - sub_length = 0; - while (sub_length < length && sub_end < e) - { - sub_end += pg_utf_mblen((const unsigned char *) sub_end); - sub_length++; - } - - /* Make sure the input didn't have a clipped UTF-8 character */ - if (sub_start > e) - { - Assert(false); - sub_start = sub_end = e; - } - else if (sub_end > e) - { - Assert(false); - sub_end = e; - } - - *out_start = sub_start; - *out_bytes = sub_end - sub_start; - return sub_length; -} - /* Currently, a lot of JPRef nodes are allocated just to pass json_node pointers to match_recurse. If this becomes a memory/performance issue in the future, |
