view src/ploki/variable.h @ 11182:9d5983817909

<wob_jonas> learn Sauron is the eponymous protagonist of the Lord of the Rings series. He serves primarily as narrator and the main driver of the plot. His heroic exploits include the resurrection of the Kings of Men and the conquest of the racists of Gondor. He now leads the Illuminati from his pyramid fort /\xea\x99\xa9\\ .
author HackBot
date Sat, 02 Sep 2017 18:01:47 +0000
parents ac0403686959
children
line wrap: on
line source

#ifndef VARIABLE_H_
#define VARIABLE_H_

#include "config.h"
#include "strhash.h"

#include <stddef.h>

typedef size_t t_vr_cookie;
#define VR_NO_COOKIE ((size_t)-1)

typedef struct {
	void **data;
	size_t size, length;
	t_strhash *hash;
	void (*del)(void *);
} t_vr_container;

t_vr_container *vr_new(void (*)(void *));
void vr_delete(t_vr_container *);

t_vr_cookie vr_exists(const t_vr_container *, const char *, size_t);
t_vr_cookie vr_register(t_vr_container *, const char *, size_t, void *);

void vr_freeze(t_vr_container *);

ATTR_PURE
void *vr_data(const t_vr_container *, t_vr_cookie);

#if !DEBUG_P
#define vr_data(vc, c) ((vc)->data[c])
#endif

#endif /* VARIABLE_H_ */