Revision f9db0c055c2f93021ee32a069e15b9e54f39f0da authored by Junio C Hamano on 27 October 2016, 21:58:48 UTC, committed by Junio C Hamano on 27 October 2016, 21:58:48 UTC
"git push" and "git fetch" reports from what old object to what new
object each ref was updated, using abbreviated refnames, and they
attempt to align the columns for this and other pieces of
information.  The way these codepaths compute how many display
columns to allocate for the object names portion of this output has
been updated to match the recent "auto scale the default
abbreviation length" change.

* jc/abbrev-auto:
  transport: compute summary-width dynamically
  transport: allow summary-width to be computed dynamically
  fetch: pass summary_width down the callchain
  transport: pass summary_width down the callchain
2 parent s d7ae013 + db98d9b
Raw File
mru.h
#ifndef MRU_H
#define MRU_H

/**
 * A simple most-recently-used cache, backed by a doubly-linked list.
 *
 * Usage is roughly:
 *
 *   // Create a list.  Zero-initialization is required.
 *   static struct mru cache;
 *   mru_append(&cache, item);
 *   ...
 *
 *   // Iterate in MRU order.
 *   struct mru_entry *p;
 *   for (p = cache.head; p; p = p->next) {
 *	if (matches(p->item))
 *		break;
 *   }
 *
 *   // Mark an item as used, moving it to the front of the list.
 *   mru_mark(&cache, p);
 *
 *   // Reset the list to empty, cleaning up all resources.
 *   mru_clear(&cache);
 *
 * Note that you SHOULD NOT call mru_mark() and then continue traversing the
 * list; it reorders the marked item to the front of the list, and therefore
 * you will begin traversing the whole list again.
 */

struct mru_entry {
	void *item;
	struct mru_entry *prev, *next;
};

struct mru {
	struct mru_entry *head, *tail;
};

void mru_append(struct mru *mru, void *item);
void mru_mark(struct mru *mru, struct mru_entry *entry);
void mru_clear(struct mru *mru);

#endif /* MRU_H */
back to top