projects
/
vg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c7f36b2
)
string ops
author
hgn
<hgodden00@gmail.com>
Mon, 22 May 2023 05:02:36 +0000
(06:02 +0100)
committer
hgn
<hgodden00@gmail.com>
Mon, 22 May 2023 05:02:36 +0000
(06:02 +0100)
vg_platform.h
patch
|
blob
|
history
diff --git
a/vg_platform.h
b/vg_platform.h
index 98baef896a60196c0a85521e9f6ea3386120bf99..cb861941142f0d56e790042722419ebc19e5c6cd 100644
(file)
--- a/
vg_platform.h
+++ b/
vg_platform.h
@@
-39,6
+39,14
@@
struct vg_achievement
#define vg_list_size( A ) (sizeof(A)/sizeof(A[0]))
#define VG_MUST_USE_RESULT __attribute__((warn_unused_result))
#define vg_list_size( A ) (sizeof(A)/sizeof(A[0]))
#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>
+
enum strncpy_behaviour{
k_strncpy_always_add_null = 0,
k_strncpy_allow_cutoff = 1,
enum strncpy_behaviour{
k_strncpy_always_add_null = 0,
k_strncpy_allow_cutoff = 1,
@@
-96,10
+104,18
@@
VG_STATIC int vg_strgood( vg_str *str )
if( str->buffer[str->i -1] == '\0' ) return 1;
else return 0;
}
if( str->buffer[str->i -1] == '\0' ) return 1;
else return 0;
}
- else{
- str->buffer[ str->i ++ ] = '\0';
- return 1;
+ else return 1;
+}
+
+VG_STATIC char *vg_strch( vg_str *str, char c )
+{
+ char *ptr = NULL;
+ for( u32 i=0; i<str->i; i++ ){
+ if( str->buffer[i] == c )
+ ptr = str->buffer+i;
}
}
+
+ return ptr;
}
VG_STATIC u32 vg_strdjb2( const char *str )
}
VG_STATIC u32 vg_strdjb2( const char *str )
@@
-112,14
+128,6
@@
VG_STATIC u32 vg_strdjb2( const char *str )
return hash;
}
return hash;
}
-#include <stdio.h>
-#include <dirent.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <math.h>
-#include <assert.h>
-
#define VG_MIN( A, B ) ((A)<(B)?(A):(B))
#define VG_MAX( A, B ) ((A)>(B)?(A):(B))
#endif
#define VG_MIN( A, B ) ((A)<(B)?(A):(B))
#define VG_MAX( A, B ) ((A)>(B)?(A):(B))
#endif