Removing the NT_STATUS_HAVE_NO_MEMORY_AND_FREE macro
kamenim at samba.org
Sun Feb 16 16:58:31 MST 2014
Frankly said, I see no real value in removing those macros.
I *do* agree that changing code flow in a macros is generally
bad practice and makes code hard to follow. In this case though
it is not like there are many many such macros defined. I think
we have under 10 of those kind I think :)
Garmin, as far as understood you have used a script to make
most of NT_STATUS_HAVE_NO_MEMORY_AND_FREE.
If could have it done by hand though, I am sure that you you'd
have noticed how bothersome is that for future coder :)
And I also think, that this not only makes the code little uglier.
It also makes it harder to follow - now one need to look after
at least two kind of "if" - 1) for memory checks; 2) for function
With best regards,
On Sun, Feb 16, 2014 at 10:08 PM, Garming Sam <garming at catalyst.net.nz>wrote:
> On 13/02/14 18:27, Garming Sam wrote:
>> Included are some patches to remove the NT_STATUS_HAVE_NO_MEMORY_AND_FREE
>> I'm told that the we shouldn't be using such macros anymore and so I
>> thought I might try and get rid of them. When I was going through the code
>> earlier, I came across this one which is especially terrible since it
>> doesn't have any mention of even a return.
>> There's a few others that we should get rid of. I do note that
>> NT_STATUS_HAVE_NO_MEMORY has something like 1000 instances. I could
>> obviously remove them, but they're going to have to be checked and it's
>> probably going to be a nuisance to someone.
>> The first patch I just ran the code through a script. There were only a
>> few left, so in the second patch I fixed the remaining ones manually.
>> Garming Sam
> Here's a few more removed. You'll notice that these ones were hardly used
> at all in the code.
> Anyways, thanks Jeremy.
> Garming Sam
More information about the samba-technical