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

Function tparam_find

src/pipeline/doc_links_cs.c:885–904  ·  view source on GitHub ↗

Position of the type parameter `name` of `owner` in `f`, or CS_NONE. */

Source from the content-addressed store, hash-verified

883
884/* Position of the type parameter `name` of `owner` in `f`, or CS_NONE. */
885static int tparam_find(const cs_file_t *f, int owner, const char *name, size_t len) {
886 int lo = 0;
887 int hi = f->ntparams;
888 while (lo < hi) {
889 int mid = lo + ((hi - lo) / PAIR_LEN);
890 const cs_tparam_t *t = &f->tparams[mid];
891 int c = t->owner != owner ? (t->owner < owner ? -1 : 1) : strncmp(t->name, name, len);
892 if (c == 0 && t->name[len] != '\0') {
893 c = 1;
894 }
895 if (c < 0) {
896 lo = mid + SKIP_ONE;
897 } else if (c > 0) {
898 hi = mid;
899 } else {
900 return t->pos;
901 }
902 }
903 return CS_NONE;
904}
905
906static int span_cmp(const void *a, const void *b) {
907 const cs_span_lines_t *x = (const cs_span_lines_t *)a;

Callers 2

same_type_variableFunction · 0.85
lookupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected