MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / tm_is_include_guard

Function tm_is_include_guard

src/mcp/test_impact.c:979–995  ·  view source on GitHub ↗

`#ifndef X` directly followed by `#define X` is an include guard. */

Source from the content-addressed store, hash-verified

977
978/* `#ifndef X` directly followed by `#define X` is an include guard. */
979static bool tm_is_include_guard(const tm_scan_t *sc, const tm_tok_t *guarded) {
980 tm_lex_t ahead = sc->lx;
981 tm_tok_t tok;
982 tm_next(&ahead, &tok);
983 if (tok.kind != TM_TOK_DIRECTIVE) {
984 return false;
985 }
986 tm_tok_t word;
987 tm_lex_t rest;
988 tm_directive_word(&tok, &word, &rest, sc->lx.incomplete);
989 if (!tm_tok_is(&word, "define")) {
990 return false;
991 }
992 tm_next(&rest, &word);
993 return word.kind == TM_TOK_IDENT && word.len == guarded->len &&
994 memcmp(word.text, guarded->text, word.len) == 0;
995}
996
997static void tm_directive(tm_scan_t *sc, const tm_tok_t *tok) {
998 tm_tok_t word;

Callers 1

tm_directiveFunction · 0.85

Calls 3

tm_nextFunction · 0.85
tm_directive_wordFunction · 0.85
tm_tok_isFunction · 0.85

Tested by

no test coverage detected