Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

c_keywords.c File Reference

#include "postgres_fe.h"
#include <ctype.h>
#include "extern.h"
#include "preproc.h"
Include dependency graph for c_keywords.c:

Go to the source code of this file.

Functions

const ScanKeywordScanCKeywordLookup (const char *text)

Variables

static const ScanKeyword ScanCKeywords []

Function Documentation

const ScanKeyword* ScanCKeywordLookup ( const char *  text  ) 

Definition at line 64 of file c_keywords.c.

References lengthof, and ScanKeyword::name.

{
    const ScanKeyword *low = &ScanCKeywords[0];
    const ScanKeyword *high = &ScanCKeywords[lengthof(ScanCKeywords) - 1];

    while (low <= high)
    {
        const ScanKeyword *middle;
        int         difference;

        middle = low + (high - low) / 2;
        difference = strcmp(middle->name, text);
        if (difference == 0)
            return middle;
        else if (difference < 0)
            low = middle + 1;
        else
            high = middle - 1;
    }

    return NULL;
}


Variable Documentation

const ScanKeyword ScanCKeywords[] [static]

Definition at line 23 of file c_keywords.c.