On Tue, Mar 29, 2016 at 05:03:23PM +0200, Vincent Bernat wrote: > OK, so, I'll propose a patch for this, including the sizeof() change (or > another patch for the sizeof() change?). For the record, I don't do this > manually, I use a semantic patch like this: > > @@ > type T; > @@ > > - (T\( \|\)*) > (\(lua_touserdata\|malloc\|calloc\)(...)) > > So, I can rebase the patch as long as it's needed.
Perfect. Then I'll try to flush the large queue ASAP so that we can apply such changes. If you're this fluent with coccinelle, I think we can do a lot of nice cleanups including changing all "!strcmp()" and "!memcmp()" to "*cmp() == 0". I'm also interested in getting rid of returns from many function that are supposed to deal with errors and which allocate stuff somewhere in the middle of the body. We've had several leaks due to this because people don't realise that depending where they place the return we free or don't free. A goto to the end is much safer in this case. > >> 3. correct TLV handling in connection.c > > > > I just checked and the TLV is 32-bit aligned so I guess we don't need > > any change there. > > OK, smart design. ;-) Well to be honnest I didn't invent it myself, people have proven long before me that this design could be successful by adopting it for some old protocols like a certain IP protocol first documented in RFC760 :-) Willy

