diff options
author | Shaun McCance <shaunm@src.gnome.org> | 2005-01-01 01:21:38 +0000 |
---|---|---|
committer | Shaun McCance <shaunm@src.gnome.org> | 2005-01-01 01:21:38 +0000 |
commit | ef66ef78023bc44a5c4569ff1d419b2598868257 (patch) | |
tree | 68dca9896800a2574776367e22ec09b092db963d | |
parent | 9de907d07a17843d6eb19ea0124f5558dca4c8a4 (diff) | |
download | yelp-ef66ef78023bc44a5c4569ff1d419b2598868257.tar.gz |
- Strip off frags when doing doc_info_table lookups
* src/yelp-utils.c:
- Strip off frags when doing doc_info_table lookups
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/yelp-utils.c | 15 |
2 files changed, 18 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2004-12-31 Shaun McCance <shaunm@gnome.org> + * src/yelp-utils.c: + - Strip off frags when doing doc_info_table lookups + +2004-12-31 Shaun McCance <shaunm@gnome.org> + * src/yelp-info-pager.c: - Make a hash of section ids and do resolve_frag properly diff --git a/src/yelp-utils.c b/src/yelp-utils.c index c4cbe182..00eb8072 100644 --- a/src/yelp-utils.c +++ b/src/yelp-utils.c @@ -165,6 +165,7 @@ yelp_doc_info_get (const gchar *uri) { YelpDocInfo *doc; gint i; + gchar *c, *doc_uri; g_return_val_if_fail (uri != NULL, NULL); @@ -178,10 +179,19 @@ yelp_doc_info_get (const gchar *uri) g_free, (GDestroyNotify) yelp_doc_info_unref); - doc = (YelpDocInfo *) g_hash_table_lookup (doc_info_table, uri); + c = strchr (uri, '?'); + if (c == NULL) + c = strchr (uri, '#'); + + if (c != NULL) + doc_uri = g_strndup (uri, c - uri); + else + doc_uri = g_strdup (uri); + + doc = (YelpDocInfo *) g_hash_table_lookup (doc_info_table, doc_uri); if (!doc) { - doc = yelp_doc_info_new (uri); + doc = yelp_doc_info_new (doc_uri); if (doc && doc->type != YELP_DOC_TYPE_EXTERNAL) { YelpDocInfo *old_doc; @@ -213,6 +223,7 @@ yelp_doc_info_get (const gchar *uri) } } + g_free (doc_uri); return doc; } |