MCPcopy Create free account
hub / github.com/GJDuck/e9patch / entry

Function entry

examples/cov.c:118–141  ·  view source on GitHub ↗

* Entry point. */

Source from the content-addressed store, hash-verified

116 * Entry point.
117 */
118void entry(const void *bb, const void *next)
119{
120 uintptr_t to = (uintptr_t)next;
121 uintptr_t from = (uintptr_t)bb;
122 to = bb_lookup(to);
123 ENTRY key = {from, to, 0};
124
125 if (!LOCK())
126 return;
127
128 void *node = tfind(&key, &COV, compare);
129 ENTRY *entry = (node != NULL? *(ENTRY **)node: NULL);
130 if (entry == NULL)
131 {
132 entry = (ENTRY *)malloc(sizeof(ENTRY));
133 if (entry == NULL)
134 error("failed to allocate memory: %s", strerror(errno));
135 memcpy(entry, &key, sizeof(ENTRY));
136 (void)tsearch(entry, &COV, compare);
137 }
138 entry->count++;
139
140 UNLOCK();
141}
142
143/*
144 * Init.

Callers

nothing calls this directly

Calls 9

bb_lookupFunction · 0.85
LOCKFunction · 0.85
tfindFunction · 0.85
mallocFunction · 0.85
errorFunction · 0.85
strerrorFunction · 0.85
memcpyFunction · 0.85
tsearchFunction · 0.85
UNLOCKFunction · 0.85

Tested by

no test coverage detected