MCPcopy Create free account
hub / github.com/ElementsProject/lightning / fail_mismatch

Function fail_mismatch

tools/check-bolt.c:205–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205static void fail_mismatch(const char *filename,
206 const char *raw, const char *pos,
207 size_t len, struct bolt_file *bolt)
208{
209 unsigned line = linenum(raw, &pos);
210 char *try;
211
212 fprintf(stderr, "%s:%u:mismatch:%.*s\n",
213 filename, line, (int)strcspn(pos, "\n"), pos);
214 /* Try to find longest match, as a hint. */
215 try = code_to_regex(pos + strcspn(pos, "\n"), len, false);
216 while (strlen(try)) {
217 const char *p = strstr(bolt->contents, try);
218 if (p) {
219 fprintf(stderr, "Closest match: %s...[%.20s]\n",
220 try, p + strlen(try));
221 break;
222 }
223 try[strlen(try)-1] = '\0';
224 }
225 exit(1);
226}
227
228static void fail_nobolt(const char *filename,
229 const char *raw, const char *pos,

Callers 1

mainFunction · 0.85

Calls 2

linenumFunction · 0.85
code_to_regexFunction · 0.85

Tested by

no test coverage detected