[hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 5380: Drop all casts on the result of the list_entry macro.

  • From: noreply@xxxxxxxxxxxxx
  • To: HIPL core team <hipl-dev@xxxxxxxxxxxxx>
  • Date: Tue, 04 Jan 2011 19:00:51 -0000

------------------------------------------------------------
revno: 5380
committer: Diego Biurrun <diego@xxxxxxxxxx>
branch nick: hipl
timestamp: Tue 2011-01-04 19:32:00 +0100
message:
  Drop all casts on the result of the list_entry macro.
  
  Without the casts, no warnings are generated and the md5sums of the compiled
  .o files do not change, so it should be safe to remove them.
modified:
  firewall/user_ipsec_sadb.c
  hipd/cookie.c
  hipd/hadb.c
  hipd/hadb_legacy.c
  hipd/hidb.c
  hipd/init.c
  hipd/netdev.c
  hipd/oppdb.c
  hipd/oppipdb.c
  hipd/output.c
  lib/core/debug.c
  modules/update/hipd/update.c
  modules/update/hipd/update_legacy.c


--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk

Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to 
https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'firewall/user_ipsec_sadb.c'
--- firewall/user_ipsec_sadb.c  2011-01-04 14:49:14 +0000
+++ firewall/user_ipsec_sadb.c  2011-01-04 18:32:00 +0000
@@ -845,7 +845,7 @@
     // iterating over all elements
     list_for_each_safe(item, tmp, sadb, i)
     {
-        HIP_IFEL(!(entry = (struct hip_sa_entry *) list_entry(item)), -1,
+        HIP_IFEL(!(entry = list_entry(item)), -1,
                  "failed to get list entry\n");
         HIP_IFEL(hip_sa_entry_delete(&entry->inner_src_addr, 
&entry->inner_dst_addr), -1,
                  "failed to delete sa entry\n");

=== modified file 'hipd/cookie.c'
--- hipd/cookie.c       2011-01-03 19:36:44 +0000
+++ hipd/cookie.c       2011-01-04 18:32:00 +0000
@@ -421,7 +421,7 @@
 
     list_for_each_safe(curr, iter, ht, c)
     {
-        tmp = (struct hip_host_id *) list_entry(curr);
+        tmp = list_entry(curr);
         hip_ht_add(HIP_DB_LOCAL_HID, tmp);
         list_del(tmp, ht);
     }

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2011-01-04 17:37:40 +0000
+++ hipd/hadb.c 2011-01-04 18:32:00 +0000
@@ -304,7 +304,7 @@
     /* and then with rest (actually default HIT is here redundantly) */
     list_for_each_safe(item, tmp, hip_local_hostid_db, i)
     {
-        e     = (struct hip_host_id_entry *) list_entry(item);
+        e = list_entry(item);
         ipv6_addr_copy(&our_hit, &e->lhi.hit);
         entry = hip_hadb_find_byhits(hit, &our_hit);
         if (!entry) {
@@ -884,7 +884,7 @@
 
     if (ha->peer_addr_list_to_be_added) {
         list_for_each_safe(item, tmp, ha->peer_addr_list_to_be_added, i) {
-            addr_li = (struct hip_peer_addr_list_item *) list_entry(item);
+            addr_li = list_entry(item);
             list_del(addr_li, ha->peer_addr_list_to_be_added);
             free(addr_li);
             HIP_DEBUG_HIT("SPI out address", &addr_li->address);
@@ -894,7 +894,7 @@
 
     if (ha->peer_addresses_old) {
         list_for_each_safe(item, tmp, ha->peer_addresses_old, i) {
-            addr_li = (struct hip_peer_addr_list_item *) list_entry(item);
+            addr_li = list_entry(item);
             list_del(addr_li, ha->peer_addresses_old);
             free(addr_li);
             HIP_DEBUG_HIT("SPI out address", &addr_li->address);
@@ -1219,7 +1219,7 @@
     HIP_LOCK_HT(&hadb_hit);
     list_for_each_safe(item, tmp, hadb_hit, i)
     {
-        this = (struct hip_hadb_state *) list_entry(item);
+        this = list_entry(item);
         /* @todo: lock ha when we have threads */
         fail = func(this, opaque);
         /* @todo: unlock ha when we have threads */
@@ -1346,7 +1346,7 @@
     HIP_LOCK_HT(&hadb_hit);
     list_for_each_safe(item, tmp, hadb_hit, i)
     {
-        this = (struct hip_hadb_state *) list_entry(item);
+        this = list_entry(item);
         /* @todo: lock ha when we have threads */
         if ((ipv6_addr_cmp(local_hit, &this->hit_our) == 0) &&
             (ipv6_addr_cmp(rvs_ip, &this->peer_addr) == 0)) {
@@ -1463,7 +1463,7 @@
 
     list_for_each_safe(item, aux, hadb_hit, i)
     {
-        tmp = (struct hip_hadb_state *) list_entry(item);
+        tmp = list_entry(item);
         if (!hip_lsi_are_equal(&tmp->lsi_peer, lsi_dst)) {
             continue;
         } else if (hip_lsi_are_equal(&tmp->lsi_our, lsi_src)) {
@@ -1489,7 +1489,7 @@
 
     list_for_each_safe(item, aux, hadb_hit, i)
     {
-        tmp = (struct hip_hadb_state *) list_entry(item);
+        tmp = list_entry(item);
         if (hip_lsi_are_equal(&tmp->lsi_peer, lsi_dst)) {
             return tmp;
         }

=== modified file 'hipd/hadb_legacy.c'
--- hipd/hadb_legacy.c  2011-01-03 19:36:44 +0000
+++ hipd/hadb_legacy.c  2011-01-04 18:32:00 +0000
@@ -71,7 +71,7 @@
 
     list_for_each_safe(item, tmp, entry->peer_addresses_old, ii)
     {
-        peer_addr_list_item = (struct hip_peer_addr_list_item *) 
list_entry(item);
+        peer_addr_list_item = list_entry(item);
 
         if (!ipv6_addr_cmp(&peer_addr_list_item->address, addr)) {
             if (lifetime) {
@@ -109,7 +109,7 @@
 
     list_for_each_safe(item, tmp, ha->peer_addresses_old, i)
     {
-        peer_addr_list_item = (struct hip_peer_addr_list_item *) 
list_entry(item);
+        peer_addr_list_item = list_entry(item);
         if (!ipv6_addr_cmp(&peer_addr_list_item->address, addr)) {
             list_del(item, ha->peer_addresses_old);
             free(item);

=== modified file 'hipd/hidb.c'
--- hipd/hidb.c 2010-12-30 15:10:34 +0000
+++ hipd/hidb.c 2011-01-04 18:32:00 +0000
@@ -281,7 +281,7 @@
     list_for_each_safe(curr, iter, db, count) {
         struct hip_lhi lhi;
 
-        tmp = (struct hip_host_id_entry *) list_entry(curr);
+        tmp = list_entry(curr);
 
         memcpy(&lhi, &tmp->lhi, sizeof(lhi));
         err = hip_del_host_id(db, &lhi);
@@ -314,7 +314,7 @@
     hip_list_t *item;
     int c;
     list_for_each(item, db, c) {
-        id_entry = (struct hip_host_id_entry *) list_entry(item);
+        id_entry = list_entry(item);
 
         if ((hit == NULL || !ipv6_addr_cmp(&id_entry->lhi.hit, hit)) &&
             (algo == HIP_ANY_ALGO ||
@@ -354,7 +354,7 @@
     int c, err = 1;
 
     list_for_each(item, hip_local_hostid_db, c) {
-        id_entry = (struct hip_host_id_entry *) list_entry(item);
+        id_entry = list_entry(item);
         if (memcmp(&id_entry->lhi.hit, our, sizeof(*our)) == 0) {
             memcpy(our_lsi, &id_entry->lsi, sizeof(hip_lsi_t));
             return 0;
@@ -383,7 +383,7 @@
         used_lsi = 0;
 
         list_for_each(item, db, c) {
-            id_entry_aux = (struct hip_host_id_entry *) list_entry(item);
+            id_entry_aux = list_entry(item);
             if (hip_lsi_are_equal(&lsi_aux, &id_entry_aux->lsi)) {
                 used_lsi = 1;
                 c        = -1;
@@ -675,7 +675,7 @@
     int c, res = 0;
 
     list_for_each(item, hip_local_hostid_db, c) {
-        id_entry = (struct hip_host_id_entry *) list_entry(item);
+        id_entry = list_entry(item);
         if (hip_lsi_are_equal(&id_entry->lsi, lsi)) {
             return 1;
         }
@@ -702,7 +702,7 @@
 
     list_for_each_safe(curr, iter, hip_local_hostid_db, c)
     {
-        tmp = (struct hip_host_id_entry *) list_entry(curr);
+        tmp = list_entry(curr);
         HIP_DEBUG_HIT("Found HIT", &tmp->lhi.hit);
         HIP_DEBUG_LSI("Found LSI", &tmp->lsi);
         err = func(tmp, opaque);
@@ -732,7 +732,7 @@
     int c;
 
     list_for_each(item, db, c) {
-        id_entry = (struct hip_host_id_entry *) list_entry(item);
+        id_entry = list_entry(item);
         if (!ipv4_addr_cmp(&id_entry->lsi, lsi)) {
             return id_entry;
         }

=== modified file 'hipd/init.c'
--- hipd/init.c 2010-12-13 18:21:47 +0000
+++ hipd/init.c 2011-01-04 18:32:00 +0000
@@ -538,7 +538,7 @@
     HIP_READ_LOCK_DB(hip_local_hostid_db);
 
     list_for_each_safe(curr, iter, hip_local_hostid_db, c) {
-        tmp  = (struct hip_host_id_entry *) list_entry(curr);
+        tmp  = list_entry(curr);
         HIP_DEBUG_HIT("Found HIT", &tmp->lhi.hit);
         algo = hip_get_host_id_algo(tmp->host_id);
         HIP_DEBUG("hits algo %d HIP_HI_RSA = %d\n",

=== modified file 'hipd/netdev.c'
--- hipd/netdev.c       2011-01-03 19:36:44 +0000
+++ hipd/netdev.c       2011-01-04 18:32:00 +0000
@@ -221,7 +221,7 @@
     int i = 0, c;
 
     list_for_each_safe(n, t, addresses, c) {
-        na = (struct netdev_address *) list_entry(n);
+        na = list_entry(n);
         if (na->if_index == ifindex) {
             i++;
         }
@@ -336,7 +336,7 @@
     int mapped = IN6_IS_ADDR_V4MAPPED(addr);
 
     list_for_each_safe(tmp, t, addresses, c) {
-        n = (struct netdev_address *) list_entry(tmp);
+        n = list_entry(tmp);
 
         if (IN6_IS_ADDR_V4MAPPED((const struct in6_addr *) 
hip_cast_sa_addr((struct sockaddr *) &n->addr)) == mapped) {
             return 1;
@@ -367,7 +367,7 @@
         int mapped       = 0;
         int addr_match   = 0;
         int family_match = 0;
-        n      = (struct netdev_address *) list_entry(tmp);
+        n      = list_entry(tmp);
 
         mapped = hip_sockaddr_is_v6_mapped((struct sockaddr * ) (&n->addr));
         HIP_DEBUG("mapped=%d\n", mapped);
@@ -505,7 +505,7 @@
     HIP_DEBUG_HIT("Address to delete = ", hip_cast_sa_addr((struct sockaddr *) 
&addr_sin6));
 
     list_for_each_safe(item, tmp, addresses, i) {
-        n       = (struct netdev_address *) list_entry(item);
+        n       = list_entry(item);
         deleted = 0;
         /* remove from list if if_index matches */
         if (!addr) {
@@ -547,7 +547,7 @@
     if (address_count) {
         list_for_each_safe(item, tmp, addresses, i)
         {
-            n = (struct netdev_address *) list_entry(item);
+            n = list_entry(item);
             HIP_DEBUG_HIT("address to be deleted\n", hip_cast_sa_addr((struct 
sockaddr *) &n->addr));
             list_del(n, addresses);
             free(n);
@@ -604,7 +604,7 @@
      * socket address storages. */
     list_for_each_safe(item, tmp, addresses, i)
     {
-        n = (struct netdev_address *) list_entry(item);
+        n = list_entry(item);
         if (((n->addr.ss_family == addr->sa_family) &&
              ((memcmp(hip_cast_sa_addr((struct sockaddr *) &n->addr),
                       hip_cast_sa_addr(addr),
@@ -1456,7 +1456,7 @@
     }
 
     list_for_each_safe(item, tmp, ha->peer_addr_list_to_be_added, i) {
-        addr_li = (struct hip_peer_addr_list_item *) list_entry(item);
+        addr_li = list_entry(item);
         list_add(addr_li, ha->peer_addresses_old);
         HIP_DEBUG_HIT("SPI out address", &addr_li->address);
     }

=== modified file 'hipd/oppdb.c'
--- hipd/oppdb.c        2011-01-04 17:41:10 +0000
+++ hipd/oppdb.c        2011-01-04 18:32:00 +0000
@@ -194,7 +194,7 @@
     HIP_LOCK_HT(&opp_db);
     list_for_each_safe(item, tmp, oppdb, i)
     {
-        this = (struct hip_opp_blocking_request *) list_entry(item);
+        this = list_entry(item);
         fail = func(this, opaque);
         if (fail) {
             goto out_err;
@@ -359,7 +359,7 @@
 
     list_for_each_safe(item, tmp, oppdb, i)
     {
-        this = (struct hip_opp_blocking_request *) list_entry(item);
+        this = list_entry(item);
 
         HIP_DEBUG_HIT("this->peer_phit",
                       &this->peer_phit);
@@ -656,7 +656,7 @@
     HIP_LOCK_HT(&opp_db);
     list_for_each_safe(item, tmp, oppdb, i)
     {
-        this = (struct hip_opp_blocking_request *) list_entry(item);
+        this = list_entry(item);
         if (ipv6_addr_cmp(&this->peer_ip, ip_peer) == 0) {
             HIP_DEBUG("The ip was found in oppdb. Peer non-HIP capable.\n");
             ret = this;

=== modified file 'hipd/oppipdb.c'
--- hipd/oppipdb.c      2010-10-15 15:29:14 +0000
+++ hipd/oppipdb.c      2011-01-04 18:32:00 +0000
@@ -111,7 +111,7 @@
     HIP_LOCK_HT(&oppipdb);
     list_for_each_safe(item, tmp, oppipdb, i)
     {
-        this = (hip_oppip_t *) list_entry(item);
+        this = list_entry(item);
         func(this, opaque);
     }
 

=== modified file 'hipd/output.c'
--- hipd/output.c       2011-01-03 19:36:44 +0000
+++ hipd/output.c       2011-01-04 18:32:00 +0000
@@ -214,7 +214,7 @@
                   ((struct lhash_st *) 
entry->peer_addr_list_to_be_added)->num_items);
         list_for_each_safe(item, tmp, entry->peer_addr_list_to_be_added, i)
         {
-            addr = (struct hip_peer_addr_list_item *) list_entry(item);
+            addr = list_entry(item);
             ipv6_addr_copy(&peer_addr, &addr->address);
 
             err  = hip_send_i1_pkt(i1,
@@ -1485,7 +1485,7 @@
 
     list_for_each_safe(item, tmp, addresses, i)
     {
-        netdev_src_addr = (struct netdev_address *) list_entry(item);
+        netdev_src_addr = list_entry(item);
         src_addr = hip_cast_sa_addr((struct sockaddr *) 
&netdev_src_addr->addr);
 
         if (!are_addresses_compatible(src_addr, peer_addr)) {

=== modified file 'lib/core/debug.c'
--- lib/core/debug.c    2011-01-03 19:36:44 +0000
+++ lib/core/debug.c    2011-01-04 18:32:00 +0000
@@ -810,7 +810,7 @@
 
     list_for_each_safe(item, tmp, entry->peer_addr_list_to_be_added, i)
     {
-        addr = (struct hip_peer_addr_list_item *) list_entry(item);
+        addr = list_entry(item);
         HIP_DEBUG_HIT("Peer address", &addr->address);
     }
 }

=== modified file 'modules/update/hipd/update.c'
--- modules/update/hipd/update.c        2011-01-03 19:36:44 +0000
+++ modules/update/hipd/update.c        2011-01-04 18:32:00 +0000
@@ -391,7 +391,7 @@
     struct in6_addr *address = NULL;
 
     list_for_each_safe(item, tmp, state->addresses_to_send_echo_request, i) {
-        address = (struct in6_addr *)list_entry(item);
+        address = list_entry(item);
         list_del(address, state->addresses_to_send_echo_request);
         free(address);
     }
@@ -413,7 +413,7 @@
 
     HIP_DEBUG("Addresses to send update:\n");
     list_for_each_safe(item, tmp, localstate->addresses_to_send_echo_request, 
i) {
-        address = (struct in6_addr *)list_entry(item);
+        address = list_entry(item);
         HIP_DEBUG_IN6ADDR("", address);
     }
 }
@@ -465,7 +465,7 @@
 
     /* Last resort: use any address from the local list */
     list_for_each_safe(n, t, addresses, c) {
-        na  = (struct netdev_address *) list_entry(n);
+        na  = list_entry(n);
         in6 = hip_cast_sa_addr((struct sockaddr *) &na->addr);
         if (are_addresses_compatible(in6, dst_addr)) {
             HIP_DEBUG("Reusing a local address from the list\n");
@@ -552,7 +552,7 @@
         RAND_bytes(ha->echo_data, sizeof(ha->echo_data));
 
         list_for_each_safe(item, tmp, 
localstate->addresses_to_send_echo_request, i) {
-            dst_addr = (struct in6_addr *) list_entry(item);
+            dst_addr = list_entry(item);
 
             if (!are_addresses_compatible(src_addr, dst_addr)) {
                 continue;
@@ -600,7 +600,7 @@
 
     // Go through all the peers and send update packets
     list_for_each_safe(item, tmp, hadb_hit, i) {
-        ha = (struct hip_hadb_state *) list_entry(item);
+        ha = list_entry(item);
 
         if (ha->hastate == HIP_HASTATE_VALID &&
             ha->state == HIP_STATE_ESTABLISHED) {

=== modified file 'modules/update/hipd/update_legacy.c'
--- modules/update/hipd/update_legacy.c 2010-12-28 18:21:49 +0000
+++ modules/update/hipd/update_legacy.c 2011-01-04 18:32:00 +0000
@@ -85,7 +85,7 @@
     HIP_DEBUG("there are %d type 1 locator item\n", addr_max);
 
     list_for_each_safe(item, tmp, addresses, i) {
-        n = (struct netdev_address *) list_entry(item);
+        n = list_entry(item);
         HIP_DEBUG_IN6ADDR("Add address:",
                           hip_cast_sa_addr(((struct sockaddr *) &n->addr)));
         HIP_ASSERT(!ipv6_addr_is_hit(hip_cast_sa_addr((struct sockaddr *) 
&n->addr)));

Other related posts:

  • » [hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 5380: Drop all casts on the result of the list_entry macro. - noreply