Removes the record of `block`. Returns false when the layer never saw it. */
| 1101 | |
| 1102 | /* Removes the record of `block`. Returns false when the layer never saw it. */ |
| 1103 | static bool take_entry(uintptr_t block, ptr_entry_t *out) { |
| 1104 | shard_t *sh = shard_of(block); |
| 1105 | lock_take(&sh->lock); |
| 1106 | ptr_entry_t *e = shard_find(sh, block); |
| 1107 | bool found = e != NULL; |
| 1108 | if (found) { |
| 1109 | *out = *e; |
| 1110 | e->block = MEMEV_TOMBSTONE; |
| 1111 | sh->live--; |
| 1112 | } |
| 1113 | lock_drop(&sh->lock); |
| 1114 | return found; |
| 1115 | } |
| 1116 | |
| 1117 | void cbm_memev_free(void *block) { |
| 1118 | if (!block || !cbm_memev_enabled()) { |
no test coverage detected