Re: [PATCH 19/21] grep: use writable strbuf from caller in grep_tree()
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Dec 17, 2010, 09:56 UTC
- Message-ID
- <AANLkTi=hXQqtYmhtHh+D67d9puRrDA+iScpafaYYMsAk@mail.gmail.com>
- In-Reply-To
- <7vy67pjlvb.fsf@alter.siamese.dyndns.org>
2010/12/17 Junio C Hamano <gitster@pobox.com>:
Show 16 quoted lines
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes: > >> + hit = grep_tree(opt, pathspec, &tree, &base, base.neglen); > > If you are going to let the users of strbuf API to refer directly to the > field, I think "neglen" should be renamed to something more reasonable, > say, "offset". > > I am still debating myself if this strbuf_offset is anugly hack merely to > allow the implementation of "grep" not to carry one extra offset around > throughout its callchain, or if it is generic enough that other/future > callers would benefit from. I am leaning toward to think this is an ugly > hack, as a new caller that wants to carry _two_ offsets into a strbuf > wouldn't get much benefit from this new API. But I may be missreading > your code. >
I did not want to another offset to tree_entry_interesting. But an extra argument would be less ugly than an extra API.
-- Duy