Skip to content

Commit df9d87f

Browse files
committed
Previous commit wasnt full...
1 parent de55c0c commit df9d87f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

contrib/tsearch2/ispell/spell.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define MAXNORMLEN 256
1212

1313
#define STRNCASECMP(x,y) pg_strncasecmp(x, y, strlen(y))
14-
#define GETWCHAR(W,L,N,T) ( ((uint8*)(W))[ ((T)=='p') ? (N) : ( (L) - 1 - (N) ) ] )
14+
#define GETWCHAR(W,L,N,T) ( ((uint8*)(W))[ ((T)==FF_PREFIX) ? (N) : ( (L) - 1 - (N) ) ] )
1515
#define GETCHAR(A,N,T) GETWCHAR( (A)->repl, (A)->replen, N, T )
1616

1717

@@ -103,7 +103,7 @@ cmpaffix(const void *s1, const void *s2)
103103
return -1;
104104
if (((const AFFIX *) s1)->type > ((const AFFIX *) s2)->type)
105105
return 1;
106-
if (((const AFFIX *) s1)->type == 'p')
106+
if (((const AFFIX *) s1)->type == FF_PREFIX)
107107
return (strcmp(((const AFFIX *) s1)->repl, ((const AFFIX *) s2)->repl));
108108
else
109109
return (strbcmp(((const AFFIX *) s1)->repl, ((const AFFIX *) s2)->repl));
@@ -620,7 +620,7 @@ NISortAffixes(IspellDict * Conf)
620620

621621
for (i = 0; i < Conf->naffixes; i++) {
622622
Affix = &(((AFFIX *) Conf->Affix)[i]);
623-
if ( Affix->type == 's' ) {
623+
if ( Affix->type == FF_SUFFIX ) {
624624
if ( firstsuffix<0 ) firstsuffix=i;
625625
if ( Affix->flagflags & FF_COMPOUNDONLYAFX ) {
626626
if ( !ptr->affix || strbncmp((ptr-1)->affix, Affix->repl, (ptr-1)->len) ) {
@@ -635,8 +635,8 @@ NISortAffixes(IspellDict * Conf)
635635
ptr->affix = NULL;
636636
Conf->CompoundAffix = (CMPDAffix*)realloc( Conf->CompoundAffix, sizeof(CMPDAffix) * (ptr-Conf->CompoundAffix+1) );
637637

638-
Conf->Prefix = mkANode(Conf, 0, firstsuffix, 0, 'p');
639-
Conf->Suffix = mkANode(Conf, firstsuffix, Conf->naffixes, 0, 's');
638+
Conf->Prefix = mkANode(Conf, 0, firstsuffix, 0, FF_PREFIX);
639+
Conf->Suffix = mkANode(Conf, firstsuffix, Conf->naffixes, 0, FF_SUFFIX);
640640
mkVoidAffix(Conf, 1, firstsuffix);
641641
mkVoidAffix(Conf, 0, firstsuffix);
642642
}
@@ -773,7 +773,7 @@ NormalizeSubWord(IspellDict * Conf, char *word, char flag) {
773773
pnode=Conf->Prefix;
774774
plevel=0;
775775
while(pnode) {
776-
prefix=FinfAffixes(pnode, word, wrdlen, &plevel,'p');
776+
prefix=FinfAffixes(pnode, word, wrdlen, &plevel,FF_PREFIX);
777777
if (!prefix) break;
778778
for(j=0;j<prefix->naff;j++) {
779779
if ( CheckAffix(word,wrdlen,prefix->aff[j], flag, newword) ) {
@@ -792,7 +792,7 @@ NormalizeSubWord(IspellDict * Conf, char *word, char flag) {
792792
/* Find all other NORMAL forms of the 'word' (check suffix and then prefix)*/
793793
while( snode ) {
794794
/* find possible suffix */
795-
suffix = FinfAffixes(snode, word, wrdlen, &slevel, 's');
795+
suffix = FinfAffixes(snode, word, wrdlen, &slevel, FF_SUFFIX);
796796
if (!suffix) break;
797797
/* foreach suffix check affix */
798798
for(i=0;i<suffix->naff;i++) {
@@ -809,7 +809,7 @@ NormalizeSubWord(IspellDict * Conf, char *word, char flag) {
809809
plevel=0;
810810
swrdlen=strlen(newword);
811811
while(pnode) {
812-
prefix=FinfAffixes(pnode, newword, swrdlen, &plevel,'p');
812+
prefix=FinfAffixes(pnode, newword, swrdlen, &plevel,FF_PREFIX);
813813
if (!prefix) break;
814814
for(j=0;j<prefix->naff;j++) {
815815
if ( CheckAffix(newword,swrdlen,prefix->aff[j], flag, pnewword) ) {
@@ -894,7 +894,7 @@ SplitToVariants( IspellDict * Conf, SPNode *snode, SplitVar * orig, char *word,
894894
StopLow = node->data;
895895
StopHigh = node->data+node->length;
896896
while (StopLow < StopHigh) {
897-
StopMiddle = StopLow + (StopHigh - StopLow) / 2;
897+
StopMiddle = StopLow + ((StopHigh - StopLow) >> 1);
898898
if ( StopMiddle->val == ((uint8*)(word))[level] ) {
899899
break;
900900
} else if ( StopMiddle->val < ((uint8*)(word))[level] ) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy