summaryrefslogtreecommitdiff
path: root/common/comapi.c
diff options
context:
space:
mode:
authorTomek Mrugalski <tomek@isc.org>2012-03-09 11:18:14 +0000
committerTomek Mrugalski <tomek@isc.org>2012-03-09 11:18:14 +0000
commitdd9237c309ac816268ec395f0d65a18a38a9aa2a (patch)
treef79ad87307715109fdf0886a70b2c4c5c50a7983 /common/comapi.c
parent9a266235e6813d2565dc48949b222ba8e08078cb (diff)
downloadisc-dhcp-dd9237c309ac816268ec395f0d65a18a38a9aa2a.tar.gz
Fixed many compilation problems ("set, but not used" warnings) for
gcc 4.6 that may affect Ubuntu 11.10 users. [ISC-Bugs #27588]
Diffstat (limited to 'common/comapi.c')
-rw-r--r--common/comapi.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/common/comapi.c b/common/comapi.c
index c24b4a6a..90d2262c 100644
--- a/common/comapi.c
+++ b/common/comapi.c
@@ -3,6 +3,7 @@
OMAPI object interfaces for the DHCP server. */
/*
+ * Copyright (c) 2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
@@ -435,7 +436,7 @@ isc_result_t dhcp_group_remove (omapi_object_t *lp,
status = dhcp_group_destroy ((omapi_object_t *)group, MDL);
- return ISC_R_SUCCESS;
+ return status;
}
isc_result_t dhcp_control_set_value (omapi_object_t *h,
@@ -511,12 +512,12 @@ isc_result_t dhcp_control_destroy (omapi_object_t *h,
isc_result_t dhcp_control_signal_handler (omapi_object_t *h,
const char *name, va_list ap)
{
- dhcp_control_object_t *control;
+ /* In this function h should be a (dhcp_control_object_t *) */
+
isc_result_t status;
if (h -> type != dhcp_type_control)
return DHCP_R_INVALIDARG;
- control = (dhcp_control_object_t *)h;
/* Try to find some inner object that can take the value. */
if (h -> inner && h -> inner -> type -> get_value) {
@@ -572,11 +573,11 @@ isc_result_t dhcp_control_lookup (omapi_object_t **lp,
status = omapi_get_value_str (ref, id, "handle", &tv);
if (status == ISC_R_SUCCESS) {
status = omapi_handle_td_lookup (lp, tv -> value);
-
+
omapi_value_dereference (&tv, MDL);
if (status != ISC_R_SUCCESS)
return status;
-
+
/* Don't return the object if the type is wrong. */
if ((*lp) -> type != dhcp_type_control) {
omapi_object_dereference (lp, MDL);
@@ -612,12 +613,12 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h,
omapi_data_string_t *name,
omapi_typed_data_t *value)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* No values to set yet. */
@@ -628,7 +629,7 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h,
if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
return status;
}
-
+
return ISC_R_NOTFOUND;
}
@@ -637,12 +638,12 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id,
omapi_data_string_t *name,
omapi_value_t **value)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* No values to get yet. */
@@ -658,14 +659,17 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id,
isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line)
{
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct subnet *subnet;
+#endif
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ subnet = (struct subnet *)h;
if (subnet -> next_subnet)
subnet_dereference (&subnet -> next_subnet, file, line);
if (subnet -> next_sibling)
@@ -685,13 +689,13 @@ isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line)
isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h,
const char *name, va_list ap)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
int updatep = 0;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* Can't write subnets yet. */
@@ -711,12 +715,12 @@ isc_result_t dhcp_subnet_stuff_values (omapi_object_t *c,
omapi_object_t *id,
omapi_object_t *h)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* Can't stuff subnet values yet. */
@@ -761,12 +765,12 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_t *h,
omapi_data_string_t *name,
omapi_typed_data_t *value)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* No values to set yet. */
@@ -777,7 +781,7 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_t *h,
if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
return status;
}
-
+
return ISC_R_NOTFOUND;
}
@@ -787,12 +791,12 @@ isc_result_t dhcp_shared_network_get_value (omapi_object_t *h,
omapi_data_string_t *name,
omapi_value_t **value)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* No values to get yet. */
@@ -809,14 +813,19 @@ isc_result_t dhcp_shared_network_get_value (omapi_object_t *h,
isc_result_t dhcp_shared_network_destroy (omapi_object_t *h,
const char *file, int line)
{
+ /* In this function h should be a (struct shared_network *) */
+
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct shared_network *shared_network;
+#endif
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ shared_network = (struct shared_network *)h;
if (shared_network -> next)
shared_network_dereference (&shared_network -> next,
file, line);
@@ -849,13 +858,13 @@ isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *h,
const char *name,
va_list ap)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
int updatep = 0;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* Can't write shared_networks yet. */
@@ -875,12 +884,12 @@ isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *c,
omapi_object_t *id,
omapi_object_t *h)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* Can't stuff shared_network values yet. */