Fix urldb_match_path().

Fix test code.

svn path=/trunk/netsurf/; revision=6316
This commit is contained in:
John Mark Bell 2009-01-31 02:49:26 +00:00
parent 966b402881
commit e2ebfb72f7
1 changed files with 13 additions and 5 deletions

View File

@ -1901,10 +1901,18 @@ struct path_data *urldb_find_url(const char *url)
struct path_data *urldb_match_path(const struct path_data *parent, struct path_data *urldb_match_path(const struct path_data *parent,
const char *path, const char *scheme, unsigned short port) const char *path, const char *scheme, unsigned short port)
{ {
const struct path_data *p = parent; const struct path_data *p;
const char *slash; const char *slash;
do { assert(parent != NULL);
assert(path[0] == '/');
/* Skip past leading / */
path++;
/* And start with children, as parent has no segment */
p = parent->children;
while (p != NULL) {
if (*path == '\0') if (*path == '\0')
return (struct path_data *) p; return (struct path_data *) p;
@ -1923,7 +1931,7 @@ struct path_data *urldb_match_path(const struct path_data *parent,
/* No match, try next sibling */ /* No match, try next sibling */
p = p->next; p = p->next;
} }
} while (p != NULL); }
return NULL; return NULL;
} }
@ -3977,7 +3985,7 @@ void warn_user(const char *warning, const char *detail)
printf("WARNING: %s %s\n", warning, detail); printf("WARNING: %s %s\n", warning, detail);
} }
void bitmap_destroy(struct bitmap *bitmap) void bitmap_destroy(void *bitmap)
{ {
} }
@ -4151,7 +4159,7 @@ int main(void)
/* /*
gcc -g -o urldbtest -std=c99 -DTEST_URLDB -I. \ gcc -g -o urldbtest -std=c99 -DTEST_URLDB -I. \
`pkg-config --cflags --libs libxml-2.0 cairo librsvg-2.0 libcurl` \ `pkg-config --cflags --libs libxml-2.0 cairo libcurl` \
content/urldb.c utils/url.c utils/utils.c utils/messages.c \ content/urldb.c utils/url.c utils/utils.c utils/messages.c \
utils/hashtable.c utils/filename.c utils/hashtable.c utils/filename.c
*/ */