//
//  hash.h
//
//  Created by Julien-Pierre Averous on 16/10/06.
//  Copyright 2006 SourceMac.com. All rights reserved.
//
//

#ifndef HASH_H_
# define HASH_H_

#include <stdlib.h>
#define HSH_SIZE 500

/*
** Frame type
*/
typedef struct			s_frame
{
	size_t				sz;
	void				*ptr;
	size_t				id;
	struct s_frame		*next;

} s_frame;


/*
** Hash table type
*/
typedef struct
{
	size_t		id;
	size_t		alloc_sz;
	size_t		free_sz;
	size_t		count;
	s_frame		*frms[HSH_SIZE];

} s_hash;


/*
** Allow direct access to hash table
*/
extern s_hash	*hash;


/*
** Hash foos
*/
void	hash_init();
void	hash_append_frame(s_frame *frm);
int		hash_remove_ptrframe(void *ptr);
s_frame	*hash_found_id(int	id);
s_frame	*hash_found_ptr(void *ptr);

#endif