MCPcopy Create free account
hub / github.com/git/git / parse_range

Function parse_range

apply.c:1474–1510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1472}
1473
1474static int parse_range(const char *line, int len, int offset, const char *expect,
1475 unsigned long *p1, unsigned long *p2)
1476{
1477 int digits, ex;
1478
1479 if (offset < 0 || offset >= len)
1480 return -1;
1481 line += offset;
1482 len -= offset;
1483
1484 digits = parse_num(line, p1);
1485 if (!digits)
1486 return -1;
1487
1488 offset += digits;
1489 line += digits;
1490 len -= digits;
1491
1492 *p2 = 1;
1493 if (*line == ',') {
1494 digits = parse_num(line+1, p2);
1495 if (!digits)
1496 return -1;
1497
1498 offset += digits+1;
1499 line += digits+1;
1500 len -= digits+1;
1501 }
1502
1503 ex = strlen(expect);
1504 if (ex > len)
1505 return -1;
1506 if (memcmp(line, expect, ex))
1507 return -1;
1508
1509 return offset + ex;
1510}
1511
1512static void recount_diff(const char *line, int size, struct fragment *fragment)
1513{

Callers 1

parse_fragment_headerFunction · 0.70

Calls 1

parse_numFunction · 0.85

Tested by

no test coverage detected