/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdlib.h>

#include "foobar.h"

struct FOOBAR
{
    int v;
};

void foobar_init(FOOBAR_CTX *ctx)
{
    *ctx = malloc(sizeof(struct FOOBAR)); 
}

void foobar_set_v(FOOBAR_CTX ctx, int v)
{
    ((struct FOOBAR*)ctx)->v = v;
}

int foobar_get_v(FOOBAR_CTX ctx)
{
    return ((struct FOOBAR*)ctx)->v;
}

void foobar_destroy(FOOBAR_CTX ctx)
{
    free(ctx);
}
