]> granicus.if.org Git - postgresql/commitdiff
Fix various comparing functions
authorTeodor Sigaev <teodor@sigaev.ru>
Thu, 31 Mar 2005 15:12:08 +0000 (15:12 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Thu, 31 Mar 2005 15:12:08 +0000 (15:12 +0000)
contrib/tsearch2/dict.c
contrib/tsearch2/rank.c
contrib/tsearch2/ts_cfg.c
contrib/tsearch2/tsvector.c
contrib/tsearch2/wparser.c

index 9ceb78ffb8377bcd1eea1b6c9100ee47168fc6f9..c55e3a287311c1923ed266a7d863c59dc911de32 100644 (file)
@@ -88,7 +88,9 @@ reset_dict(void)
 static int
 comparedict(const void *a, const void *b)
 {
-       return ((DictInfo *) a)->dict_id - ((DictInfo *) b)->dict_id;
+       if ( ((DictInfo *) a)->dict_id == ((DictInfo *) b)->dict_id )
+               return 0;
+       return ( ((DictInfo *) a)->dict_id < ((DictInfo *) b)->dict_id ) ? -1 : 1;
 }
 
 DictInfo *
index 78f05f456762d3f94bfc462ab11b60390b2ef3a1..c6cbd1c9591fe72ff4bd0ea4184077fb9c943630 100644 (file)
@@ -386,7 +386,7 @@ static int
 compareDocR(const void *a, const void *b)
 {
        if (((DocRepresentation *) a)->pos == ((DocRepresentation *) b)->pos)
-               return 1;
+               return 0;
        return (((DocRepresentation *) a)->pos > ((DocRepresentation *) b)->pos) ? 1 : -1;
 }
 
@@ -652,7 +652,7 @@ static int
 compareDocWord(const void *a, const void *b)
 {
        if (((DocWord *) a)->pos == ((DocWord *) b)->pos)
-               return 1;
+               return 0;
        return (((DocWord *) a)->pos > ((DocWord *) b)->pos) ? 1 : -1;
 }
 
index 0898b9192400b576ffaa59306b5d76b39eb6376b..c1f5178ec05749083756dda050cd9aa7455c8a7f 100644 (file)
@@ -181,7 +181,9 @@ reset_cfg(void)
 static int
 comparecfg(const void *a, const void *b)
 {
-       return ((TSCfgInfo *) a)->id - ((TSCfgInfo *) b)->id;
+       if ( ((TSCfgInfo *) a)->id == ((TSCfgInfo *) b)->id )
+               return 0;
+       return ( ((TSCfgInfo *) a)->id < ((TSCfgInfo *) b)->id ) ? -1 : 1;
 }
 
 TSCfgInfo *
index 5670c0cf5fc8414f20e153f81e2ce547b25b9427..f3afc9f2cd1b9d074f27fc63d4682c2cdc7bd569 100644 (file)
@@ -51,7 +51,7 @@ static int
 comparePos(const void *a, const void *b)
 {
        if (((WordEntryPos *) a)->pos == ((WordEntryPos *) b)->pos)
-               return 1;
+               return 0;
        return (((WordEntryPos *) a)->pos > ((WordEntryPos *) b)->pos) ? 1 : -1;
 }
 
index b7e45e51885f449d9160e46721cb43bf62068bf4..7945357531ed6237fad016de63b5754f006ad25b 100644 (file)
@@ -87,7 +87,9 @@ reset_prs(void)
 static int
 compareprs(const void *a, const void *b)
 {
-       return ((WParserInfo *) a)->prs_id - ((WParserInfo *) b)->prs_id;
+       if ( ((WParserInfo *) a)->prs_id == ((WParserInfo *) b)->prs_id )
+               return 0;
+       return ( ((WParserInfo *) a)->prs_id < ((WParserInfo *) b)->prs_id ) ? -1 : 1;
 }
 
 WParserInfo *