summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-04-17 00:11:12 +0100
committerChris Hall <GMCH@hestia.halldom.com>2010-04-17 00:11:12 +0100
commit81e20ffd434953e62f60f1144ab76bebe82d59b6 (patch)
tree2cc05ed4fc1a9949524a9ecd69289875ce0bc493
parent075b751cfe1ae87c416eceb68e01b5f8b9a9e92b (diff)
downloadquagga-81e20ffd434953e62f60f1144ab76bebe82d59b6.tar.bz2
quagga-81e20ffd434953e62f60f1144ab76bebe82d59b6.tar.xz
Further warnings removed for gcc 4.2.1.
-rw-r--r--lib/list_util.c31
-rw-r--r--lib/list_util.h9
-rw-r--r--lib/vty_cli.c5
3 files changed, 34 insertions, 11 deletions
diff --git a/lib/list_util.c b/lib/list_util.c
index 0d61a67a..720b8ca7 100644
--- a/lib/list_util.c
+++ b/lib/list_util.c
@@ -31,24 +31,45 @@
*
* Have to chase down list to find item.
*
+ * Note that p_this:
+ *
+ * * starts as pointer to the base pointer, so should really be void**,
+ * but that causes all sorts of problems with strict-aliasing.
+ *
+ * So: have to cast to (void**) before dereferencing to get the address
+ * of the first item on the list.
+ *
+ * * as steps along the list p_this points to the "next pointer" in the
+ * previous item.
+ *
+ * The _sl_p_next() macro adds the offset of the "next pointer" to the
+ * address of the this item.
+ *
+ * * at the end, assigns the item's "next pointer" to the "next pointer"
+ * field pointed at by p_this.
+ *
+ * Note again the cast to (void**).
+ *
* Returns: 0 => OK -- removed item from list (OR item == NULL)
* -1 => item not found on list
*/
extern int
-ssl_del_func(void** p_this, void* item, size_t link_offset)
+ssl_del_func(void* p_this, void* item, size_t link_offset)
{
+ void* this ;
+
if (item == NULL)
return 0 ;
- while (*p_this != item)
+ while ((this = *(void**)p_this) != item)
{
- if (*p_this == NULL)
+ if (this == NULL)
return -1 ;
- p_this = _sl_p_next(*p_this, link_offset) ;
+ p_this = _sl_p_next(this, link_offset) ;
} ;
- *p_this = _sl_next(item, link_offset) ;
+ *(void**)p_this = _sl_next(item, link_offset) ;
return 0 ;
} ;
diff --git a/lib/list_util.h b/lib/list_util.h
index e5a8b4c0..876b7b11 100644
--- a/lib/list_util.h
+++ b/lib/list_util.h
@@ -242,10 +242,11 @@ struct dl_void_base_pair base_pair(void*) ;
(base) = item ; \
} while (0)
-extern int ssl_del_func(void** p_this, void* obj, size_t link_offset) ;
+extern int ssl_del_func(void* p_this, void* obj, size_t link_offset)
+ __attribute__((noinline)) ;
#define ssl_del(base, item, next) \
- ssl_del_func((void**)&(base), item, _lu_off(item, next))
+ ssl_del_func((void*)(&base), item, _lu_off(item, next))
#define ssl_del_head(base, next) \
do { if ((base) != NULL) \
@@ -265,10 +266,10 @@ extern int ssl_del_func(void** p_this, void* obj, size_t link_offset) ;
*/
#define _sl_p_next(item, off) \
- ( (void**)( (char*)(item) + (off) ) )
+ ( (char*)(item) + (off) )
#define _sl_next(item, off) \
- *_sl_p_next(item, off)
+ *(void**)_sl_p_next(item, off)
/*==============================================================================
* Single Base, Double Link
diff --git a/lib/vty_cli.c b/lib/vty_cli.c
index ff86b558..461d511e 100644
--- a/lib/vty_cli.c
+++ b/lib/vty_cli.c
@@ -538,6 +538,7 @@ uty_cli_dispatch(vty_io vio)
switch (cli_do)
{
case cli_do_nothing:
+ ret = CMD_SUCCESS ;
break ;
case cli_do_command:
@@ -572,12 +573,12 @@ uty_cli_dispatch(vty_io vio)
if (ret == CMD_QUEUED)
{
uty_cli_draw(vio) ; /* draw the prompt */
- return 0 ; /* command not complete */
+ return false ; /* command not complete */
}
else
{
uty_cli_cmd_complete(vio, ret) ;
- return 1 ; /* command complete */
+ return true ; /* command complete */
} ;
} ;