/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdlib.h>

#include "acc.h"

struct acc
{
    int v;
};

void acc_create(accptr **ctx)
{
    struct acc *p;
    p = malloc(sizeof(struct acc));
    p->v = 0;
    *ctx = (void *)p;
}

void acc_inc(accptr *ctx)
{
    struct acc *p;
    p = (struct acc *)ctx;
    p->v++;
}

int acc_get(accptr *ctx)
{
    struct acc *p;
    p = (struct acc *)ctx;
    return p->v++;
}


void acc_free(accptr *ctx)
{
    struct acc *p;
    p = (struct acc *)ctx;
    free(p);
}

