more message changes
[vg.git] / vg_platform.h
index b04ce672b9afa8d0803dec16dffb7f5bcbc48c77..1b0317c0c30b0b43ff971fa97c01370eb89987de 100644 (file)
@@ -40,12 +40,16 @@ struct vg_achievement
 #define VG_MUST_USE_RESULT __attribute__((warn_unused_result))
 
 #include <stdio.h>
-#include <dirent.h>
 #include <string.h>
 #include <stdarg.h>
 #include <ctype.h>
 #include <math.h>
 #include <assert.h>
+#include <setjmp.h>
+#include <sys/time.h>
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
 
 enum strncpy_behaviour{
    k_strncpy_always_add_null = 0,
@@ -92,6 +96,7 @@ VG_STATIC void vg_strnull( vg_str *str, char *buffer, u32 len )
 
 VG_STATIC void vg_strcat( vg_str *str, const char *append )
 {
+   if( !append ) return;
    for( u32 i=0; str->i < str->len; i++, str->i ++ ){
       str->buffer[ str->i ] = append[i];
 
@@ -129,6 +134,19 @@ VG_STATIC u32 vg_strdjb2( const char *str )
    return hash;
 }
 
+VG_STATIC int vg_strdjb2_eq( const char *s1, u32 h1, 
+                             const char *s2, u32 h2 )
+{
+   if( h1 == h2 ){
+      if(!strcmp(s1, s2)) return 1;
+      else return 0;
+   } else return 0;
+}
+
+#define VG_STRDJB2_EQ( CS1, S2, H2 ) \
+   vg_strdjb2_eq( CS1, vg_strdjb2(CS1), S2, H2 )
+
+
 #define VG_MIN( A, B ) ((A)<(B)?(A):(B))
 #define VG_MAX( A, B ) ((A)>(B)?(A):(B))
 #endif