Wireshark-dev: Re: [Wireshark-dev] Question regarding emem -> wmem conversion

From: kaushik varanasi <expendablesbin@xxxxxxxxx>
Date: Fri, 13 Sep 2013 02:53:50 +0530
Dear Joerg and Evan,

Can any of you brief me about what should be done. I would like to get involved and learn.

thanks :)

sincerely,
Kaushik.


On Thu, Sep 12, 2013 at 10:08 PM, Evan Huus <eapache@xxxxxxxxx> wrote:
On Thu, Sep 12, 2013 at 11:36 AM, Joerg Mayer <jmayer@xxxxxxxxx> wrote:
>
> Evan,
>
> On Thu, Sep 12, 2013 at 11:23:33AM -0400, Evan Huus wrote:
> > The only other thing to be aware of when doing conversions is that user
> > table callbacks (UATs) sometimes use ep_ memory, but can be called from the
> > preferences page when no packet is being dissected, so if you convert these
> > to wmem they will assert. UAT memory management is also on my list to
> > figure out once the main conversions are done.
>
> Don't worry, I'll leave the non-trivial cases to you ;-)
>
> > Thanks for your help with the conversions!
>
> It's not that just because you started it you have to do all the boring work
> alone ;->
>
> grep -s emem.h epan/dissectors/* | wc -l
> 134
>
> So if we could split this between a few people at least the trivial part
> could be done quickly.

Unfortunately emem.h is included everywhere via packet.h via
packet_info.h via address.h, so there are dissectors that use it
without including it directly. check-APIs is more reliable since it
actually looks for the function calls.

>
> > P.S. I have a few vim macros that I wrote to speed up the process. I can
> > share them if anybody using vim wants to help :)
>
> Sure, go ahead please.

Put the following in your vimrc:
let @e = 'xxiwmem^[/(^Mawmem_packet_scope(), ^[/\<ep_^Mkj'
let @s = 'xxiwmem^[/(^Mawmem_file_scope(), ^[/\<se_^Mkj'

Then the 'e' macro will convert an ep_* call and jump to the next one,
the 's' macro will convert an se_* call and jump to the next one.
These only work for functions like _alloc and _strdup, for
data-structures (like ep_strbuf_append) which take the data-structure
and not the scope as the first argument you will have to convert
manually still, but there are not many of those.

On Thu, Sep 12, 2013 at 11:54 AM, Dario Lombardo
<dario.lombardo.ml@xxxxxxxxx> wrote:
>
> On Thu, Sep 12, 2013 at 5:36 PM, Joerg Mayer <jmayer@xxxxxxxxx> wrote:
>>
>> So if we could split this between a few people at least the trivial part
>> could be done quickly.
>
>
> Can you please show us what should be done? I could get a part of it if it's clear what to do.
> Dario.

The doc/README.wmem section 2.1.1 includes a brief example of how
calls can be replaced. You can also take a look at some of my (and
Joerg's) previous commits doing conversion.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe