This may move entry! */
| 352 | |
| 353 | /* This may move entry! */ |
| 354 | static void add_entry(struct log *log, struct log_entry **l) |
| 355 | { |
| 356 | log->lr->mem_used += mem_used(*l); |
| 357 | log->lr->num_entries++; |
| 358 | |
| 359 | if (log->lr->mem_used > log->lr->max_mem) { |
| 360 | size_t old_mem = log->lr->mem_used, deleted; |
| 361 | deleted = prune_log(log->lr); |
| 362 | /* Will have moved, but will be last entry. */ |
| 363 | *l = &log->lr->log[log->lr->num_entries-1]; |
| 364 | log_debug(log, "Log pruned %zu entries (mem %zu -> %zu)", |
| 365 | deleted, old_mem, log->lr->mem_used); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | static void destroy_node_id_cache(struct node_id_cache *nc, struct log_book *lr) |
| 370 | { |