From: hgn Date: Sat, 28 Oct 2023 15:20:18 +0000 (+0100) Subject: minor compiler changes X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=commitdiff_plain;h=f7a2bdbb964d48aaea84a6857a51060e5221e8b6 minor compiler changes --- diff --git a/vg_log.h b/vg_log.h index 8d2420a..9c8d59f 100644 --- a/vg_log.h +++ b/vg_log.h @@ -1,9 +1,12 @@ #ifndef VG_LOG_H #define VG_LOG_H +#include +#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( ... ) \ diff --git a/vg_mem_pool.h b/vg_mem_pool.h index f3de2f3..412d2c0 100644 --- a/vg_mem_pool.h +++ b/vg_mem_pool.h @@ -38,8 +38,10 @@ static vg_pool_node *vg_pool_nodeptr( vg_pool *pool, u16 id ){ } 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 ){ diff --git a/vg_mem_queue.h b/vg_mem_queue.h index 8cd054b..1b556ae 100644 --- a/vg_mem_queue.h +++ b/vg_mem_queue.h @@ -7,15 +7,16 @@ 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; }; /* diff --git a/vg_msg.h b/vg_msg.h index ce012a6..791308e 100644 --- a/vg_msg.h +++ b/vg_msg.h @@ -392,7 +392,7 @@ static int vg_msg_seekframe( vg_msg *msg, const char *name, } 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;