Copy the Name token at p (bounded). Returns false when p is not a Name. */
| 989 | |
| 990 | /* Copy the Name token at p (bounded). Returns false when p is not a Name. */ |
| 991 | static bool gql_copy_name(const char *p, char *name_buf, size_t name_sz) { |
| 992 | if (!gql_name_start((unsigned char)*p) || !name_buf || name_sz == 0) { |
| 993 | return false; |
| 994 | } |
| 995 | size_t n = 0; |
| 996 | while (gql_name_char((unsigned char)p[n]) && n + 1 < name_sz) { |
| 997 | name_buf[n] = p[n]; |
| 998 | n++; |
| 999 | } |
| 1000 | name_buf[n] = '\0'; |
| 1001 | return true; |
| 1002 | } |
| 1003 | |
| 1004 | static const char *gql_operation_keyword(const char *tok, size_t len) { |
| 1005 | static const char *const kws[] = {"query", "mutation", "subscription", NULL}; |
no test coverage detected