From 68b9417a6bc8344f68f8a8206d2f2781079bd713 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 12 May 2020 21:21:59 +0100 Subject: consolodate the textsearch code into a single module --- content/content.c | 81 ------------------------------------------------------- 1 file changed, 81 deletions(-) (limited to 'content/content.c') diff --git a/content/content.c b/content/content.c index 34602d686..bc3f48429 100644 --- a/content/content.c +++ b/content/content.c @@ -917,87 +917,6 @@ content_drop_file_at_point(struct hlcache_handle *h, } -/** - * Terminate a search. - * - * \param c content to clear - */ -static nserror content_textsearch__clear(struct content *c) -{ - free(c->textsearch.string); - c->textsearch.string = NULL; - - if (c->textsearch.context != NULL) { - content_textsearch_destroy(c->textsearch.context); - c->textsearch.context = NULL; - } - return NSERROR_OK; -} - -/* exported interface, documented in content/content.h */ -nserror -content_textsearch(struct hlcache_handle *h, - void *context, - search_flags_t flags, - const char *string) -{ - struct content *c = hlcache_handle_get_content(h); - nserror res; - - assert(c != NULL); - - if (string != NULL && - c->textsearch.string != NULL && - c->textsearch.context != NULL && - strcmp(string, c->textsearch.string) == 0) { - /* Continue prev. search */ - content_textsearch_step(c->textsearch.context, flags, string); - - } else if (string != NULL) { - /* New search */ - free(c->textsearch.string); - c->textsearch.string = strdup(string); - if (c->textsearch.string == NULL) { - return NSERROR_NOMEM; - } - - if (c->textsearch.context != NULL) { - content_textsearch_destroy(c->textsearch.context); - c->textsearch.context = NULL; - } - - res = content_textsearch_create(c, - context, - &c->textsearch.context); - if (res != NSERROR_OK) { - return res; - } - - content_textsearch_step(c->textsearch.context, flags, string); - - } else { - /* Clear search */ - content_textsearch__clear(c); - - free(c->textsearch.string); - c->textsearch.string = NULL; - } - - return NSERROR_OK; -} - - - -/* exported interface, documented in content/content.h */ -nserror content_textsearch_clear(struct hlcache_handle *h) -{ - struct content *c = hlcache_handle_get_content(h); - assert(c != 0); - - return(content_textsearch__clear(c)); -} - - /* exported interface documented in content/content.h */ nserror content_debug_dump(struct hlcache_handle *h, FILE *f, enum content_debug op) -- cgit v1.2.3