X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Ffulltext%2Fserv_fulltext.c;h=cc3906867981e6154ec43d1fc93b586cec0f212d;hb=932aa75b3b39620fbde008af413e3cace3420af8;hp=3fa22d781618b3cb3ba93a13336ee71372daccaf;hpb=9b298a38621af9f8e63d35422c0dac749b306b48;p=citadel.git diff --git a/citadel/modules/fulltext/serv_fulltext.c b/citadel/modules/fulltext/serv_fulltext.c index 3fa22d781..cc3906867 100644 --- a/citadel/modules/fulltext/serv_fulltext.c +++ b/citadel/modules/fulltext/serv_fulltext.c @@ -415,29 +415,29 @@ void ft_search(int *fts_num_msgs, long **fts_msgs, const char *search_string) { } free(tokens); - if (all_msgs != NULL) + if (all_msgs != NULL) { qsort(all_msgs, num_all_msgs, sizeof(long), longcmp); - /* - * At this point, if a message appears num_tokens times in the - * list, then it contains all of the search tokens. - */ - if (num_all_msgs >= num_tokens) - for (j=0; j<(num_all_msgs-num_tokens+1); ++j) { - if (all_msgs[j] == all_msgs[j+num_tokens-1]) { - - ++num_ret_msgs; - if (num_ret_msgs > num_ret_alloc) { - num_ret_alloc += 64; - ret_msgs = realloc(ret_msgs, - (num_ret_alloc*sizeof(long)) ); + /* + * At this point, if a message appears num_tokens times in the + * list, then it contains all of the search tokens. + */ + if (num_all_msgs >= num_tokens) + for (j=0; j<(num_all_msgs-num_tokens+1); ++j) { + if (all_msgs[j] == all_msgs[j+num_tokens-1]) { + + ++num_ret_msgs; + if (num_ret_msgs > num_ret_alloc) { + num_ret_alloc += 64; + ret_msgs = realloc(ret_msgs, + (num_ret_alloc*sizeof(long)) ); + } + ret_msgs[num_ret_msgs - 1] = all_msgs[j]; + + } } - ret_msgs[num_ret_msgs - 1] = all_msgs[j]; - - } - } - if (all_msgs != NULL) free(all_msgs); + } } *fts_num_msgs = num_ret_msgs;