comment
[vg.git] / vg_platform.h
index cb861941142f0d56e790042722419ebc19e5c6cd..2ebc506ea032249a1985507afe4cbd19ba029b0c 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,
@@ -85,6 +89,7 @@ struct vg_str{
 VG_STATIC void vg_strnull( vg_str *str, char *buffer, u32 len )
 {
    str->buffer = buffer;
+   str->buffer[0] = '\0';
    str->i = 0;
    str->len = len;
 }
@@ -128,6 +133,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