diff mbox

[ovs-dev,v2,07/15] object-collection: Remove access to stub.

Message ID 1471908701-102773-8-git-send-email-jarno@ovn.org
State Changes Requested
Headers show

Commit Message

Jarno Rajahalme Aug. 22, 2016, 11:31 p.m. UTC
Better not use access to the *_collection_stub(), as it is an internal
implementation detail.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
---
 lib/object-collection.h |  5 -----
 ofproto/ofproto.c       | 10 +++++-----
 2 files changed, 5 insertions(+), 10 deletions(-)

Comments

Ben Pfaff Aug. 29, 2016, 9:57 p.m. UTC | #1
On Mon, Aug 22, 2016 at 04:31:33PM -0700, Jarno Rajahalme wrote:
> Better not use access to the *_collection_stub(), as it is an internal
> implementation detail.
> 
> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>

Acked-by: Ben Pfaff <blp@ovn.org>
Jarno Rajahalme Aug. 30, 2016, 5:53 p.m. UTC | #2
Thanks for the review, pushed to master,

  Jarno

> On Aug 29, 2016, at 2:57 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> On Mon, Aug 22, 2016 at 04:31:33PM -0700, Jarno Rajahalme wrote:
>> Better not use access to the *_collection_stub(), as it is an internal
>> implementation detail.
>> 
>> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
> 
> Acked-by: Ben Pfaff <blp@ovn.org>
diff mbox

Patch

diff --git a/lib/object-collection.h b/lib/object-collection.h
index a0ad0f2..4903451 100644
--- a/lib/object-collection.h
+++ b/lib/object-collection.h
@@ -78,11 +78,6 @@  static inline TYPE* NAME##_collection_##NAME##s(const struct NAME##_collection *
     return (TYPE*)coll->collection.objs;                                \
 }                                                                       \
                                                                         \
-static inline TYPE* NAME##_collection_stub(struct NAME##_collection *coll) \
-{                                                                       \
-    return (TYPE*)coll->collection.stub;                                \
-}                                                                       \
-                                                                        \
 static inline size_t NAME##_collection_n(const struct NAME##_collection *coll) \
 {                                                                       \
     return coll->collection.n;                                          \
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 97ed61a..2971814 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4692,7 +4692,7 @@  add_flow_start(struct ofproto *ofproto, struct ofproto_flow_mod *ofm)
         rule_collection_add(&ofm->old_rules, old_rule);
     }
     /* Take ownership of the temp_rule. */
-    rule_collection_stub(&ofm->new_rules)[0] = new_rule;
+    rule_collection_add(&ofm->new_rules, new_rule);
     ofm->temp_rule = NULL;
 
     replace_rule_start(ofproto, ofm, old_rule, new_rule);
@@ -4705,8 +4705,8 @@  add_flow_revert(struct ofproto *ofproto, struct ofproto_flow_mod *ofm)
     OVS_REQUIRES(ofproto_mutex)
 {
     struct rule *old_rule = rule_collection_n(&ofm->old_rules)
-        ? rule_collection_stub(&ofm->old_rules)[0] : NULL;
-    struct rule *new_rule = rule_collection_stub(&ofm->new_rules)[0];
+        ? rule_collection_rules(&ofm->old_rules)[0] : NULL;
+    struct rule *new_rule = rule_collection_rules(&ofm->new_rules)[0];
 
     replace_rule_revert(ofproto, old_rule, new_rule);
 }
@@ -4718,8 +4718,8 @@  add_flow_finish(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
     OVS_REQUIRES(ofproto_mutex)
 {
     struct rule *old_rule = rule_collection_n(&ofm->old_rules)
-        ? rule_collection_stub(&ofm->old_rules)[0] : NULL;
-    struct rule *new_rule = rule_collection_stub(&ofm->new_rules)[0];
+        ? rule_collection_rules(&ofm->old_rules)[0] : NULL;
+    struct rule *new_rule = rule_collection_rules(&ofm->new_rules)[0];
     struct ovs_list dead_cookies = OVS_LIST_INITIALIZER(&dead_cookies);
 
     replace_rule_finish(ofproto, ofm, req, old_rule, new_rule, &dead_cookies);