Fix some portability issues (reliance on gcc-isms).

This commit is contained in:
Tom Lane 2004-04-01 23:44:38 +00:00
parent 51d1a12ed1
commit 47fe0517fc
7 changed files with 46 additions and 17 deletions

View File

@ -24,11 +24,14 @@ static void *plan_getdict = NULL;
void
init_dict(Oid id, DictInfo * dict)
{
Oid arg[1] = {OIDOID};
Oid arg[1];
bool isnull;
Datum pars[1] = {ObjectIdGetDatum(id)};
Datum pars[1];
int stat;
arg[0] = OIDOID;
pars[0] = ObjectIdGetDatum(id);
memset(dict, 0, sizeof(DictInfo));
SPI_connect();
if (!plan_getdict)
@ -135,12 +138,15 @@ static void *plan_name2id = NULL;
Oid
name2id_dict(text *name)
{
Oid arg[1] = {TEXTOID};
Oid arg[1];
bool isnull;
Datum pars[1] = {PointerGetDatum(name)};
Datum pars[1];
int stat;
Oid id = findSNMap_t(&(DList.name2id_map), name);
arg[0] = TEXTOID;
pars[0] = PointerGetDatum(name);
if (id)
return id;

View File

@ -796,8 +796,9 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
int level=(snode) ? minpos : startpos; /* recursive minpos==level*/
int lenaff;
CMPDAffix *caff;
char notprobed[wordlen];
char *notprobed;
notprobed = (char *) palloc(wordlen);
memset(notprobed,1,wordlen);
var = CopyVar(orig,1);
@ -869,6 +870,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
/* well, it was last word */
var->stem[ var->nstem ] = strnduplicate(word + startpos, wordlen - startpos);
var->nstem++;
pfree(notprobed);
return var;
} else {
/* 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->nstem++;
pfree(notprobed);
return var;
}

View File

@ -433,8 +433,10 @@ Cover(DocRepresentation * doc, int len, QUERYTYPE * query, int *pos, int *p, int
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;
if (TS_execute(GETQUERY(query), &ch, false, checkcondition_DR))
{

View File

@ -56,7 +56,10 @@ Oid
findSNMap(SNMap * map, char *key)
{
SNMapEntry *ptr;
SNMapEntry ks = {key, 0};
SNMapEntry ks;
ks.key = key;
ks.value = 0;
if (map->len == 0 || !map->list)
return 0;

View File

@ -34,9 +34,9 @@ static Oid current_cfg_id = 0;
void
init_cfg(Oid id, TSCfgInfo * cfg)
{
Oid arg[2] = {OIDOID, OIDOID};
Oid arg[2];
bool isnull;
Datum pars[2] = {ObjectIdGetDatum(id), ObjectIdGetDatum(id)};
Datum pars[2];
int stat,
i,
j;
@ -44,6 +44,11 @@ init_cfg(Oid id, TSCfgInfo * cfg)
text *prsname = NULL;
MemoryContext oldcontext;
arg[0] = OIDOID;
arg[1] = OIDOID;
pars[0] = ObjectIdGetDatum(id);
pars[1] = ObjectIdGetDatum(id);
memset(cfg, 0, sizeof(TSCfgInfo));
SPI_connect();
if (!plan_getcfg)
@ -225,12 +230,15 @@ findcfg(Oid id)
Oid
name2id_cfg(text *name)
{
Oid arg[1] = {TEXTOID};
Oid arg[1];
bool isnull;
Datum pars[1] = {PointerGetDatum(name)};
Datum pars[1];
int stat;
Oid id = findSNMap_t(&(CList.name2id_map), name);
arg[0] = TEXTOID;
pars[0] = PointerGetDatum(name);
if (id)
return id;

View File

@ -27,11 +27,14 @@ static Oid current_parser_id = InvalidOid;
void
init_prs(Oid id, WParserInfo * prs)
{
Oid arg[1] = {OIDOID};
Oid arg[1];
bool isnull;
Datum pars[1] = {ObjectIdGetDatum(id)};
Datum pars[1];
int stat;
arg[0] = OIDOID;
pars[0] = ObjectIdGetDatum(id);
memset(prs, 0, sizeof(WParserInfo));
SPI_connect();
if (!plan_getparser)
@ -132,16 +135,18 @@ static void *plan_name2id = NULL;
Oid
name2id_prs(text *name)
{
Oid arg[1] = {TEXTOID};
Oid arg[1];
bool isnull;
Datum pars[1] = {PointerGetDatum(name)};
Datum pars[1];
int stat;
Oid id = findSNMap_t(&(PList.name2id_map), name);
arg[0] = TEXTOID;
pars[0] = PointerGetDatum(name);
if (id)
return id;
SPI_connect();
if (!plan_name2id)
{

View File

@ -156,8 +156,10 @@ hlCover(HLPRSTEXT * prs, QUERYTYPE * query, int *p, int *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))
return true;
else