X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftermlists.c;h=0a22b3b59e09f63d9a9cc62ac18b911f0a53f570;hb=d5ffc2f6e667c1d849bf7579add8435664e678c5;hp=cd8fe72df90e59b1624405ec04535f263e2d9d5d;hpb=cc29eab9f928f6cd0f4231cb2e554e2ac7b0b1f3;p=pazpar2-moved-to-github.git diff --git a/src/termlists.c b/src/termlists.c index cd8fe72..0a22b3b 100644 --- a/src/termlists.c +++ b/src/termlists.c @@ -1,4 +1,4 @@ -/* $Id: termlists.c,v 1.7 2007-04-10 08:48:56 adam Exp $ +/* $Id: termlists.c,v 1.8 2007-05-10 09:24:32 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -147,10 +147,10 @@ void termlist_insert(struct termlist *tl, const char *term) if (strlen(term) > 255) return; strcpy(buf, term); - for (cp = buf + strlen(buf) - 1; cp > buf && - (*cp == ',' || *cp == '.' || *cp == ' ' || *cp == '-'); cp--) - *cp = '\0'; - + /* chop right */ + for (cp = buf + strlen(buf); cp != buf && strchr(",. -", cp[-1]); cp--) + cp[-1] = '\0'; + bucket = hash((unsigned char *)buf) & tl->hashmask; for (p = &tl->hashtable[bucket]; *p; p = &(*p)->next) {