plugins.c: cleanup plugins_scan_dir()

add_plugin() no longer returns ENOMEM. Remove code in
 plugins_scan_dir() which printed an error message
 if ENOMEM returned by add_plugin().

 Fix comment re add_plugin() return values.

Change-Id: Id5170c28e2a55884d41ceebc4e07f16389b75a2a
Reviewed-on: https://code.wireshark.org/review/3774
Reviewed-by: Bill Meier <wmeier@newsguy.com>
This commit is contained in:
Bill Meier 2014-08-20 20:11:49 -04:00
parent f580ebe3a9
commit 0c38cf3c7b
1 changed files with 6 additions and 10 deletions

View File

@ -106,7 +106,6 @@ add_plugin_type(const char *type, plugin_callback callback)
* add a new plugin to the list
* returns :
* - 0 : OK
* - ENOMEM : memory allocation problem
* - EEXIST : the same plugin (i.e. name/version) was already registered.
*/
static int
@ -230,16 +229,13 @@ plugins_scan_dir(const char *dirname)
/*
* OK, attempt to add it to the list of plugins.
*/
if ((cr = add_plugin(new_plug)))
cr = add_plugin(new_plug);
if (cr != 0)
{
if (cr == EEXIST)
fprintf(stderr, "The plugin %s, version %s\n"
"was found in multiple directories\n",
new_plug->name, new_plug->version);
else
fprintf(stderr, "Memory allocation problem\n"
"when processing plugin %s, version %s\n",
new_plug->name, new_plug->version);
g_assert(cr == EEXIST);
fprintf(stderr, "The plugin %s, version %s\n"
"was found in multiple directories\n",
new_plug->name, new_plug->version);
g_module_close(handle);
g_free(new_plug->name);
g_free(new_plug);