make it easier to grep for usage of child parsers

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6439 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2001-12-30 23:13:41 +00:00
parent 546694b975
commit f2aeb91f76
2 changed files with 14 additions and 10 deletions

View File

@ -139,9 +139,11 @@ sixtp_new(void)
{
sixtp *s = g_new0(sixtp, 1);
if(s) {
s->children = g_hash_table_new(g_str_hash, g_str_equal);
if(!s->children) {
if(s)
{
s->child_parsers = g_hash_table_new(g_str_hash, g_str_equal);
if(!s->child_parsers)
{
g_free(s);
s = NULL;
}
@ -240,8 +242,8 @@ sixtp_destroy_node(sixtp *sp, GHashTable *corpses)
{
g_return_if_fail(sp);
g_return_if_fail(corpses);
g_hash_table_foreach(sp->children, sixtp_destroy_child, corpses);
g_hash_table_destroy(sp->children);
g_hash_table_foreach(sp->child_parsers, sixtp_destroy_child, corpses);
g_hash_table_destroy(sp->child_parsers);
g_free(sp);
}
@ -299,7 +301,8 @@ sixtp_add_sub_parser(sixtp *parser, const gchar* tag, sixtp *sub_parser)
g_return_val_if_fail(tag, FALSE);
g_return_val_if_fail(sub_parser, FALSE);
g_hash_table_insert(parser->children, g_strdup(tag), (gpointer) sub_parser);
g_hash_table_insert(parser->child_parsers,
g_strdup(tag), (gpointer) sub_parser);
return(TRUE);
}
@ -392,7 +395,7 @@ sixtp_sax_start_handler(void *user_data,
/* Use an extended lookup so we can get *our* copy of the key.
Since we've strduped it, we know its lifetime... */
lookup_success = g_hash_table_lookup_extended(current_parser->children,
lookup_success = g_hash_table_lookup_extended(current_parser->child_parsers,
name,
(gpointer) &next_parser_tag,
(gpointer) &next_parser);
@ -401,7 +404,7 @@ sixtp_sax_start_handler(void *user_data,
{
/* magic catch all value */
lookup_success = g_hash_table_lookup_extended(
current_parser->children, SIXTP_MAGIC_CATCHER,
current_parser->child_parsers, SIXTP_MAGIC_CATCHER,
(gpointer) &next_parser_tag, (gpointer) &next_parser);
if(!lookup_success)
{

View File

@ -85,7 +85,8 @@ typedef void (*sixtp_fail_handler)(gpointer data_for_children,
gpointer *result,
const gchar *tag);
typedef struct sixtp {
typedef struct sixtp
{
/* If you change this, don't forget to modify all the copy/etc. functions */
sixtp_start_handler start_handler;
sixtp_before_child_handler before_child;
@ -106,7 +107,7 @@ typedef struct sixtp {
/* called to cleanup character results when cleaning up this node's
children. */
GHashTable *children;
GHashTable *child_parsers;
} sixtp;
typedef enum {