MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxBundleNextMarker

Function fxBundleNextMarker

xs/tools/xstBundle.c:98–112  ·  view source on GitHub ↗

Find the next start-of-line marker at or after `from`. `bufStart` is the origin of the buffer, used to check "start of line" at position `from`.

Source from the content-addressed store, hash-verified

96// Find the next start-of-line marker at or after `from`. `bufStart` is the
97// origin of the buffer, used to check "start of line" at position `from`.
98static char *fxBundleNextMarker(char *from, char *end, char *bufStart)
99{
100 while (from < end) {
101 int atLineStart = (from == bufStart) || (from > bufStart && from[-1] == '\n');
102 if (atLineStart &&
103 (end - from) >= kBundleMarkerPrefixLen &&
104 0 == memcmp(from, kBundleMarkerPrefix, kBundleMarkerPrefixLen))
105 return from;
106 char *nl = memchr(from, '\n', end - from);
107 if (!nl)
108 return end;
109 from = nl + 1;
110 }
111 return end;
112}
113
114// Called from xst.c's fxLoadModule. Returns 1 if the module ID was found in
115// the bundle map (and resolved), 0 to fall through to filesystem loading.

Callers 1

fxBundleRunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected