Wireshark-dev: Re: [Wireshark-dev] Question regarding emem -> wmem conversion
From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Thu, 12 Sep 2013 23:46:04 +0200
Hello Kauschik,

On Fri, Sep 13, 2013 at 02:53:50AM +0530, kaushik varanasi wrote:
> Can any of you brief me about what should be done. I would like to get
> involved and learn.

Here is what I do (now) - I'm on Linux:
- cd epan/dissectors/
- Pick a letter from the alphabet.
- grep emem.h packet-<letter>*.c
- ../../tools/checkAPI.pl -g emem packet-<letter>*.c
- Fix inconsistencies (remove includes for emem.h from files that don't
  use ep_ or se_ functions, add the include where it is missing
- Go through all files that only contain "simple to convert" functions
  + Replace the include statement and se_ and ep_ functions the way Evan
    described, then compile and install libwireshark (I do:
    "make -C epan install)
  + run "tshark -v" to find obvious breakages. If it breaks, "svn revert"
    the file
  + Next file
- Commit my changes

Maybe you can do this and once you have successfully converted the fist
file open a bug and attach your patch to it. Depending on the feedback
go over the patch again or (once sufficiently confident) finish all
dissectors for that letter and attach the patch to the previous bug again.

 Ciao
       Jörg

> > 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.
> >
> > 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.

-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.