Many build fixes that turned up with GCC 4.6.
[collectd.git] / src / owniptc / libiptc.c
index 5e5fde0..7e48e18 100644 (file)
@@ -549,7 +549,7 @@ static int iptcc_chain_index_rebuild(TC_HANDLE_T h)
  */
 static int iptcc_chain_index_delete_chain(struct chain_head *c, TC_HANDLE_T h)
 {
-       struct list_head *index_ptr, *index_ptr2, *next;
+       struct list_head *index_ptr, *next;
        struct chain_head *c2;
        unsigned int idx, idx2;
 
@@ -569,7 +569,7 @@ static int iptcc_chain_index_delete_chain(struct chain_head *c, TC_HANDLE_T h)
                 * is located in the same index bucket.
                 */
                c2         = list_entry(next, struct chain_head, list);
-               index_ptr2 = iptcc_bsearch_chain_index(c2->name, &idx2, h);
+               iptcc_bsearch_chain_index(c2->name, &idx2, h);
                if (idx != idx2) {
                        /* Rebuild needed */
                        return iptcc_chain_index_rebuild(h);
@@ -744,14 +744,16 @@ static void iptcc_delete_rule(struct rule_head *r)
  * to be called from specific places within the parser */
 static int __iptcc_p_del_policy(TC_HANDLE_T h, unsigned int num)
 {
+       const unsigned char *data;
+
        if (h->chain_iterator_cur) {
                /* policy rule is last rule */
                struct rule_head *pr = (struct rule_head *)
                        h->chain_iterator_cur->rules.prev;
 
                /* save verdict */
-               h->chain_iterator_cur->verdict = 
-                       *(int *)GET_TARGET(pr->entry)->data;
+               data = GET_TARGET(pr->entry)->data;
+               h->chain_iterator_cur->verdict = *(const int *)data;
 
                /* save counter and counter_map information */
                h->chain_iterator_cur->counter_map.maptype = 
@@ -1190,10 +1192,8 @@ static int iptcc_compile_table(TC_HANDLE_T h, STRUCT_REPLACE *repl)
 static TC_HANDLE_T
 alloc_handle(const char *tablename, unsigned int size, unsigned int num_rules)
 {
-       size_t len;
        TC_HANDLE_T h;
 
-       len = sizeof(STRUCT_TC_HANDLE) + size;
 
        h = malloc(sizeof(STRUCT_TC_HANDLE));
        if (!h) {
@@ -1563,6 +1563,7 @@ const char *TC_GET_TARGET(const STRUCT_ENTRY *ce,
 {
        STRUCT_ENTRY *e = (STRUCT_ENTRY *)ce;
        struct rule_head *r = container_of(e, struct rule_head, entry[0]);
+       const unsigned char *data;
 
        iptc_fn = TC_GET_TARGET;
 
@@ -1576,7 +1577,8 @@ const char *TC_GET_TARGET(const STRUCT_ENTRY *ce,
                        return r->jump->name;
                        break;
                case IPTCC_R_STANDARD:
-                       spos = *(int *)GET_TARGET(e)->data;
+                       data = GET_TARGET(e)->data;
+                       spos = *(const int *)data;
                        DEBUGP("r=%p, spos=%d'\n", r, spos);
                        return standard_target_map(spos);
                        break;