devhelp r1113 - in trunk: . src
- From: rhult svn gnome org
- To: svn-commits-list gnome org
- Subject: devhelp r1113 - in trunk: . src
- Date: Fri, 3 Oct 2008 15:39:38 +0000 (UTC)
Author: rhult
Date: Fri Oct 3 15:39:38 2008
New Revision: 1113
URL: http://svn.gnome.org/viewvc/devhelp?rev=1113&view=rev
Log:
2008-10-03 Richard Hult <richard imendio com>
* src/dh-parser.c: (parser_start_node_cb), (parser_end_node_cb):
Some micro optimizations of things that turned up in the profile:
Reduce number of strdups/frees, only try to fix up broken gtk-doc
files if needed.
Modified:
trunk/ChangeLog
trunk/src/dh-parser.c
Modified: trunk/src/dh-parser.c
==============================================================================
--- trunk/src/dh-parser.c (original)
+++ trunk/src/dh-parser.c Fri Oct 3 15:39:38 2008
@@ -30,8 +30,6 @@
#include "dh-link.h"
#include "dh-parser.h"
-#define d(x)
-#define DH_PARSER(o) ((DhParser *) o)
#define BYTES_PER_READ 4096
typedef struct {
@@ -85,13 +83,11 @@
gpointer user_data,
GError **error)
{
- DhParser *parser;
+ DhParser *parser = user_data;
gint i, line, col;
DhLink *dh_link;
gchar *full_link, *page;
- parser = DH_PARSER (user_data);
-
if (!parser->book_node) {
const gchar *xmlns = NULL;
const gchar *title = NULL;
@@ -356,28 +352,25 @@
* couldn't parse properly. We'll get this information in a
* better way soon from gtk-doc.
*/
- if (g_str_has_prefix (name, "struct ")) {
- name = name + 7;
- if (link_type == DH_LINK_TYPE_KEYWORD) {
+ if (link_type == DH_LINK_TYPE_KEYWORD) {
+ if (g_str_has_prefix (name, "struct ")) {
+ name = name + 7;
link_type = DH_LINK_TYPE_STRUCT;
- }
- }
- else if (g_str_has_prefix (name, "union ")) {
- name = name + 6;
- }
- else if (g_str_has_prefix (name, "enum ")) {
- name = name + 5;
- if (link_type == DH_LINK_TYPE_KEYWORD) {
- link_type = DH_LINK_TYPE_ENUM;
- }
- }
+ }
+ else if (g_str_has_prefix (name, "union ")) {
+ name = name + 6;
+ }
+ else if (g_str_has_prefix (name, "enum ")) {
+ name = name + 5;
+ link_type = DH_LINK_TYPE_ENUM;
+ }
+ }
dh_link = dh_link_new (link_type, name,
dh_link_get_book (parser->book_node->data),
page, full_link);
g_free (tmp);
-
g_free (full_link);
g_free (page);
@@ -404,9 +397,7 @@
gpointer user_data,
GError **error)
{
- DhParser *parser;
-
- parser = DH_PARSER (user_data);
+ DhParser *parser = user_data;
if (parser->parsing_chapters) {
g_node_reverse_children (parser->parent);
@@ -427,8 +418,6 @@
parser->parsing_functions = FALSE;
}
}
-/* else if (g_ascii_strcasecmp (node_name, "book") == 0) { */
-/* } */
}
static void
@@ -436,9 +425,7 @@
GError *error,
gpointer user_data)
{
- DhParser *parser;
-
- parser = DH_PARSER (user_data);
+ DhParser *parser = user_data;
g_markup_parse_context_free (parser->context);
parser->context = NULL;
@@ -655,7 +642,8 @@
gchar **split;
if ((split = g_strsplit (uri, ".", 2)) != NULL) {
- page = g_strdup (split[0]);
+ page = split[0];
+ split[0] = NULL;
g_strfreev (split);
}
return page;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]