diff options
Diffstat (limited to 'epan/ex-opt.c')
-rw-r--r-- | epan/ex-opt.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/epan/ex-opt.c b/epan/ex-opt.c index 9922078432..ec9dd9dc41 100644 --- a/epan/ex-opt.c +++ b/epan/ex-opt.c @@ -1,6 +1,6 @@ /* * ex-opt.c - * + * * Extension command line options * * (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org> @@ -23,7 +23,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" @@ -35,15 +35,15 @@ static GHashTable* ex_opts = NULL; gboolean ex_opt_add(const gchar* optarg) { gchar** splitted; - - if (!ex_opts) + + if (!ex_opts) ex_opts = g_hash_table_new(g_str_hash,g_str_equal); - + splitted = g_strsplit(optarg,":",2); - + if (splitted[0] && splitted[1]) { GPtrArray* this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,splitted[0]); - + if (this_opts) { g_ptr_array_add(this_opts,splitted[1]); g_free(splitted[0]); @@ -52,9 +52,9 @@ gboolean ex_opt_add(const gchar* optarg) { g_ptr_array_add(this_opts,splitted[1]); g_hash_table_insert(ex_opts,splitted[0],this_opts); } - + g_free(splitted); - + return TRUE; } else { g_strfreev(splitted); @@ -64,12 +64,12 @@ gboolean ex_opt_add(const gchar* optarg) { gint ex_opt_count(const gchar* key) { GPtrArray* this_opts; - + if (! ex_opts) return 0; - + this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,key); - + if (this_opts) { return this_opts->len; } else { @@ -79,12 +79,12 @@ gint ex_opt_count(const gchar* key) { const gchar* ex_opt_get_nth(const gchar* key, guint index) { GPtrArray* this_opts; - + if (! ex_opts) return 0; - + this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,key); - + if (this_opts) { if (this_opts->len > index) { return (const gchar *)g_ptr_array_index(this_opts,index); @@ -95,21 +95,21 @@ const gchar* ex_opt_get_nth(const gchar* key, guint index) { } else { return NULL; } - + } extern const gchar* ex_opt_get_next(const gchar* key) { GPtrArray* this_opts; - + if (! ex_opts) return 0; - + this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,key); - + if (this_opts) { if (this_opts->len) return (const gchar *)g_ptr_array_remove_index(this_opts,0); - else + else return NULL; } else { return NULL; |