diff options
Diffstat (limited to 'src/replace-table.c')
| -rw-r--r-- | src/replace-table.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/replace-table.c b/src/replace-table.c index 9c1b254..a36a83c 100644 --- a/src/replace-table.c +++ b/src/replace-table.c @@ -34,6 +34,7 @@ struct ReplaceTable { GHashTable *table; GHashTable *defines; GHashTable *functions; + gboolean strip_unused_tags; }; typedef struct { @@ -50,6 +51,7 @@ replace_table_new () table = g_new0 (ReplaceTable, 1); table->table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); table->functions = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + table->strip_unused_tags = TRUE; /* default */ return table; } @@ -66,6 +68,18 @@ replace_table_free (ReplaceTable *table) /* + * replace_table_set_strip_unused_tags: set whether all unused/unknown tags should be stripped (default = TRUE) + * + */ +void +replace_table_set_strip_unused_tags (ReplaceTable *table, gboolean value) +{ + g_return_if_fail (table != NULL); + + table->strip_unused_tags = value; +} + +/* * replace_table_add_key: add tag/value pair to replace * * tag, value will be referenced inside @@ -345,7 +359,7 @@ replace_table_process (gchar **buffer, ReplaceTable *table) } /* push the tag if not matched above */ - if (! handled) + if (! handled && ! table->strip_unused_tags) g_string_append_len (dst, start, end - start + 1); g_free (token); |
