diff options
author | NotZed <NotZed@HelixCode.com> | 2000-02-17 09:25:49 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-02-17 09:25:49 +0800 |
commit | cd9df589eacaf47a085119fdb91e41a01eab9bb0 (patch) | |
tree | e68846ba084f2e796cb85b780340d5f4ce1a976f /libibex | |
parent | 5a80143a526ddc84b31e8458c525d40580c06810 (diff) | |
download | gsoc2013-evolution-cd9df589eacaf47a085119fdb91e41a01eab9bb0.tar.gz gsoc2013-evolution-cd9df589eacaf47a085119fdb91e41a01eab9bb0.tar.zst gsoc2013-evolution-cd9df589eacaf47a085119fdb91e41a01eab9bb0.zip |
Finds if a word is indexed under a given name.
2000-02-16 NotZed <NotZed@HelixCode.com>
* find.[ch] (ibex_find_name): Finds if a word is indexed under a
given name.
svn path=/trunk/; revision=1812
Diffstat (limited to 'libibex')
-rw-r--r-- | libibex/ChangeLog | 5 | ||||
-rw-r--r-- | libibex/find.c | 22 | ||||
-rw-r--r-- | libibex/ibex.h | 4 |
3 files changed, 30 insertions, 1 deletions
diff --git a/libibex/ChangeLog b/libibex/ChangeLog index 4aa2d91b0e..d5b183c451 100644 --- a/libibex/ChangeLog +++ b/libibex/ChangeLog @@ -1,3 +1,8 @@ +2000-02-16 NotZed <NotZed@HelixCode.com> + + * find.[ch] (ibex_find_name): Finds if a word is indexed under a + given name. + 2000-02-14 NotZed <notzed@zedzone.helixcode.com> * Makefile: Hack together a build using libtool. This should all diff --git a/libibex/find.c b/libibex/find.c index 0937331a83..5b45c57787 100644 --- a/libibex/find.c +++ b/libibex/find.c @@ -25,7 +25,27 @@ ibex_find(ibex *ib, char *word) g_ptr_array_add(ret, ibf->name); } } - return ret; + return ret; +} + +gboolean +ibex_find_name(ibex *ib, char *name, char *word) +{ + GPtrArray *refs; + ibex_file *ibf; + int i; + + refs = g_hash_table_lookup(ib->words, word); + if (refs) + { + for (i = 0; i < refs->len; i++) + { + ibf = g_ptr_array_index(refs, i); + if (!strcmp(ibf->name, name)) + return TRUE; + } + } + return FALSE; } static gint diff --git a/libibex/ibex.h b/libibex/ibex.h index e430fc700d..8afac0dc95 100644 --- a/libibex/ibex.h +++ b/libibex/ibex.h @@ -65,6 +65,10 @@ void ibex_rename(ibex *ib, char *oldfilename, char *newfilename); */ GPtrArray *ibex_find(ibex *ib, char *word); +/* Find if a word is contained in a specific name reference. + */ +gboolean ibex_find_name(ibex *ib, char *name, char *word); + /* Return all the files containing all of the words in the given * array. Returned data is like with ibex_find. */ |