]> git.proxmox.com Git - ovs.git/commitdiff
lldp: Declare "bool" variables as type "bool".
authorBen Pfaff <blp@nicira.com>
Mon, 23 Feb 2015 00:44:30 +0000 (16:44 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 4 Mar 2015 00:19:28 +0000 (16:19 -0800)
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/lldp/lldp.c
lib/lldp/lldpd.c

index 1ebb270826f73f2e89b9a81a07a3b0fd41d138e0..bf160a9ccfe68e04e779fd0f65ccb7fc54a10ed8 100644 (file)
@@ -331,7 +331,9 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s,
     const char avaya_oid[] = LLDP_TLV_ORG_AVAYA;
     const char dcbx[] = LLDP_TLV_ORG_DCBX;
     char orgid[3];
-    int length, gotend = 0, ttl_received = 0, af;
+    int length, af;
+    bool gotend = false;
+    bool ttl_received = false;
     int tlv_size, tlv_type, tlv_subtype;
     u_int8_t *pos, *tlv;
     char *b;
@@ -368,7 +370,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s,
         goto malformed;
     }
 
-    while (length && (!gotend)) {
+    while (length && !gotend) {
         if (length < 2) {
             VLOG_WARN("tlv header too short received on %s",
                       hardware->h_ifname);
@@ -395,7 +397,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s,
                 VLOG_DBG("extra data after lldp end on %s",
                          hardware->h_ifname);
             }
-            gotend = 1;
+            gotend = true;
             break;
 
         case LLDP_TLV_CHASSIS_ID:
@@ -423,7 +425,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s,
         case LLDP_TLV_TTL:
             CHECK_TLV_SIZE(2, "TTL");
             chassis->c_ttl = PEEK_UINT16;
-            ttl_received = 1;
+            ttl_received = true;
             break;
 
         case LLDP_TLV_PORT_DESCR:
index 0f4999f2f1c1cd757c2b723b556cf862a809da0d..9fcfee231e89526caea6b57e28c40f9d4104b9c8 100644 (file)
@@ -242,7 +242,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
     int guess = LLDPD_MODE_LLDP;
     struct eth_header eheader;
     int count = 0;
-    int found = 0;
+    bool found = false;
 
     VLOG_DBG("decode a received frame on %s size %d", hw->h_ifname,s);
 
@@ -316,7 +316,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
                 chassis->c_id_len) == 0)) {
                 ochassis = oport->p_chassis;
                 VLOG_DBG("MSAP is already known");
-                found = 1;
+                found = true;
                 break;
             }
         }
@@ -345,7 +345,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
 
     /* No, but do we already know the system? */
     if (!oport) {
-        int found = 0;
+        bool found = false;
         VLOG_DBG("MSAP is unknown, search for the chassis");
 
         LIST_FOR_EACH (ochassis, list, &cfg->g_chassis.list) {
@@ -354,7 +354,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
                     (chassis->c_id_len == ochassis->c_id_len) &&
                     (memcmp(chassis->c_id, ochassis->c_id,
                     chassis->c_id_len) == 0)) {
-                    found=1;
+                    found = true;
                     break;
                 }
         }
@@ -424,7 +424,8 @@ lldpd_hide_ports(struct lldpd *cfg,
     struct lldpd_port *port;
     int protocols[LLDPD_MODE_MAX + 1];
     char buffer[256];
-    int i, j, k, found = 0;
+    bool found = false;
+    int i, j, k;
     unsigned int min;
 
     VLOG_DBG("apply smart filter for port %s", hw->h_ifname);
@@ -453,7 +454,7 @@ lldpd_hide_ports(struct lldpd *cfg,
             /* If we need a tie breaker, we take the first protocol only */
             if (cfg->g_config.c_smart & mask &
                 (SMART_OUTGOING_ONE_PROTO | SMART_INCOMING_ONE_PROTO)) {
-                found = 1;
+                found = true;
             }
             protocols[i] = 1;
         } else {
@@ -464,32 +465,32 @@ lldpd_hide_ports(struct lldpd *cfg,
     /* We set the p_hidden flag to 1 if the protocol is disabled */
     LIST_FOR_EACH (port, p_entries, &hw->h_rports.p_entries) {
         if (mask == SMART_OUTGOING) {
-            port->p_hidden_out = protocols[port->p_protocol] ? 0 : 1;
+            port->p_hidden_out = protocols[port->p_protocol] ? false : true;
         } else {
-            port->p_hidden_in = protocols[port->p_protocol] ? 0 : 1;
+            port->p_hidden_in = protocols[port->p_protocol] ? false : true;
         }
     }
 
     /* If we want only one neighbor, we take the first one */
     if (cfg->g_config.c_smart & mask &
         (SMART_OUTGOING_ONE_NEIGH | SMART_INCOMING_ONE_NEIGH)) {
-        found = 0;
+        found = false;
 
         LIST_FOR_EACH (port, p_entries, &hw->h_rports.p_entries) {
             if (mask == SMART_OUTGOING) {
                 if (found) {
-                    port->p_hidden_out = 1;
+                    port->p_hidden_out = true;
                 }
                 if (!port->p_hidden_out) {
-                    found = 1;
+                    found = true;
                 }
             }
             if (mask == SMART_INCOMING) {
                 if (found) {
-                    port->p_hidden_in = 1;
+                    port->p_hidden_in = true;
                 }
                 if (!port->p_hidden_in) {
-                    found = 1;
+                    found = true;
                 }
             }
         }