libuundo - the micro-undo lib

Libuundo is a small, flexible, portable library for managing undo data. It is written in ANSI C (C89) and is less than 500 SLOC long.

Libuundo manages one (or more) undo list(s) where the caller (application) can store action items. It is possible to undo and redo actions. Atomic items can be grouped to form a single undo action.

The actual undo/redo code is implemented by the caller. Each undo item contains an user data buffer and function pointers to callbacks provided by the application:

The plugin cookie can be used in a modular application to track which application plugin donated an undo item. This information is useful when a plugin is unloaded: the application needs to invalidate (parts of) the undo list before the unload, to avoid dangling pointers left on the list.

Further details:

Note: The library is designed for single threaded applications; it's the caller responsibility to guarantee locking in a multi-thread environment.