mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
pgindent run for 8.3.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict.c,v 1.2 2007/10/19 22:01:45 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict.c,v 1.3 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ ts_lexize(PG_FUNCTION_ARGS)
|
||||
PointerGetDatum(dict->dictData),
|
||||
PointerGetDatum(VARDATA(in)),
|
||||
Int32GetDatum(VARSIZE(in) - VARHDRSZ),
|
||||
PointerGetDatum(&dstate)));
|
||||
PointerGetDatum(&dstate)));
|
||||
|
||||
if (dstate.getnext)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ ts_lexize(PG_FUNCTION_ARGS)
|
||||
PointerGetDatum(dict->dictData),
|
||||
PointerGetDatum(VARDATA(in)),
|
||||
Int32GetDatum(VARSIZE(in) - VARHDRSZ),
|
||||
PointerGetDatum(&dstate)));
|
||||
PointerGetDatum(&dstate)));
|
||||
if (ptr != NULL)
|
||||
res = ptr;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_ispell.c,v 1.3 2007/08/25 00:03:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_ispell.c,v 1.4 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -26,7 +26,7 @@ typedef struct
|
||||
{
|
||||
StopList stoplist;
|
||||
IspellDict obj;
|
||||
} DictISpell;
|
||||
} DictISpell;
|
||||
|
||||
Datum
|
||||
dispell_init(PG_FUNCTION_ARGS)
|
||||
@@ -51,8 +51,8 @@ dispell_init(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("multiple DictFile parameters")));
|
||||
NIImportDictionary(&(d->obj),
|
||||
get_tsearch_config_filename(defGetString(defel),
|
||||
"dict"));
|
||||
get_tsearch_config_filename(defGetString(defel),
|
||||
"dict"));
|
||||
dictloaded = true;
|
||||
}
|
||||
else if (pg_strcasecmp(defel->defname, "AffFile") == 0)
|
||||
@@ -112,7 +112,7 @@ dispell_lexize(PG_FUNCTION_ARGS)
|
||||
{
|
||||
DictISpell *d = (DictISpell *) PG_GETARG_POINTER(0);
|
||||
char *in = (char *) PG_GETARG_POINTER(1);
|
||||
int32 len = PG_GETARG_INT32(2);
|
||||
int32 len = PG_GETARG_INT32(2);
|
||||
char *txt;
|
||||
TSLexeme *res;
|
||||
TSLexeme *ptr,
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_simple.c,v 1.4 2007/11/14 18:36:37 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_simple.c,v 1.5 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ typedef struct
|
||||
{
|
||||
StopList stoplist;
|
||||
bool accept;
|
||||
} DictSimple;
|
||||
} DictSimple;
|
||||
|
||||
|
||||
Datum
|
||||
@@ -64,8 +64,8 @@ dsimple_init(PG_FUNCTION_ARGS)
|
||||
{
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("unrecognized simple dictionary parameter: \"%s\"",
|
||||
defel->defname)));
|
||||
errmsg("unrecognized simple dictionary parameter: \"%s\"",
|
||||
defel->defname)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ dsimple_lexize(PG_FUNCTION_ARGS)
|
||||
{
|
||||
DictSimple *d = (DictSimple *) PG_GETARG_POINTER(0);
|
||||
char *in = (char *) PG_GETARG_POINTER(1);
|
||||
int32 len = PG_GETARG_INT32(2);
|
||||
int32 len = PG_GETARG_INT32(2);
|
||||
char *txt;
|
||||
TSLexeme *res;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_synonym.c,v 1.4 2007/08/25 02:29:45 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_synonym.c,v 1.5 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -24,13 +24,13 @@ typedef struct
|
||||
{
|
||||
char *in;
|
||||
char *out;
|
||||
} Syn;
|
||||
} Syn;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int len; /* length of syn array */
|
||||
int len; /* length of syn array */
|
||||
Syn *syn;
|
||||
} DictSyn;
|
||||
} DictSyn;
|
||||
|
||||
/*
|
||||
* Finds the next whitespace-delimited word within the 'in' string.
|
||||
@@ -136,8 +136,8 @@ dsynonym_init(PG_FUNCTION_ARGS)
|
||||
*end = '\0';
|
||||
|
||||
/*
|
||||
* starti now points to the first word, and starto to the second
|
||||
* word on the line, with a \0 terminator at the end of both words.
|
||||
* starti now points to the first word, and starto to the second word
|
||||
* on the line, with a \0 terminator at the end of both words.
|
||||
*/
|
||||
|
||||
if (cur >= d->len)
|
||||
@@ -159,7 +159,7 @@ dsynonym_init(PG_FUNCTION_ARGS)
|
||||
|
||||
cur++;
|
||||
|
||||
skipline:
|
||||
skipline:
|
||||
pfree(line);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ dsynonym_lexize(PG_FUNCTION_ARGS)
|
||||
{
|
||||
DictSyn *d = (DictSyn *) PG_GETARG_POINTER(0);
|
||||
char *in = (char *) PG_GETARG_POINTER(1);
|
||||
int32 len = PG_GETARG_INT32(2);
|
||||
int32 len = PG_GETARG_INT32(2);
|
||||
Syn key,
|
||||
*found;
|
||||
TSLexeme *res;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.6 2007/11/10 15:39:34 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.7 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -35,20 +35,20 @@ typedef struct LexemeInfo
|
||||
uint16 tnvariant; /* total num lexemes in one variant */
|
||||
struct LexemeInfo *nextentry;
|
||||
struct LexemeInfo *nextvariant;
|
||||
} LexemeInfo;
|
||||
} LexemeInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *lexeme;
|
||||
LexemeInfo *entries;
|
||||
} TheLexeme;
|
||||
} TheLexeme;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16 lastlexeme; /* number lexemes to substitute */
|
||||
uint16 reslen;
|
||||
TSLexeme *res; /* prepared substituted result */
|
||||
} TheSubstitute;
|
||||
} TheSubstitute;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -66,7 +66,7 @@ typedef struct
|
||||
*/
|
||||
TheSubstitute *subst;
|
||||
int nsubst;
|
||||
} DictThesaurus;
|
||||
} DictThesaurus;
|
||||
|
||||
|
||||
static void
|
||||
@@ -412,16 +412,16 @@ compileTheLexeme(DictThesaurus * d)
|
||||
{
|
||||
TSLexeme *ptr;
|
||||
|
||||
if (strcmp(d->wrds[i].lexeme, "?") == 0) /* Is stop word marker? */
|
||||
if (strcmp(d->wrds[i].lexeme, "?") == 0) /* Is stop word marker? */
|
||||
newwrds = addCompiledLexeme(newwrds, &nnw, &tnm, NULL, d->wrds[i].entries, 0);
|
||||
else
|
||||
{
|
||||
ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize),
|
||||
PointerGetDatum(d->subdict->dictData),
|
||||
PointerGetDatum(d->wrds[i].lexeme),
|
||||
Int32GetDatum(strlen(d->wrds[i].lexeme)),
|
||||
PointerGetDatum(NULL)));
|
||||
|
||||
PointerGetDatum(d->subdict->dictData),
|
||||
PointerGetDatum(d->wrds[i].lexeme),
|
||||
Int32GetDatum(strlen(d->wrds[i].lexeme)),
|
||||
PointerGetDatum(NULL)));
|
||||
|
||||
if (!ptr)
|
||||
elog(ERROR, "thesaurus word-sample \"%s\" isn't recognized by subdictionary (rule %d)",
|
||||
d->wrds[i].lexeme, d->wrds[i].entries->idsubst + 1);
|
||||
@@ -435,7 +435,7 @@ compileTheLexeme(DictThesaurus * d)
|
||||
TSLexeme *remptr = ptr + 1;
|
||||
int tnvar = 1;
|
||||
int curvar = ptr->nvariant;
|
||||
|
||||
|
||||
/* compute n words in one variant */
|
||||
while (remptr->lexeme)
|
||||
{
|
||||
@@ -444,14 +444,14 @@ compileTheLexeme(DictThesaurus * d)
|
||||
tnvar++;
|
||||
remptr++;
|
||||
}
|
||||
|
||||
|
||||
remptr = ptr;
|
||||
while (remptr->lexeme && remptr->nvariant == curvar)
|
||||
{
|
||||
newwrds = addCompiledLexeme(newwrds, &nnw, &tnm, remptr, d->wrds[i].entries, tnvar);
|
||||
remptr++;
|
||||
}
|
||||
|
||||
|
||||
ptr = remptr;
|
||||
}
|
||||
}
|
||||
@@ -653,7 +653,8 @@ thesaurus_init(PG_FUNCTION_ARGS)
|
||||
static LexemeInfo *
|
||||
findTheLexeme(DictThesaurus * d, char *lexeme)
|
||||
{
|
||||
TheLexeme key, *res;
|
||||
TheLexeme key,
|
||||
*res;
|
||||
|
||||
if (d->nwrds == 0)
|
||||
return NULL;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.5 2007/09/11 12:57:05 teodor Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.6 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
/*
|
||||
* Initialization requires a lot of memory that's not needed
|
||||
* after the initialization is done. In init function,
|
||||
* after the initialization is done. In init function,
|
||||
* CurrentMemoryContext is a long lived memory context associated
|
||||
* with the dictionary cache entry, so we use a temporary context
|
||||
* for the short-lived stuff.
|
||||
@@ -35,8 +35,9 @@ static MemoryContext tmpCtx = NULL;
|
||||
static void
|
||||
checkTmpCtx(void)
|
||||
{
|
||||
/* XXX: This assumes that CurrentMemoryContext doesn't have
|
||||
* any children other than the one we create here.
|
||||
/*
|
||||
* XXX: This assumes that CurrentMemoryContext doesn't have any children
|
||||
* other than the one we create here.
|
||||
*/
|
||||
if (CurrentMemoryContext->firstchild == NULL)
|
||||
{
|
||||
@@ -206,7 +207,8 @@ NIImportDictionary(IspellDict * Conf, const char *filename)
|
||||
|
||||
while ((line = t_readline(dict)) != NULL)
|
||||
{
|
||||
char *s, *pstr;
|
||||
char *s,
|
||||
*pstr;
|
||||
const char *flag;
|
||||
|
||||
/* Extract flag from the line */
|
||||
@@ -441,8 +443,8 @@ parse_affentry(char *str, char *mask, char *find, char *repl,
|
||||
else if (!t_isspace(str))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
}
|
||||
else if (state == PAE_INFIND)
|
||||
{
|
||||
@@ -459,8 +461,8 @@ parse_affentry(char *str, char *mask, char *find, char *repl,
|
||||
else if (!t_isspace(str))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
}
|
||||
else if (state == PAE_WAIT_REPL)
|
||||
{
|
||||
@@ -477,8 +479,8 @@ parse_affentry(char *str, char *mask, char *find, char *repl,
|
||||
else if (!t_isspace(str))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
}
|
||||
else if (state == PAE_INREPL)
|
||||
{
|
||||
@@ -495,8 +497,8 @@ parse_affentry(char *str, char *mask, char *find, char *repl,
|
||||
else if (!t_isspace(str))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
errmsg("syntax error at line %d of affix file \"%s\"",
|
||||
lineno, filename)));
|
||||
}
|
||||
else
|
||||
elog(ERROR, "unknown state in parse_affentry: %d", state);
|
||||
@@ -664,7 +666,7 @@ NIImportOOAffixes(IspellDict * Conf, const char *filename)
|
||||
if ((ptr = strchr(prepl, '/')) != NULL)
|
||||
{
|
||||
*ptr = '\0';
|
||||
ptr = repl + (ptr-prepl) + 1;
|
||||
ptr = repl + (ptr - prepl) + 1;
|
||||
while (*ptr)
|
||||
{
|
||||
aflg |= Conf->flagval[(unsigned int) *ptr];
|
||||
@@ -685,7 +687,7 @@ NIImportOOAffixes(IspellDict * Conf, const char *filename)
|
||||
pfree(pmask);
|
||||
}
|
||||
|
||||
nextline:
|
||||
nextline:
|
||||
pfree(recoded);
|
||||
}
|
||||
|
||||
@@ -742,7 +744,8 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
|
||||
s = findchar(pstr, 'l');
|
||||
if (s)
|
||||
{
|
||||
s = recoded + ( s-pstr ); /* we need non-lowercased string */
|
||||
s = recoded + (s - pstr); /* we need non-lowercased
|
||||
* string */
|
||||
while (*s && !t_isspace(s))
|
||||
s++;
|
||||
while (*s && t_isspace(s))
|
||||
@@ -773,7 +776,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
|
||||
}
|
||||
if (STRNCMP(pstr, "flag") == 0)
|
||||
{
|
||||
s = recoded + 4; /* we need non-lowercased string */
|
||||
s = recoded + 4; /* we need non-lowercased string */
|
||||
flagflags = 0;
|
||||
|
||||
while (*s && t_isspace(s))
|
||||
@@ -831,7 +834,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
|
||||
|
||||
NIAddAffix(Conf, flag, flagflags, mask, find, repl, suffixes ? FF_SUFFIX : FF_PREFIX);
|
||||
|
||||
nextline:
|
||||
nextline:
|
||||
pfree(recoded);
|
||||
pfree(pstr);
|
||||
}
|
||||
@@ -953,15 +956,15 @@ mkSPNode(IspellDict * Conf, int low, int high, int level)
|
||||
}
|
||||
|
||||
/*
|
||||
* Builds the Conf->Dictionary tree and AffixData from the imported dictionary
|
||||
* Builds the Conf->Dictionary tree and AffixData from the imported dictionary
|
||||
* and affixes.
|
||||
*/
|
||||
void
|
||||
NISortDictionary(IspellDict * Conf)
|
||||
{
|
||||
int i;
|
||||
int naffix = 0;
|
||||
int curaffix;
|
||||
int i;
|
||||
int naffix = 0;
|
||||
int curaffix;
|
||||
|
||||
checkTmpCtx();
|
||||
|
||||
@@ -979,9 +982,9 @@ NISortDictionary(IspellDict * Conf)
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in Conf->AffixData with the affixes that were used
|
||||
* in the dictionary. Replace textual flag-field of Conf->Spell
|
||||
* entries with indexes into Conf->AffixData array.
|
||||
* Fill in Conf->AffixData with the affixes that were used in the
|
||||
* dictionary. Replace textual flag-field of Conf->Spell entries with
|
||||
* indexes into Conf->AffixData array.
|
||||
*/
|
||||
Conf->AffixData = (char **) palloc0(naffix * sizeof(char *));
|
||||
|
||||
@@ -1446,7 +1449,7 @@ typedef struct SplitVar
|
||||
int nstem;
|
||||
char **stem;
|
||||
struct SplitVar *next;
|
||||
} SplitVar;
|
||||
} SplitVar;
|
||||
|
||||
static int
|
||||
CheckCompoundAffixes(CMPDAffix ** ptr, char *word, int len, bool CheckInPlace)
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.5 2007/10/23 00:51:23 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.6 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -40,8 +40,8 @@ compareWORD(const void *a, const void *b)
|
||||
((ParsedWord *) b)->len);
|
||||
|
||||
if (res == 0)
|
||||
{
|
||||
if ( ((ParsedWord *) a)->pos.pos == ((ParsedWord *) b)->pos.pos )
|
||||
{
|
||||
if (((ParsedWord *) a)->pos.pos == ((ParsedWord *) b)->pos.pos)
|
||||
return 0;
|
||||
|
||||
return (((ParsedWord *) a)->pos.pos > ((ParsedWord *) b)->pos.pos) ? 1 : -1;
|
||||
@@ -72,7 +72,7 @@ uniqueWORD(ParsedWord * a, int4 l)
|
||||
ptr = a + 1;
|
||||
|
||||
/*
|
||||
* Sort words with its positions
|
||||
* Sort words with its positions
|
||||
*/
|
||||
qsort((void *) a, l, sizeof(ParsedWord), compareWORD);
|
||||
|
||||
@@ -108,13 +108,13 @@ uniqueWORD(ParsedWord * a, int4 l)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* The word already exists, so adjust position information.
|
||||
* But before we should check size of position's array,
|
||||
* max allowed value for position and uniqueness of position
|
||||
* The word already exists, so adjust position information. But
|
||||
* before we should check size of position's array, max allowed
|
||||
* value for position and uniqueness of position
|
||||
*/
|
||||
pfree(ptr->word);
|
||||
if (res->pos.apos[0] < MAXNUMPOS - 1 && res->pos.apos[res->pos.apos[0]] != MAXENTRYPOS - 1 &&
|
||||
res->pos.apos[res->pos.apos[0]] != LIMITPOS(ptr->pos.pos))
|
||||
res->pos.apos[res->pos.apos[0]] != LIMITPOS(ptr->pos.pos))
|
||||
{
|
||||
if (res->pos.apos[0] + 1 >= res->alen)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ uniqueWORD(ParsedWord * a, int4 l)
|
||||
* make value of tsvector, given parsed text
|
||||
*/
|
||||
TSVector
|
||||
make_tsvector(ParsedText *prs)
|
||||
make_tsvector(ParsedText * prs)
|
||||
{
|
||||
int i,
|
||||
j,
|
||||
@@ -182,7 +182,7 @@ make_tsvector(ParsedText *prs)
|
||||
pfree(prs->words[i].word);
|
||||
if (prs->words[i].alen)
|
||||
{
|
||||
int k = prs->words[i].pos.apos[0];
|
||||
int k = prs->words[i].pos.apos[0];
|
||||
WordEntryPos *wptr;
|
||||
|
||||
if (k > 0xFFFF)
|
||||
@@ -265,7 +265,7 @@ to_tsvector(PG_FUNCTION_ARGS)
|
||||
* to the stack.
|
||||
*
|
||||
* All words belonging to the same variant are pushed as an ANDed list,
|
||||
* and different variants are ORred together.
|
||||
* and different variants are ORred together.
|
||||
*/
|
||||
static void
|
||||
pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, int2 weight)
|
||||
@@ -277,7 +277,8 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
|
||||
cntvar = 0,
|
||||
cntpos = 0,
|
||||
cnt = 0;
|
||||
Oid cfg_id = DatumGetObjectId(opaque); /* the input is actually an Oid, not a pointer */
|
||||
Oid cfg_id = DatumGetObjectId(opaque); /* the input is actually
|
||||
* an Oid, not a pointer */
|
||||
|
||||
prs.lenwords = 4;
|
||||
prs.curwords = 0;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/ts_locale.c,v 1.3 2007/11/09 22:37:35 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/ts_locale.c,v 1.4 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ wchar2char(char *to, const wchar_t *from, size_t tolen)
|
||||
Assert(r <= tolen);
|
||||
|
||||
/* Microsoft counts the zero terminator in the result */
|
||||
return r-1;
|
||||
return r - 1;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
@@ -59,7 +59,7 @@ wchar2char(char *to, const wchar_t *from, size_t tolen)
|
||||
* This has almost the API of mbstowcs(), except that *from need not be
|
||||
* null-terminated; instead, the number of input bytes is specified as
|
||||
* fromlen. Also, we ereport() rather than returning -1 for invalid
|
||||
* input encoding. tolen is the maximum number of wchar_t's to store at *to.
|
||||
* input encoding. tolen is the maximum number of wchar_t's to store at *to.
|
||||
* The output will be zero-terminated iff there is room.
|
||||
*/
|
||||
size_t
|
||||
@@ -87,7 +87,7 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen)
|
||||
Assert(r <= tolen);
|
||||
|
||||
/* Microsoft counts the zero terminator in the result */
|
||||
return r-1;
|
||||
return r - 1;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
@@ -183,7 +183,6 @@ t_isprint(const char *ptr)
|
||||
|
||||
return iswprint((wint_t) character[0]);
|
||||
}
|
||||
|
||||
#endif /* TS_USE_WIDE */
|
||||
|
||||
|
||||
@@ -195,10 +194,10 @@ t_isprint(const char *ptr)
|
||||
char *
|
||||
t_readline(FILE *fp)
|
||||
{
|
||||
int len;
|
||||
char *recoded;
|
||||
char buf[4096]; /* lines must not be longer than this */
|
||||
|
||||
int len;
|
||||
char *recoded;
|
||||
char buf[4096]; /* lines must not be longer than this */
|
||||
|
||||
if (fgets(buf, sizeof(buf), fp) == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -219,9 +218,8 @@ t_readline(FILE *fp)
|
||||
if (recoded == buf)
|
||||
{
|
||||
/*
|
||||
* conversion didn't pstrdup, so we must.
|
||||
* We can use the length of the original string, because
|
||||
* no conversion was done.
|
||||
* conversion didn't pstrdup, so we must. We can use the length of the
|
||||
* original string, because no conversion was done.
|
||||
*/
|
||||
recoded = pnstrdup(recoded, len);
|
||||
}
|
||||
@@ -276,7 +274,7 @@ lowerstr_with_len(const char *str, int len)
|
||||
*/
|
||||
wptr = wstr = (wchar_t *) palloc(sizeof(wchar_t) * (len + 1));
|
||||
|
||||
wlen = char2wchar(wstr, len+1, str, len);
|
||||
wlen = char2wchar(wstr, len + 1, str, len);
|
||||
Assert(wlen <= len);
|
||||
|
||||
while (*wptr)
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.3 2007/09/07 15:09:55 teodor Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.4 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -31,13 +31,13 @@ typedef struct ParsedLex
|
||||
int lenlemm;
|
||||
bool resfollow;
|
||||
struct ParsedLex *next;
|
||||
} ParsedLex;
|
||||
} ParsedLex;
|
||||
|
||||
typedef struct ListParsedLex
|
||||
{
|
||||
ParsedLex *head;
|
||||
ParsedLex *tail;
|
||||
} ListParsedLex;
|
||||
} ListParsedLex;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -56,7 +56,7 @@ typedef struct
|
||||
|
||||
ParsedLex *lastRes;
|
||||
TSLexeme *tmpRes;
|
||||
} LexizeData;
|
||||
} LexizeData;
|
||||
|
||||
static void
|
||||
LexizeInit(LexizeData * ld, TSConfigCacheEntry * cfg)
|
||||
@@ -462,7 +462,7 @@ hlfinditem(HeadlineParsedText * prs, TSQuery query, char *buf, int buflen)
|
||||
{
|
||||
if (item->type == QI_VAL &&
|
||||
item->operand.length == buflen &&
|
||||
strncmp(GETOPERAND(query) + item->operand.distance, buf, buflen) == 0)
|
||||
strncmp(GETOPERAND(query) + item->operand.distance, buf, buflen) == 0)
|
||||
{
|
||||
if (word->item)
|
||||
{
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/ts_utils.c,v 1.5 2007/11/09 22:37:35 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/ts_utils.c,v 1.6 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
/*
|
||||
* Given the base name and extension of a tsearch config file, return
|
||||
* its full path name. The base name is assumed to be user-supplied,
|
||||
* and is checked to prevent pathname attacks. The extension is assumed
|
||||
* its full path name. The base name is assumed to be user-supplied,
|
||||
* and is checked to prevent pathname attacks. The extension is assumed
|
||||
* to be safe.
|
||||
*
|
||||
* The result is a palloc'd string.
|
||||
@@ -40,14 +40,13 @@ get_tsearch_config_filename(const char *basename,
|
||||
char *result;
|
||||
|
||||
/*
|
||||
* We limit the basename to contain a-z, 0-9, and underscores. This may
|
||||
* We limit the basename to contain a-z, 0-9, and underscores. This may
|
||||
* be overly restrictive, but we don't want to allow access to anything
|
||||
* outside the tsearch_data directory, so for instance '/' *must* be
|
||||
* rejected, and on some platforms '\' and ':' are risky as well.
|
||||
* Allowing uppercase might result in incompatible behavior between
|
||||
* case-sensitive and case-insensitive filesystems, and non-ASCII
|
||||
* characters create other interesting risks, so on the whole a tight
|
||||
* policy seems best.
|
||||
* rejected, and on some platforms '\' and ':' are risky as well. Allowing
|
||||
* uppercase might result in incompatible behavior between case-sensitive
|
||||
* and case-insensitive filesystems, and non-ASCII characters create other
|
||||
* interesting risks, so on the whole a tight policy seems best.
|
||||
*/
|
||||
if (strspn(basename, "abcdefghijklmnopqrstuvwxyz0123456789_") != strlen(basename))
|
||||
ereport(ERROR,
|
||||
@@ -71,11 +70,11 @@ comparestr(const void *a, const void *b)
|
||||
|
||||
/*
|
||||
* Reads a stopword file. Each word is run through 'wordop'
|
||||
* function, if given. wordop may either modify the input in-place,
|
||||
* function, if given. wordop may either modify the input in-place,
|
||||
* or palloc a new version.
|
||||
*/
|
||||
void
|
||||
readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *))
|
||||
readstoplist(const char *fname, StopList * s, char *(*wordop) (const char *))
|
||||
{
|
||||
char **stop = NULL;
|
||||
|
||||
@@ -95,7 +94,7 @@ readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *))
|
||||
|
||||
while ((line = t_readline(hin)) != NULL)
|
||||
{
|
||||
char *pbuf = line;
|
||||
char *pbuf = line;
|
||||
|
||||
/* Trim trailing space */
|
||||
while (*pbuf && !t_isspace(pbuf))
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/wparser.c,v 1.3 2007/08/25 00:03:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/wparser.c,v 1.4 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ typedef struct
|
||||
{
|
||||
int cur;
|
||||
LexDescr *list;
|
||||
} TSTokenTypeStorage;
|
||||
} TSTokenTypeStorage;
|
||||
|
||||
static void
|
||||
tt_setup_firstcall(FuncCallContext *funcctx, Oid prsid)
|
||||
@@ -131,8 +131,8 @@ ts_token_type_byname(PG_FUNCTION_ARGS)
|
||||
|
||||
if (SRF_IS_FIRSTCALL())
|
||||
{
|
||||
text *prsname = PG_GETARG_TEXT_P(0);
|
||||
Oid prsId;
|
||||
text *prsname = PG_GETARG_TEXT_P(0);
|
||||
Oid prsId;
|
||||
|
||||
funcctx = SRF_FIRSTCALL_INIT();
|
||||
prsId = TSParserGetPrsid(textToQualifiedNameList(prsname), false);
|
||||
@@ -150,14 +150,14 @@ typedef struct
|
||||
{
|
||||
int type;
|
||||
char *lexeme;
|
||||
} LexemeEntry;
|
||||
} LexemeEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int cur;
|
||||
int len;
|
||||
LexemeEntry *list;
|
||||
} PrsStorage;
|
||||
} PrsStorage;
|
||||
|
||||
|
||||
static void
|
||||
@@ -181,7 +181,7 @@ prs_setup_firstcall(FuncCallContext *funcctx, Oid prsid, text *txt)
|
||||
|
||||
prsdata = (void *) DatumGetPointer(FunctionCall2(&prs->prsstart,
|
||||
PointerGetDatum(VARDATA(txt)),
|
||||
Int32GetDatum(VARSIZE(txt) - VARHDRSZ)));
|
||||
Int32GetDatum(VARSIZE(txt) - VARHDRSZ)));
|
||||
|
||||
while ((type = DatumGetInt32(FunctionCall3(&prs->prstoken,
|
||||
PointerGetDatum(prsdata),
|
||||
@@ -278,9 +278,9 @@ ts_parse_byname(PG_FUNCTION_ARGS)
|
||||
|
||||
if (SRF_IS_FIRSTCALL())
|
||||
{
|
||||
text *prsname = PG_GETARG_TEXT_P(0);
|
||||
text *txt = PG_GETARG_TEXT_P(1);
|
||||
Oid prsId;
|
||||
text *prsname = PG_GETARG_TEXT_P(0);
|
||||
text *txt = PG_GETARG_TEXT_P(1);
|
||||
Oid prsId;
|
||||
|
||||
funcctx = SRF_FIRSTCALL_INIT();
|
||||
prsId = TSParserGetPrsid(textToQualifiedNameList(prsname), false);
|
||||
@@ -351,7 +351,7 @@ Datum
|
||||
ts_headline(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_byid_opt,
|
||||
ObjectIdGetDatum(getTSCurrentConfig(true)),
|
||||
ObjectIdGetDatum(getTSCurrentConfig(true)),
|
||||
PG_GETARG_DATUM(0),
|
||||
PG_GETARG_DATUM(1)));
|
||||
}
|
||||
@@ -360,7 +360,7 @@ Datum
|
||||
ts_headline_opt(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_byid_opt,
|
||||
ObjectIdGetDatum(getTSCurrentConfig(true)),
|
||||
ObjectIdGetDatum(getTSCurrentConfig(true)),
|
||||
PG_GETARG_DATUM(0),
|
||||
PG_GETARG_DATUM(1),
|
||||
PG_GETARG_DATUM(2)));
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.8 2007/11/09 22:37:35 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.9 2007/11/15 21:14:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -49,12 +49,12 @@
|
||||
#define FILEPATH 19
|
||||
#define DECIMAL 20
|
||||
#define SIGNEDINT 21
|
||||
#define UNSIGNEDINT 22
|
||||
#define UNSIGNEDINT 22
|
||||
#define HTMLENTITY 23
|
||||
|
||||
#define LASTNUM 23
|
||||
|
||||
static const char * const tok_alias[] = {
|
||||
static const char *const tok_alias[] = {
|
||||
"",
|
||||
"asciiword",
|
||||
"word",
|
||||
@@ -81,7 +81,7 @@ static const char * const tok_alias[] = {
|
||||
"entity"
|
||||
};
|
||||
|
||||
static const char * const lex_descr[] = {
|
||||
static const char *const lex_descr[] = {
|
||||
"",
|
||||
"Word, all ASCII",
|
||||
"Word, all letters",
|
||||
@@ -189,7 +189,7 @@ typedef enum
|
||||
TPS_InHyphenNumWordPart,
|
||||
TPS_InHyphenUnsignedInt,
|
||||
TPS_Null /* last state (fake value) */
|
||||
} TParserState;
|
||||
} TParserState;
|
||||
|
||||
/* forward declaration */
|
||||
struct TParser;
|
||||
@@ -207,7 +207,7 @@ typedef struct
|
||||
TParserState tostate;
|
||||
int type;
|
||||
TParserSpecial special;
|
||||
} TParserStateActionItem;
|
||||
} TParserStateActionItem;
|
||||
|
||||
/* Flag bits in TParserStateActionItem.flags */
|
||||
#define A_NEXT 0x0000
|
||||
@@ -229,7 +229,7 @@ typedef struct TParserPosition
|
||||
TParserState state;
|
||||
struct TParserPosition *prev;
|
||||
const TParserStateActionItem *pushedAtAction;
|
||||
} TParserPosition;
|
||||
} TParserPosition;
|
||||
|
||||
typedef struct TParser
|
||||
{
|
||||
@@ -256,7 +256,7 @@ typedef struct TParser
|
||||
int lenbytetoken;
|
||||
int lenchartoken;
|
||||
int type;
|
||||
} TParser;
|
||||
} TParser;
|
||||
|
||||
|
||||
/* forward decls here */
|
||||
@@ -1239,12 +1239,12 @@ static const TParserStateActionItem actionTPS_InHyphenUnsignedInt[] = {
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const TParserStateActionItem *action; /* the actual state info */
|
||||
const TParserStateActionItem *action; /* the actual state info */
|
||||
TParserState state; /* only for Assert crosscheck */
|
||||
#ifdef WPARSER_TRACE
|
||||
const char *state_name; /* only for debug printout */
|
||||
#endif
|
||||
} TParserStateAction;
|
||||
} TParserStateAction;
|
||||
|
||||
#ifdef WPARSER_TRACE
|
||||
#define TPARSERSTATEACTION(state) \
|
||||
@@ -1566,7 +1566,7 @@ typedef struct
|
||||
{
|
||||
HeadlineWordEntry *words;
|
||||
int len;
|
||||
} hlCheck;
|
||||
} hlCheck;
|
||||
|
||||
static bool
|
||||
checkcondition_HL(void *checkval, QueryOperand * val)
|
||||
|
Reference in New Issue
Block a user