MCPcopy Create free account
hub / github.com/antirez/ds4 / agent_session_list_push

Function agent_session_list_push

ds4_agent.c:4996–5007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4994 agent_history_mark mark) {
4995 if (p->len == p->cap) {
4996 p->cap = p->cap ? p->cap * 2 : 16;
4997 p->v = xrealloc(p->v, (size_t)p->cap * sizeof(p->v[0]));
4998 p->mark = xrealloc(p->mark, (size_t)p->cap * sizeof(p->mark[0]));
4999 }
5000 p->v[p->len] = s;
5001 p->mark[p->len] = mark;
5002 p->len++;
5003}
5004
5005static const char *agent_memmem(const char *hay, size_t hay_len,
5006 const char *needle, size_t needle_len) {
5007 if (!needle_len) return hay;
5008 if (needle_len > hay_len) return NULL;
5009 const char first = needle[0];
5010 const char *end = hay + hay_len - needle_len + 1;

Callers 1

Calls 1

xreallocFunction · 0.70

Tested by

no test coverage detected