Simple hash trie storage (~memcpy)

#ifndef __STASH_H_
#define __STASH_H_
 
#define MAX_HASH_SPAN 96
#define MIN_HASH_SPAN 32
 
#ifndef byte
typedef unsigned char byte;
#endif
 
typedef struct stash_t stash_t;
 
struct stash_t {
	stash_t *next[MAX_HASH_SPAN];
	byte *data;
	int size;
}; 
 
extern stash_t* new_stash();
extern void destroy_stash(stash_t* node);
extern byte* stash_prep(stash_t* node, const char *path, int size);
extern byte* stash_peek(stash_t* node, const char *path);
extern stash_t* stash_put(stash_t* node, const char *path, byte* var, int size);
extern stash_t* stash_get(stash_t* node, const char *path, byte* var);
extern stash_t* stash_unset(stash_t* node, const char *path);
 
 
/* Helpers */
extern int* stash_int(int Num);
#define H_INT(A) ((byte*)stash_int((A)))
#define H_INV(A) ((byte*)& (A))
#define H_PTR(A) ((byte*) (A))
#define H_REV(A, T) *((T*)A)
 
/* Wrappers */
#define H_PUT(NODE, PATH, NAME)  stash_put(NODE, PATH, H_INV(NAME), sizeof(NAME))
#define H_PUTI(NODE, PATH, NAME) stash_put(NODE, PATH, H_INT(NAME), sizeof(int))
#define H_PEEK(NODE, PATH, TYPE) H_REV(stash_peek(NODE, PATH), TYPE)
#define H_GET(NODE, PATH, NAME)  stash_get(NODE, PATH, H_INV(NAME))
 
#endif
#include "stash.h"
#include "malloc.h"
 
stash_t* new_stash() {
	int i;
	stash_t* node = NULL;
	if ((node = malloc(sizeof(stash_t))))
	{
		node->data = NULL;
		node->size = 0;
		for (i = 0; i < MAX_HASH_SPAN; i++) node->next[i] = NULL;
	}
	return node;
}
 
void destroy_stash(stash_t* node) {
	int i;
	for (i = 0; i < MAX_HASH_SPAN; i++) 
		if (node->next[i]) 
			destroy_stash(node->next[i]);
	if (node->size) free(node->data);
	free(node);
}
 
byte* stash_ralloc(stash_t* node, int size) {
	if (node->size != size)	{
		if (node->size) free(node->data);
		if (size && !(node->data = malloc(size))) size = 0;
		node->size = size;		
	}
	return node->data; 
}
stash_t* stash_path(stash_t *node, const char* path, int pave) {
	if (path[0] && node) {
		byte id = path[0] - MIN_HASH_SPAN;
		if (id > MAX_HASH_SPAN - 1) id = MAX_HASH_SPAN - 1;
		if (!node->next[id] && pave) node->next[id] = new_stash();
		return stash_path(node->next[id], &path[1], pave);
	}
	return node;
}
void stash_ncpy(byte *dst, byte *src, int size) { 
	if (dst) while(size--) dst[size] = src[size]; }
 
byte* stash_prep(stash_t* node, const char *path, int size) {
	return ((node = stash_path(node, path, 1)) ? 
		stash_ralloc(node, size) : NULL);
}
 
byte* stash_peek(stash_t* node, const