[ovs-dev] [PATCH] vconn: Avoid using C++ keyword 'class' as variable name in headers

Thomas Graf tgraf at noironetworks.com
Mon Jan 12 16:51:23 UTC 2015


From: Amit Bose <bose at noironetworks.com>

Signed-off-by: Amit Bose <bose at noironetworks.com>
Signed-off-by: Thomas Graf <tgraf at noironetworks.com>
---
 include/openvswitch/vconn.h |  4 ++--
 lib/vconn-provider.h        | 10 +++++-----
 lib/vconn.c                 | 34 +++++++++++++++++-----------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/include/openvswitch/vconn.h b/include/openvswitch/vconn.h
index b7dd2df..99933b8 100644
--- a/include/openvswitch/vconn.h
+++ b/include/openvswitch/vconn.h
@@ -32,7 +32,7 @@ struct pvconn_class;
 
 /* This structure should be treated as opaque by vconn implementations. */
 struct vconn {
-    const struct vconn_class *class;
+    const struct vconn_class *vclass;
     int state;
     int error;
 
@@ -94,7 +94,7 @@ void vconn_send_wait(struct vconn *);
  *
  * This structure should be treated as opaque by vconn implementations. */
 struct pvconn {
-    const struct pvconn_class *class;
+    const struct pvconn_class *pvclass;
     char *name;
     uint32_t allowed_versions;
 };
diff --git a/lib/vconn-provider.h b/lib/vconn-provider.h
index 7a41ee6..48ca660 100644
--- a/lib/vconn-provider.h
+++ b/lib/vconn-provider.h
@@ -30,9 +30,9 @@ void vconn_init(struct vconn *, const struct vconn_class *, int connect_status,
                 const char *name, uint32_t allowed_versions);
 void vconn_free_data(struct vconn *vconn);
 static inline void vconn_assert_class(const struct vconn *vconn,
-                                      const struct vconn_class *class)
+                                      const struct vconn_class *vclass)
 {
-    ovs_assert(vconn->class == class);
+    ovs_assert(vconn->vclass == vclass);
 }
 
 struct vconn_class {
@@ -115,12 +115,12 @@ struct vconn_class {
 
 /* Passive virtual connection to an OpenFlow device. */
 
-void pvconn_init(struct pvconn *pvconn, const struct pvconn_class *class,
+void pvconn_init(struct pvconn *pvconn, const struct pvconn_class *pvclass,
                  const char *name, uint32_t allowed_versions);
 static inline void pvconn_assert_class(const struct pvconn *pvconn,
-                                       const struct pvconn_class *class)
+                                       const struct pvconn_class *pvclass)
 {
-    ovs_assert(pvconn->class == class);
+    ovs_assert(pvconn->pvclass == pvclass);
 }
 
 struct pvconn_class {
diff --git a/lib/vconn.c b/lib/vconn.c
index 2ffbd8d..10e2dec 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -252,7 +252,7 @@ vconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp,
     }
 
     /* Success. */
-    ovs_assert(vconn->state != VCS_CONNECTING || vconn->class->connect);
+    ovs_assert(vconn->state != VCS_CONNECTING || vconn->vclass->connect);
     *vconnp = vconn;
     return 0;
 
@@ -272,8 +272,8 @@ vconn_run(struct vconn *vconn)
         vconn_connect(vconn);
     }
 
-    if (vconn->class->run) {
-        (vconn->class->run)(vconn);
+    if (vconn->vclass->run) {
+        (vconn->vclass->run)(vconn);
     }
 }
 
@@ -288,8 +288,8 @@ vconn_run_wait(struct vconn *vconn)
         vconn_connect_wait(vconn);
     }
 
-    if (vconn->class->run_wait) {
-        (vconn->class->run_wait)(vconn);
+    if (vconn->vclass->run_wait) {
+        (vconn->vclass->run_wait)(vconn);
     }
 }
 
@@ -331,7 +331,7 @@ vconn_close(struct vconn *vconn)
 {
     if (vconn != NULL) {
         char *name = vconn->name;
-        (vconn->class->close)(vconn);
+        (vconn->vclass->close)(vconn);
         free(name);
     }
 }
@@ -394,7 +394,7 @@ vconn_set_recv_any_version(struct vconn *vconn)
 static void
 vcs_connecting(struct vconn *vconn)
 {
-    int retval = (vconn->class->connect)(vconn);
+    int retval = (vconn->vclass->connect)(vconn);
     ovs_assert(retval != EINPROGRESS);
     if (!retval) {
         vconn->state = VCS_SEND_HELLO;
@@ -637,7 +637,7 @@ vconn_recv(struct vconn *vconn, struct ofpbuf **msgp)
 static int
 do_recv(struct vconn *vconn, struct ofpbuf **msgp)
 {
-    int retval = (vconn->class->recv)(vconn, msgp);
+    int retval = (vconn->vclass->recv)(vconn, msgp);
     if (!retval) {
         COVERAGE_INC(vconn_received);
         if (VLOG_IS_DBG_ENABLED()) {
@@ -679,10 +679,10 @@ do_send(struct vconn *vconn, struct ofpbuf *msg)
     ofpmsg_update_length(msg);
     if (!VLOG_IS_DBG_ENABLED()) {
         COVERAGE_INC(vconn_sent);
-        retval = (vconn->class->send)(vconn, msg);
+        retval = (vconn->vclass->send)(vconn, msg);
     } else {
         char *s = ofp_to_string(ofpbuf_data(msg), ofpbuf_size(msg), 1);
-        retval = (vconn->class->send)(vconn, msg);
+        retval = (vconn->vclass->send)(vconn, msg);
         if (retval != EAGAIN) {
             VLOG_DBG_RL(&ofmsg_rl, "%s: sent (%s): %s",
                         vconn->name, ovs_strerror(retval), s);
@@ -925,7 +925,7 @@ vconn_wait(struct vconn *vconn, enum vconn_wait_type wait)
         poll_immediate_wake();
         return;
     }
-    (vconn->class->wait)(vconn, wait);
+    (vconn->vclass->wait)(vconn, wait);
 }
 
 void
@@ -1047,7 +1047,7 @@ pvconn_close(struct pvconn *pvconn)
 {
     if (pvconn != NULL) {
         char *name = pvconn->name;
-        (pvconn->class->close)(pvconn);
+        (pvconn->pvclass->close)(pvconn);
         free(name);
     }
 }
@@ -1065,12 +1065,12 @@ pvconn_close(struct pvconn *pvconn)
 int
 pvconn_accept(struct pvconn *pvconn, struct vconn **new_vconn)
 {
-    int retval = (pvconn->class->accept)(pvconn, new_vconn);
+    int retval = (pvconn->pvclass->accept)(pvconn, new_vconn);
     if (retval) {
         *new_vconn = NULL;
     } else {
         ovs_assert((*new_vconn)->state != VCS_CONNECTING
-                   || (*new_vconn)->class->connect);
+                   || (*new_vconn)->vclass->connect);
     }
     return retval;
 }
@@ -1078,7 +1078,7 @@ pvconn_accept(struct pvconn *pvconn, struct vconn **new_vconn)
 void
 pvconn_wait(struct pvconn *pvconn)
 {
-    (pvconn->class->wait)(pvconn);
+    (pvconn->pvclass->wait)(pvconn);
 }
 
 /* Initializes 'vconn' as a new vconn named 'name', implemented via 'class'.
@@ -1103,7 +1103,7 @@ vconn_init(struct vconn *vconn, const struct vconn_class *class,
            int connect_status, const char *name, uint32_t allowed_versions)
 {
     memset(vconn, 0, sizeof *vconn);
-    vconn->class = class;
+    vconn->vclass = class;
     vconn->state = (connect_status == EAGAIN ? VCS_CONNECTING
                     : !connect_status ? VCS_SEND_HELLO
                     : VCS_DISCONNECTED);
@@ -1117,7 +1117,7 @@ void
 pvconn_init(struct pvconn *pvconn, const struct pvconn_class *class,
             const char *name, uint32_t allowed_versions)
 {
-    pvconn->class = class;
+    pvconn->pvclass = class;
     pvconn->name = xstrdup(name);
     pvconn->allowed_versions = allowed_versions;
 }
-- 
1.9.3




More information about the dev mailing list