mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix some portability issues (reliance on gcc-isms).
This commit is contained in:
@ -24,11 +24,14 @@ static void *plan_getdict = NULL;
|
|||||||
void
|
void
|
||||||
init_dict(Oid id, DictInfo * dict)
|
init_dict(Oid id, DictInfo * dict)
|
||||||
{
|
{
|
||||||
Oid arg[1] = {OIDOID};
|
Oid arg[1];
|
||||||
bool isnull;
|
bool isnull;
|
||||||
Datum pars[1] = {ObjectIdGetDatum(id)};
|
Datum pars[1];
|
||||||
int stat;
|
int stat;
|
||||||
|
|
||||||
|
arg[0] = OIDOID;
|
||||||
|
pars[0] = ObjectIdGetDatum(id);
|
||||||
|
|
||||||
memset(dict, 0, sizeof(DictInfo));
|
memset(dict, 0, sizeof(DictInfo));
|
||||||
SPI_connect();
|
SPI_connect();
|
||||||
if (!plan_getdict)
|
if (!plan_getdict)
|
||||||
@ -135,12 +138,15 @@ static void *plan_name2id = NULL;
|
|||||||
Oid
|
Oid
|
||||||
name2id_dict(text *name)
|
name2id_dict(text *name)
|
||||||
{
|
{
|
||||||
Oid arg[1] = {TEXTOID};
|
Oid arg[1];
|
||||||
bool isnull;
|
bool isnull;
|
||||||
Datum pars[1] = {PointerGetDatum(name)};
|
Datum pars[1];
|
||||||
int stat;
|
int stat;
|
||||||
Oid id = findSNMap_t(&(DList.name2id_map), name);
|
Oid id = findSNMap_t(&(DList.name2id_map), name);
|
||||||
|
|
||||||
|
arg[0] = TEXTOID;
|
||||||
|
pars[0] = PointerGetDatum(name);
|
||||||
|
|
||||||
if (id)
|
if (id)
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
|
@ -796,8 +796,9 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
|
|||||||
int level=(snode) ? minpos : startpos; /* recursive minpos==level*/
|
int level=(snode) ? minpos : startpos; /* recursive minpos==level*/
|
||||||
int lenaff;
|
int lenaff;
|
||||||
CMPDAffix *caff;
|
CMPDAffix *caff;
|
||||||
char notprobed[wordlen];
|
char *notprobed;
|
||||||
|
|
||||||
|
notprobed = (char *) palloc(wordlen);
|
||||||
memset(notprobed,1,wordlen);
|
memset(notprobed,1,wordlen);
|
||||||
var = CopyVar(orig,1);
|
var = CopyVar(orig,1);
|
||||||
|
|
||||||
@ -869,6 +870,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
|
|||||||
/* well, it was last word */
|
/* well, it was last word */
|
||||||
var->stem[ var->nstem ] = strnduplicate(word + startpos, wordlen - startpos);
|
var->stem[ var->nstem ] = strnduplicate(word + startpos, wordlen - startpos);
|
||||||
var->nstem++;
|
var->nstem++;
|
||||||
|
pfree(notprobed);
|
||||||
return var;
|
return var;
|
||||||
} else {
|
} else {
|
||||||
/* then we will search more big word at the same point */
|
/* then we will search more big word at the same point */
|
||||||
@ -892,6 +894,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
|
|||||||
|
|
||||||
var->stem[ var->nstem ] = strnduplicate(word + startpos, wordlen - startpos);
|
var->stem[ var->nstem ] = strnduplicate(word + startpos, wordlen - startpos);
|
||||||
var->nstem++;
|
var->nstem++;
|
||||||
|
pfree(notprobed);
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,8 +433,10 @@ Cover(DocRepresentation * doc, int len, QUERYTYPE * query, int *pos, int *p, int
|
|||||||
|
|
||||||
if (*p <= *q)
|
if (*p <= *q)
|
||||||
{
|
{
|
||||||
ChkDocR ch = {f, (doc + lastpos) - f + 1};
|
ChkDocR ch;
|
||||||
|
|
||||||
|
ch.doc = f;
|
||||||
|
ch.len = (doc + lastpos) - f + 1;
|
||||||
*pos = f - doc + 1;
|
*pos = f - doc + 1;
|
||||||
if (TS_execute(GETQUERY(query), &ch, false, checkcondition_DR))
|
if (TS_execute(GETQUERY(query), &ch, false, checkcondition_DR))
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,10 @@ Oid
|
|||||||
findSNMap(SNMap * map, char *key)
|
findSNMap(SNMap * map, char *key)
|
||||||
{
|
{
|
||||||
SNMapEntry *ptr;
|
SNMapEntry *ptr;
|
||||||
SNMapEntry ks = {key, 0};
|
SNMapEntry ks;
|
||||||
|
|
||||||
|
ks.key = key;
|
||||||
|
ks.value = 0;
|
||||||
|
|
||||||
if (map->len == 0 || !map->list)
|
if (map->len == 0 || !map->list)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -34,9 +34,9 @@ static Oid current_cfg_id = 0;
|
|||||||
void
|
void
|
||||||
init_cfg(Oid id, TSCfgInfo * cfg)
|
init_cfg(Oid id, TSCfgInfo * cfg)
|
||||||
{
|
{
|
||||||
Oid arg[2] = {OIDOID, OIDOID};
|
Oid arg[2];
|
||||||
bool isnull;
|
bool isnull;
|
||||||
Datum pars[2] = {ObjectIdGetDatum(id), ObjectIdGetDatum(id)};
|
Datum pars[2];
|
||||||
int stat,
|
int stat,
|
||||||
i,
|
i,
|
||||||
j;
|
j;
|
||||||
@ -44,6 +44,11 @@ init_cfg(Oid id, TSCfgInfo * cfg)
|
|||||||
text *prsname = NULL;
|
text *prsname = NULL;
|
||||||
MemoryContext oldcontext;
|
MemoryContext oldcontext;
|
||||||
|
|
||||||
|
arg[0] = OIDOID;
|
||||||
|
arg[1] = OIDOID;
|
||||||
|
pars[0] = ObjectIdGetDatum(id);
|
||||||
|
pars[1] = ObjectIdGetDatum(id);
|
||||||
|
|
||||||
memset(cfg, 0, sizeof(TSCfgInfo));
|
memset(cfg, 0, sizeof(TSCfgInfo));
|
||||||
SPI_connect();
|
SPI_connect();
|
||||||
if (!plan_getcfg)
|
if (!plan_getcfg)
|
||||||
@ -225,12 +230,15 @@ findcfg(Oid id)
|
|||||||
Oid
|
Oid
|
||||||
name2id_cfg(text *name)
|
name2id_cfg(text *name)
|
||||||
{
|
{
|
||||||
Oid arg[1] = {TEXTOID};
|
Oid arg[1];
|
||||||
bool isnull;
|
bool isnull;
|
||||||
Datum pars[1] = {PointerGetDatum(name)};
|
Datum pars[1];
|
||||||
int stat;
|
int stat;
|
||||||
Oid id = findSNMap_t(&(CList.name2id_map), name);
|
Oid id = findSNMap_t(&(CList.name2id_map), name);
|
||||||
|
|
||||||
|
arg[0] = TEXTOID;
|
||||||
|
pars[0] = PointerGetDatum(name);
|
||||||
|
|
||||||
if (id)
|
if (id)
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
|
@ -27,11 +27,14 @@ static Oid current_parser_id = InvalidOid;
|
|||||||
void
|
void
|
||||||
init_prs(Oid id, WParserInfo * prs)
|
init_prs(Oid id, WParserInfo * prs)
|
||||||
{
|
{
|
||||||
Oid arg[1] = {OIDOID};
|
Oid arg[1];
|
||||||
bool isnull;
|
bool isnull;
|
||||||
Datum pars[1] = {ObjectIdGetDatum(id)};
|
Datum pars[1];
|
||||||
int stat;
|
int stat;
|
||||||
|
|
||||||
|
arg[0] = OIDOID;
|
||||||
|
pars[0] = ObjectIdGetDatum(id);
|
||||||
|
|
||||||
memset(prs, 0, sizeof(WParserInfo));
|
memset(prs, 0, sizeof(WParserInfo));
|
||||||
SPI_connect();
|
SPI_connect();
|
||||||
if (!plan_getparser)
|
if (!plan_getparser)
|
||||||
@ -132,16 +135,18 @@ static void *plan_name2id = NULL;
|
|||||||
Oid
|
Oid
|
||||||
name2id_prs(text *name)
|
name2id_prs(text *name)
|
||||||
{
|
{
|
||||||
Oid arg[1] = {TEXTOID};
|
Oid arg[1];
|
||||||
bool isnull;
|
bool isnull;
|
||||||
Datum pars[1] = {PointerGetDatum(name)};
|
Datum pars[1];
|
||||||
int stat;
|
int stat;
|
||||||
Oid id = findSNMap_t(&(PList.name2id_map), name);
|
Oid id = findSNMap_t(&(PList.name2id_map), name);
|
||||||
|
|
||||||
|
arg[0] = TEXTOID;
|
||||||
|
pars[0] = PointerGetDatum(name);
|
||||||
|
|
||||||
if (id)
|
if (id)
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
|
|
||||||
SPI_connect();
|
SPI_connect();
|
||||||
if (!plan_name2id)
|
if (!plan_name2id)
|
||||||
{
|
{
|
||||||
|
@ -156,8 +156,10 @@ hlCover(HLPRSTEXT * prs, QUERYTYPE * query, int *p, int *q)
|
|||||||
|
|
||||||
if (*p <= *q)
|
if (*p <= *q)
|
||||||
{
|
{
|
||||||
hlCheck ch = {&(prs->words[*p]), *q - *p + 1};
|
hlCheck ch;
|
||||||
|
|
||||||
|
ch.words = &(prs->words[*p]);
|
||||||
|
ch.len = *q - *p + 1;
|
||||||
if (TS_execute(GETQUERY(query), &ch, false, checkcondition_HL))
|
if (TS_execute(GETQUERY(query), &ch, false, checkcondition_HL))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user