Thomas Gummerer <[email protected]> writes:

>> I see that you added the `const` keyword. While it does not hurt, I would
>> probably not have bothered...
>
> That's fair, I went with what seemed most common in the codebase.
> More than half the parameters seem to be using "const struct
> pathspec", so that seems to be the more common way if we don't require
> the parameter to be modifyable.

Yes, when you prepare a struct at a callsite and pass it thru a long
callchain, it is very helpful to both humans and compilers reading
the code to declare that the structure would not be modified, if the
code indeed keeps it constant.  A caller that used to passed the
structure by value certainly hasn't been expecting the callee would
modify its contents and it needs to read back the updated value, so
I find that most of these constifing, if not all, very much in line
with the original's spirit.

Reply via email to