*
* kwlookup.h
* Key word lookup for PostgreSQL
*
*
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/common/kwlookup.h
*
*-------------------------------------------------------------------------
*/
#ifndef KWLOOKUP_H
#define KWLOOKUP_H
typedef int (*ScanKeywordHashFunc) (const void *key, size_t keylen);
* This struct contains the data needed by ScanKeywordLookup to perform a
* search within a set of keywords. The contents are typically generated by
* src/tools/gen_keywordlist.pl from a header containing PG_KEYWORD macros.
*/
typedef struct ScanKeywordList
{
const char *kw_string;
const uint16 *kw_offsets;
ScanKeywordHashFunc hash;
int num_keywords;
int max_kw_len;
} ScanKeywordList;
extern int ScanKeywordLookup(const char *text, const ScanKeywordList *keywords);
static inline const char *
GetScanKeyword(int n, const ScanKeywordList *keywords)
{
return keywords->kw_string + keywords->kw_offsets[n];
}
#endif