minor compiler changes
authorhgn <hgodden00@gmail.com>
Sat, 28 Oct 2023 15:20:18 +0000 (16:20 +0100)
committerhgn <hgodden00@gmail.com>
Sat, 28 Oct 2023 15:20:18 +0000 (16:20 +0100)
vg_log.h
vg_mem_pool.h
vg_mem_queue.h
vg_msg.h

index 8d2420a5fa7125d38ef05343d7422ea7f024c2e0..9c8d59f373a4c4084406de3e835acac3cd4922b5 100644 (file)
--- a/vg_log.h
+++ b/vg_log.h
@@ -1,9 +1,12 @@
 #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( ... ) \
index f3de2f37cba16e1c4ea8b851e3baf71c519ac6ab..412d2c0a3b11be67d43c5e75f97a80d80bc3fb52 100644 (file)
@@ -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 ){
index 8cd054bd926f3f341cf1dc5bb0219f1c1545897a..1b556ae9affdfe5c5a1d7919a7579bfbc07894c7 100644 (file)
@@ -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;
 };
 
 /*
index ce012a6fc7bc6e0883b4df78b66a07992c613b45..791308e40d55010f43057c077163c83b9718234b 100644 (file)
--- 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;