MCPcopy Index your code
hub / github.com/git/git / parse_int

Function parse_int

cache-tree.c:552–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

550}
551
552static int parse_int(const char **ptr, unsigned long *len_p, int *out)
553{
554 const char *s = *ptr;
555 unsigned long len = *len_p;
556 int ret = 0;
557 int sign = 1;
558
559 while (len && *s == '-') {
560 sign *= -1;
561 s++;
562 len--;
563 }
564
565 while (len) {
566 if (!isdigit(*s))
567 break;
568 ret *= 10;
569 ret += *s - '0';
570 s++;
571 len--;
572 }
573
574 if (s == *ptr)
575 return -1;
576
577 *ptr = s;
578 *len_p = len;
579 *out = sign * ret;
580 return 0;
581}
582
583static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)
584{

Callers 1

read_oneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected