diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-01-27 17:31:41 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-01-27 17:31:41 +0000 |
commit | 376d57fcd9b7d94296e7a234c342bc7f8bf7c6fa (patch) | |
tree | 4507314c69903e1a75de184203a60aedc86dc119 /epan/prefs.c | |
parent | b5a32fe8ef91b9516d29d7ee5c338aafedd799b7 (diff) |
Use g_error() (with a hopefully-useful error message) instead of g_assert() to report problems with preference registrations.
svn path=/trunk/; revision=35683
Diffstat (limited to 'epan/prefs.c')
-rw-r--r-- | epan/prefs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index a73fa3a3c0..c5cbc496a2 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -593,8 +593,9 @@ register_preference(module_t *module, const char *name, const char *title, * and shouldn't require quoting, shifting, etc. */ for (p = name; *p != '\0'; p++) - g_assert(isascii((guchar)*p) && - (islower((guchar)*p) || isdigit((guchar)*p) || *p == '_' || *p == '.')); + if (!(isascii((guchar)*p) && + (islower((guchar)*p) || isdigit((guchar)*p) || *p == '_' || *p == '.'))) + g_error("Preference %s.%s contains invalid characters", module->name, name); /* * Make sure there's not already a preference with that @@ -602,15 +603,17 @@ register_preference(module_t *module, const char *name, const char *title, * code, and the code has to be fixed not to register * more than one preference with the same name. */ - g_assert(prefs_find_preference(module, name) == NULL); + if (prefs_find_preference(module, name) != NULL) + g_error("Preference %s has already been registered", name); if (type != PREF_OBSOLETE) { /* * Make sure the preference name doesn't begin with the * module name, as that's redundant and Just Silly. */ - g_assert((strncmp(name, module->name, strlen(module->name)) != 0) || - (((name[strlen(module->name)]) != '.') && ((name[strlen(module->name)]) != '_'))); + if(!((strncmp(name, module->name, strlen(module->name)) != 0) || + (((name[strlen(module->name)]) != '.') && ((name[strlen(module->name)]) != '_')))) + g_error("Preference %s begins with the module name", name); } /* |