#ifndef VG_LOG_H
#define VG_LOG_H
+#include <stdio.h>
+#include "vg_stdint.h"
+
#define VG_LOG_MCSTR(S) VG_LOG_MCSTR2(S)
#define VG_LOG_MCSTR2(S) #S
-#define VG_LOG_WHERE "@"__FILE__":"VG_LOG_MCSTR(__LINE__)\
+#define VG_LOG_WHERE "@" __FILE__ ":" VG_LOG_MCSTR(__LINE__)\
" "
#define vg_success( ... ) \
}
static void *vg_pool_item( vg_pool *pool, u16 id ){
- if( !id ) return NULL;
- else return pool->buffer + pool->stride*(size_t)(id-1);
+ if( (id == 0) || (id > pool->count) )
+ return NULL;
+
+ return pool->buffer + pool->stride*(size_t)(id-1);
}
static void vg_pool_init( vg_pool *pool ){
typedef struct vg_queue vg_queue;
typedef struct vg_queue_frame vg_queue_frame;
+struct vg_queue_frame {
+ u32 alloc_size,size;
+ u8 data[];
+};
+
struct vg_queue {
u8 *buffer;
u32 size;
- struct vg_queue_frame {
- u32 alloc_size,size;
- u8 data[];
- }
- *head, *tail;
+ vg_queue_frame *head, *tail;
};
/*
}
if( msg->depth != msg->rframe_depth+1 ) continue;
if( cmd.code == k_vg_msg_frame ){
- if( VG_STRDJB2_EQ( name, cmd.key, cmd.key_djb2 ) ){
+ if( !name || VG_STRDJB2_EQ( name, cmd.key, cmd.key_djb2 ) ){
msg->rframe_cur = msg->cur;
msg->rframe_depth = msg->depth;
return 1;