diff mbox

[ovs-dev] Fix extract_ofp_msgs to use HMAP_NODE_NULL_INITIALIZER instead of hard-coding {0, NULL} while creating _instances[] arrays

Message ID alpine.OSX.1.10.1510131620210.2649@sabyasg-mbp-02
State Rejected
Headers show

Commit Message

Sabyasachi Sengupta Oct. 13, 2015, 11:21 p.m. UTC
---
  build-aux/extract-ofp-msgs |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Ben Pfaff Oct. 14, 2015, 12:28 a.m. UTC | #1
This change will cause segfaults if anything ever reaches the end of a
bucket.
Sabyasachi Sengupta Oct. 14, 2015, 1:38 a.m. UTC | #2
> This change will cause segfaults if anything ever reaches the end of a
> bucket.

Oh, didn't realize that, but it seems to work fine in my setup. Just 
wondering how it works while initializing all_raw_instances. I'm curious how
would it be different for _instances.
Ben Pfaff Oct. 14, 2015, 1:52 a.m. UTC | #3
On Tue, Oct 13, 2015 at 06:38:57PM -0700, Sabyasachi Sengupta wrote:
> 
> >This change will cause segfaults if anything ever reaches the end of a
> >bucket.
> 
> Oh, didn't realize that, but it seems to work fine in my setup. Just
> wondering how it works while initializing all_raw_instances. I'm curious how
> would it be different for _instances.

I take it back.  It is harmless, but it doesn't have any benefit.
Sabyasachi Sengupta Oct. 14, 2015, 2:34 a.m. UTC | #4
I agree. Its just that this was the only place where hmap_node is 
initialized without the initializer macro..

---
Nuage Networks Business Unit, Alcatel-Lucent,
755 Ravendale Drive, Mountain View, CA, 94043
Mailstop: 1127, Ph: 1-650-623-3461

On Tue, 13 Oct 2015, Ben Pfaff wrote:

> On Tue, Oct 13, 2015 at 06:38:57PM -0700, Sabyasachi Sengupta wrote:
>>
>>> This change will cause segfaults if anything ever reaches the end of a
>>> bucket.
>>
>> Oh, didn't realize that, but it seems to work fine in my setup. Just
>> wondering how it works while initializing all_raw_instances. I'm curious how
>> would it be different for _instances.
>
> I take it back.  It is harmless, but it doesn't have any benefit.
>
diff mbox

Patch

diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs
index e4deecf..9dc9691 100755
--- a/build-aux/extract-ofp-msgs
+++ b/build-aux/extract-ofp-msgs
@@ -300,7 +300,7 @@  def extract_ofp_msgs(output_file_name):
          output.append("static struct raw_instance %s_instances[] = {"
                        % raw.lower())
          for hdrs in r['hdrs']:
-            output.append("    { {0, NULL}, {%d, %d, %d, 0x%x, %d}, %s, 0 },"
+            output.append("    { HMAP_NODE_NULL_INITIALIZER, {%d, %d, %d, 0x%x, %d}, %s, 0 },"
                            % (hdrs + (raw,)))

          output.append("};")