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

Function count_ident

convert.c:1080–1120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1078}
1079
1080static int count_ident(const char *cp, unsigned long size)
1081{
1082 /*
1083 * "$Id: 0000000000000000000000000000000000000000 $" <=> "$Id$"
1084 */
1085 int cnt = 0;
1086 char ch;
1087
1088 while (size) {
1089 ch = *cp++;
1090 size--;
1091 if (ch != '$')
1092 continue;
1093 if (size < 3)
1094 break;
1095 if (memcmp("Id", cp, 2))
1096 continue;
1097 ch = cp[2];
1098 cp += 3;
1099 size -= 3;
1100 if (ch == '$')
1101 cnt++; /* $Id$ */
1102 if (ch != ':')
1103 continue;
1104
1105 /*
1106 * "$Id: ... "; scan up to the closing dollar sign and discard.
1107 */
1108 while (size) {
1109 ch = *cp++;
1110 size--;
1111 if (ch == '$') {
1112 cnt++;
1113 break;
1114 }
1115 if (ch == '\n')
1116 break;
1117 }
1118 }
1119 return cnt;
1120}
1121
1122static int ident_to_git(const char *src, size_t len,
1123 struct strbuf *buf, int ident)

Callers 2

ident_to_gitFunction · 0.85
ident_to_worktreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected