From 1069fb127a38d875d0ca2f56bfc936a97a964380 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Fri, 14 Aug 2009 23:04:37 -0400 Subject: COMMON Fixes to return values, errno, leaks Started looking at the ticket #107 related to traverse functions. Realized that the return values are not consistent. That ovelapped with the work that I wanted to do for ticket #103 - errno cleanup. So I (across collection, INI and ELAPI): * Made the return codes consistent (where found) * Removed errno where it is not needed While was testing used valgrind and found a nasty problem when the value was added to collection with overwriting duplicates the count was decreased improperly. Fixing collection.c to not decrease count made valgrind happy. While I was debugging this I also spotted several build warnings in trace statements when the " exp ? v1 : v2 " was used. Fixed those. In ini_config.c there was a trace stament that used variable after it was freed. Removed trace stament. --- common/elapi/elapi_internal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/elapi/elapi_internal.c') diff --git a/common/elapi/elapi_internal.c b/common/elapi/elapi_internal.c index c5ec12474..cfc2bbeee 100644 --- a/common/elapi/elapi_internal.c +++ b/common/elapi/elapi_internal.c @@ -197,7 +197,7 @@ int elapi_internal_add_sink(struct collection_item **sink_ref, if (provider_cfg_item == NULL) { /* There is no provider - return error */ TRACE_ERROR_STRING("Required key is missing in the configuration.", "Fatal Error!"); - return ENOKEY; + return ENOENT; } @@ -275,7 +275,7 @@ int elapi_internal_create_target(struct elapi_target_context **context, if (sink_cfg_item == NULL) { /* There is no list of targets this is bad configuration - return error */ TRACE_ERROR_STRING("Required key is missing in the configuration.", "Fatal Error!"); - return ENOKEY; + return ENOENT; } /* Allocate context */ @@ -457,7 +457,7 @@ int elapi_internal_construct_target_list(struct elapi_dispatcher *handle) /* Check if we have any targets available */ if (handle->target_counter == 0) { TRACE_ERROR_STRING("No targets", ""); - return ENOKEY; + return ENOENT; } TRACE_FLOW_STRING("elapi_internal_construct_target_list", "Returning success"); -- cgit