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

Function cbm_memmem

internal/cbm/helpers.c:40–55  ·  view source on GitHub ↗

Hand-rolled memmem: does not rely on the system memmem (GNU/BSD-only; msys2-clang on Windows lacks it), so it compiles identically everywhere.

Source from the content-addressed store, hash-verified

38// Hand-rolled memmem: does not rely on the system memmem (GNU/BSD-only;
39// msys2-clang on Windows lacks it), so it compiles identically everywhere.
40void *cbm_memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len) {
41 if (needle_len == 0) {
42 return (void *)haystack;
43 }
44 if (needle_len > haystack_len) {
45 return NULL;
46 }
47 const char *h = (const char *)haystack;
48 size_t last = haystack_len - needle_len;
49 for (size_t i = 0; i <= last; i++) {
50 if (memcmp(h + i, needle, needle_len) == 0) {
51 return (void *)(h + i);
52 }
53 }
54 return NULL;
55}
56
57// --- Node text extraction ---
58

Callers 11

adr_split_linesFunction · 0.85
kt_delegate_access_modeFunction · 0.85
kt_apply_smart_castFunction · 0.85
runFunction · 0.85
cbm_pdf_extractFunction · 0.85
parse_indirect_atFunction · 0.85
build_hdrsFunction · 0.85
find_xref_atFunction · 0.85
reconstructFunction · 0.85
pdf_doc_openFunction · 0.85
f_a85Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected