fix const issues in revision parser
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | revision: make handle_dotdot() interface less confusingrevision.c | +19 | 3 replies | |
| 2/4 | rev-parse: simplify dotdot parsingbuiltin/ | +7 | 0 replies | |
| 3/4 | revision: avoid writing to const string for parent marksrevision.c | +15 | 0 replies | |
| 4/4 | rev-parse: avoid writing to const string for parent marksbuiltin/ | +13 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/4] fix const issues in revision parser
Quoted 9 lines · Jeff King
IMHO the right solution here is to teach the revision-parser not to touch the incoming buffers. We do it only to tie off strings, which can mostly be replaced with
xmemdupz(). That's slightly less efficient, but I don't think it would be measurable (it's one allocation that tends to happen a handful of times per program execution, and the rest of the parsing is going to allocate things like commit structs anyway).I have some patches in that direction, but I haven't gotten around to polishing them yet.
Here it is. There were a few oddities to untangle, but I think the result makes the whole thing a bit easier to understand. I may be biased as the author, though. ;)
[1/4]: revision: make handle_dotdot() interface less confusing [2/4]: rev-parse: simplify dotdot parsing
[3/4]: revision: avoid writing to const string for parent marks [4/4]: rev-parse: avoid writing to const string for parent marks
builtin/rev-parse.c | 40 +++++++++++++-------------- revision.c | 67 +++++++++++++++++++++++---------------------- 2 files changed, 54 insertions(+), 53 deletions(-)
-Peff