README.md

local.h #

A small header-only C library that wraps __attribute__((cleanup(...))) to provide a nice interface for automatic destructors.

Usage #

#include <local.h>

int main(void) {
  local int *data = malloc(sizeof(int) * 64);
  ...
}

To specify the cleanup function:

  local_(free) int *data = malloc(sizeof(int) * 64);