[Xapian-devel] Adding an external library to Xapian
James Aylett
james-xapian at tartarus.org
Sun Apr 13 19:40:17 BST 2014
On 13 Apr 2014, at 19:30, Siddhant Mutha <siddhantmutha at gmail.com> wrote:
> It is there: https://github.com/sidmutha/xapian/blob/master/xapian-core/api/Makefile.mk#L53
Apologies, it's in the commit but the commit message is in a format which confused me for a minute.
> On an other note, I'm trying to run ./bootstrap from the cloned repo. But it gives an error saying "unknown option -C" followed by "Bootstrap failed".
Yes, you need to either upgrade git or roll back to b3e3f03d5954ab11e8e2f0952dedd5cef0d72358 (or just git revert 246a4c11d4f34a193f656a6b4aa70946426981ae for the time being); we'll be fixing that properly soon.
You need to delete line 23 of include/xapian/trie.h, which includes a file which no longer exists on master. (You could have worked off the tag for 1.2.17, which is what I was doing previously, but working off master is better.)
You still have to fix all your (*it)->value problems (you seem to have caught two out of four), and there's another problem where your loop var should be an unsigned int which I forgot to point out beforehand. Hopefully once you get bootstrap working you'll be able to see these failures yourself. The patch I've applied to your master (on top of the git revert above) is:
diff --git a/xapian-core/api/trie.cc b/xapian-core/api/trie.cc
index eba3a15..b856f39 100644
--- a/xapian-core/api/trie.cc
+++ b/xapian-core/api/trie.cc
@@ -33,10 +33,10 @@ Trie::Trie() {
void
Trie::add_term(std::string term) {
struct trie_node *curr_node = &root;
- for (int i = 0; i < term.size(); ++i) {
+ for (unsigned int i = 0; i < term.size(); ++i) {
for (vector<trie_node *>::iterator it = curr_node->children.begi
it != curr_node->children.end(); ++it) {
- if (*it->value == term[i]) {
+ if ((*it)->value == term[i]) {
curr_node = *it;
break;
} else if(it + 1 == curr_node->children.end() ||
@@ -55,10 +55,10 @@ Trie::add_term(std::string term) {
bool
Trie::search_term(std::string term) {
struct trie_node *curr_node = &root;
- for (int i = 0; i < term.size(); ++i) {
+ for (unsigned int i = 0; i < term.size(); ++i) {
for (vector<trie_node *>::iterator it = curr_node->children.begi
it != curr_node->children.end(); ++it) {
- if (*it->value == term[i]) {
+ if ((*it)->value == term[i]) {
curr_node = *it;
break;
} else if(it + 1 == curr_node->children.end() ||
diff --git a/xapian-core/include/xapian/trie.h b/xapian-core/include/xapian/trie
index 14de006..79b2371 100644
--- a/xapian-core/include/xapian/trie.h
+++ b/xapian-core/include/xapian/trie.h
@@ -20,7 +20,6 @@
#ifndef XAPIAN_INCLUDED_TRIE_H
#define XAPIAN_INCLUDED_TRIE_H
-#include <xapian/base.h>
#include <xapian/visibility.h>
#include <string>
J
--
James Aylett, occasional trouble-maker
xapian.org
More information about the Xapian-devel
mailing list