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

Function strip_string_delimiters

internal/cbm/service_patterns.c:861–885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

859}
860
861static const char *strip_string_delimiters(const char *literal, char *buf, size_t buf_sz) {
862 if (!literal || !literal[0]) {
863 return NULL;
864 }
865 const char *start = literal;
866 while (*start == ' ' || *start == '\t' || *start == '\n' || *start == '\r') {
867 start++;
868 }
869 size_t len = strlen(start);
870 while (len > 0 && (start[len - 1] == ' ' || start[len - 1] == '\t' || start[len - 1] == '\n' ||
871 start[len - 1] == '\r')) {
872 len--;
873 }
874 if (len >= 2 && (start[0] == '"' || start[0] == '\'' || start[0] == '`') &&
875 start[len - 1] == start[0]) {
876 start++;
877 len -= 2;
878 }
879 if (len == 0 || len >= buf_sz) {
880 return NULL;
881 }
882 memcpy(buf, start, len);
883 buf[len] = '\0';
884 return buf;
885}
886
887/* A comment opens with the slash a route opens with, and an argument list
888 * that starts with one handed three Java block comments to the Route pass as

Calls

no outgoing calls

Tested by

no test coverage detected