Re: [PATCH v6 04/19] fsck: Offer a function to demote fsck errors to warnings
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 21, 2015, 18:23 UTC
- Message-ID
- <8545f1b636f157b280f15c615c1e1756@www.dscho.org>
- In-Reply-To
- <xmqqegl5j75m.fsf@gitster.dls.corp.google.com>
Hi Junio,
On 2015-06-21 19:36, Junio C Hamano wrote:
Show 30 quoted lines
> Johannes Schindelin <johannes.schindelin@gmx.de> writes: > >> Hmm. I really do not like that kind of thinking, i.e. having to >> duplicate, then modify data to be able to call the API, only to have >> to modify the data back afterwards, and eventually having to >> unallocate the data in all code paths. That feels just very inelegant >> to me. > > You can see in our codebase that I have avoided touching end-user > strings by using a substring in place by introducing a new API > function or using an existing API function that takes <ptr, len> for > exactly that reason. There also are cases where we are better off > if we make a copy upfront at a very high level in the callchain if > that makes the processing of that string deeper in the callchain > much simpler without customized helpers that take counted strings. > > And 03/19 and this one taken together, I think it is an example of > the latter [*1*]. > > You not only need to invent counted string comparison in 04/19 but > also need upcasing byte-by-byte comparison in a loop in 03/19; both > of which can be made much simpler if you massaged the end-user input > "foo=error,bar=ignore" into "FOO=error,BAR=ignore" and allowed the > code to loop over it to turn ',' into NUL while parsing each > individual piece (i.e. "FOO=error"). > > So contrary to what you said in response to my review on 03/19, I > view this as not "adding complexity" but its total opposite. It is > to make the code and logic much less complex by paying the price for > one copied (and massaged) string.
How about I implement your suggestion tomorrow, then show the diff between the two versions and we can assess what looks to be simpler (i.e. more maintainable)?
BTW I agree about the skip-list feature being the most important outcome of this patch series; It only occurred to me as a useful feature at the very end of my work on the fsck IDs, but then I did not want to throw away all of that previous work ;-)
Ciao, Dscho