[squid-dev] [RFC] nullptr conversion (again)

Alex Rousskov rousskov at measurement-factory.com
Thu Apr 13 19:48:02 UTC 2017


On 04/12/2017 11:39 AM, Amos Jeffries wrote:
> On 13/04/2017 4:10 a.m., Alex Rousskov wrote:
>> On 04/12/2017 09:53 AM, Amos Jeffries wrote:
>> Other sources of pain will include "v5 to v4" and "v5 to any v5-based
>> branch" porting AFAICT.

> Any collisions there will be the lines I bring up in audit as needing
> changes to remove the NULL anyway.

I am pretty sure there are examples where the above assertion does not
hold, but this is not an important part (at least for now). The
currently important part is below.


>> Is it really difficult to write a script that will rename most NULLs
>> that are safe to rename without breaking anything? Perhaps I am
>> forgetting some context here, but what is the primary reason why making
>> such a script is so difficult?

> a) branches can use "bzr merge --take-this -cNN ..."

The "bzr merge" or similar techniques are not the answer I am looking
for: They will often result in either too many NULLs remaining in the
code or too many conflicts to resolve manually (depending on the merge
options). And perhaps more importantly, using bzr merge is impractical
without a nearby common ancestor _and_ the desire to merge with the
official code. Either or both preconditions often do not hold for the
real-world branches we have to deal with.

What is wrong with a sed/NULL/nullptr/ script? In other words, can you
make a simple script that replaces [nearly] all NULLs in [nearly] all
Squid source files with nullptrs? There may be some exceptional NULLs
that should not be replaced (I do not know/remember), but cannot the
script work around those exceptions?


> The 'too complex' part is where major refactoring is needed with change
> spread over multiple files. Such as the C++11 initialization sequence
> cleanups. It is a bit mind-numbingly for me/us manually but a script to
> do that right every time would be effectively AI.

I just cannot think of anything requiring AI! That is why I keep asking
this "why not a simple conversion script for everybody to apply to their
code?" question... Please give a few specific examples where a simple
s/NULL/nullptr/ conversion does not work (and cannot be easily excluded
in a simple script).


Thank you,

Alex.



More information about the squid-dev mailing list