summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-14 23:08:46 +0200
committerTyge Løvset <[email protected]>2021-09-14 23:08:46 +0200
commitd716acdc8289dd60c394c568b5ef3f88700a855c (patch)
tree217ae5f4589f352c764cd4c38743e7e5186a7220
parent8e2e792b2c3e1fa04a0ac67ea7d9010939ca8009 (diff)
downloadSTC-modified-d716acdc8289dd60c394c568b5ef3f88700a855c.tar.gz
STC-modified-d716acdc8289dd60c394c568b5ef3f88700a855c.zip
Fixed include structuring.
-rw-r--r--examples/cstr_match.c8
-rw-r--r--include/stc/cdeq.h2
-rw-r--r--include/stc/clist.h10
-rw-r--r--include/stc/cmap.h11
-rw-r--r--include/stc/cpque.h2
-rw-r--r--include/stc/csmap.h4
-rw-r--r--include/stc/cstack.h2
-rw-r--r--include/stc/cvec.h2
8 files changed, 18 insertions, 23 deletions
diff --git a/examples/cstr_match.c b/examples/cstr_match.c
index a4dbe8d8..bb3a63fe 100644
--- a/examples/cstr_match.c
+++ b/examples/cstr_match.c
@@ -6,10 +6,10 @@ int main()
c_forvar (cstr ss = cstr_lit("The quick brown fox jumps over the lazy dog.JPG"), cstr_del(&ss)) {
size_t pos = cstr_find_n(ss, "brown", 0, 5);
printf("%zu [%s]\n", pos, pos == cstr_npos ? "<NULL>" : &ss.str[pos]);
- printf("iequals: %d\n", cstr_iequalto(ss, "the quick brown fox jumps over the lazy dog.jpg"));
- printf("icontains: %d\n", cstr_icontains(ss, "uMPS Ove"));
- printf("istarts_with: %d\n", cstr_istarts_with(ss, "The Quick Brown"));
- printf("iends_with: %d\n", cstr_iends_with(ss, ".Jpg"));
+ printf("equals: %d\n", cstr_equalto(ss, "The quick brown fox jumps over the lazy dog.JPG"));
+ printf("contains: %d\n", cstr_contains(ss, "umps ove"));
+ printf("starts_with: %d\n", cstr_starts_with(ss, "The quick brown"));
+ printf("ends_with: %d\n", cstr_ends_with(ss, ".jpg"));
printf("ends_with: %d\n", cstr_ends_with(ss, ".JPG"));
}
} \ No newline at end of file
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h
index 21a6ece8..79ea7959 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -200,7 +200,6 @@ cx_memb(_sort)(Self* self) {
#if !defined(STC_HEADER) || defined(STC_IMPLEMENTATION) || defined(i_imp)
#ifndef CDEQ_H_INCLUDED
-#define CDEQ_H_INCLUDED
static struct cdeq_rep _cdeq_sentinel = {0, 0};
#define _cdeq_nfront(self) ((self)->data - (self)->_base)
#endif
@@ -365,3 +364,4 @@ cx_memb(_value_compare)(const cx_value_t* x, const cx_value_t* y) {
#endif // i_queue
#endif // IMPLEMENTATION
#include "template.h"
+#define CDEQ_H_INCLUDED \ No newline at end of file
diff --git a/include/stc/clist.h b/include/stc/clist.h
index bf96076c..18685d9e 100644
--- a/include/stc/clist.h
+++ b/include/stc/clist.h
@@ -55,7 +55,6 @@
*/
#ifndef CLIST_H_INCLUDED
-#define CLIST_H_INCLUDED
#include "ccommon.h"
#include "forward.h"
#include <stdlib.h>
@@ -316,9 +315,7 @@ cx_memb(_sort)(Self* self) {
#endif // TEMPLATE IMPLEMENTATION
-#if !defined(STC_HEADER) || defined(i_imp) && i_imp == 2
-#ifndef CLIST_NON_TEMPLATED
-#define CLIST_NON_TEMPLATED
+#if !defined(STC_HEADER) && !defined(CLIST_H_INCLUDED) || defined(i_imp) && i_imp == 2
STC_DEF size_t
_clist_count(const clist_VOID* self) {
@@ -378,7 +375,6 @@ _clist_mergesort(clist_VOID_node_t *list, int (*cmp)(const clist_VOID_node_t*, c
insize *= 2;
}
}
-#endif
-#endif
-
+#endif // NON-TEMPLATE IMPLEMENTATION
#include "template.h"
+#define CLIST_H_INCLUDED \ No newline at end of file
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index 36417bc9..587b3887 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -49,7 +49,6 @@ int main(void) {
*/
#ifndef CMAP_H_INCLUDED
-#define CMAP_H_INCLUDED
#include "ccommon.h"
#include "forward.h"
#include <stdlib.h>
@@ -212,9 +211,7 @@ cx_memb(_erase_at)(Self* self, cx_iter_t it) {
/* -------------------------- IMPLEMENTATION ------------------------- */
-#if !defined(STC_HEADER) || defined(i_imp) && i_imp == 2
-#ifndef CMAP_NON_TEMPLATED
-#define CMAP_NON_TEMPLATED
+#if !defined(STC_HEADER) && !defined(CMAP_H_INCLUDED) || defined(i_imp) && i_imp == 2
STC_DEF uint64_t c_default_hash(const void *key, size_t len) {
const uint64_t m = 0xb5ad4eceda1ce2a9;
@@ -232,15 +229,16 @@ STC_DEF uint64_t c_default_hash(const void *key, size_t len) {
}
return h ^ (h >> 15);
}
-#endif
-#endif
+#endif // NON-TEMPLATED
#if !defined(STC_HEADER) || defined(STC_IMPLEMENTATION) || defined(i_imp)
+#ifndef CMAP_H_INCLUDED
//STC_INLINE size_t fastrange_uint64_t(uint64_t x, uint64_t n)
// { uint64_t lo, hi; c_umul128(x, n, &lo, &hi); return hi; }
#define fastrange_uint32_t(x, n) ((size_t) (((uint32_t)(x)*(uint64_t)(n)) >> 32))
#define chash_index_(h, entryPtr) ((entryPtr) - (h).table)
+#endif
STC_DEF Self
cx_memb(_with_capacity)(size_t cap) {
@@ -379,3 +377,4 @@ cx_memb(_erase_entry)(Self* self, cx_value_t* _val) {
#undef cx_MAP_ONLY
#undef cx_SET_ONLY
#include "template.h"
+#define CMAP_H_INCLUDED \ No newline at end of file
diff --git a/include/stc/cpque.h b/include/stc/cpque.h
index e8f9c471..de509710 100644
--- a/include/stc/cpque.h
+++ b/include/stc/cpque.h
@@ -22,7 +22,6 @@
*/
#ifndef CPQUE_H_INCLUDED
-#define CPQUE_H_INCLUDED
#include <stdlib.h>
#include "ccommon.h"
#include "forward.h"
@@ -156,3 +155,4 @@ cx_memb(_emplace_items)(Self *self, const cx_rawvalue_t arr[], size_t n) {
#endif
#include "template.h"
+#define CPQUE_H_INCLUDED \ No newline at end of file
diff --git a/include/stc/csmap.h b/include/stc/csmap.h
index bae2ea96..e176fc58 100644
--- a/include/stc/csmap.h
+++ b/include/stc/csmap.h
@@ -203,9 +203,8 @@ cx_memb(_advance)(cx_iter_t it, size_t n) {
#if !defined(STC_HEADER) || defined(STC_IMPLEMENTATION) || defined(i_imp)
#ifndef CSMAP_H_INCLUDED
-#define CSMAP_H_INCLUDED
static struct csmap_rep _csmap_sentinel = {0, 0, 0, 0, 0};
-#endif
+#endif // CSMAP_H_INCLUDED
STC_DEF Self
cx_memb(_init)(void) {
@@ -487,3 +486,4 @@ cx_memb(_del)(Self* self) {
#undef cx_MAP_ONLY
#undef cx_SET_ONLY
#include "template.h"
+#define CSMAP_H_INCLUDED
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index 043fbdc6..f7c16421 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include "ccommon.h"
#include "forward.h"
-#endif
+#endif // CSTACK_H_INCLUDED
#ifndef i_prefix
#define i_prefix cstack_
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 8d379b6e..91df7213 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -224,7 +224,6 @@ cx_memb(_sort)(Self* self) {
#if !defined(STC_HEADER) || defined(STC_IMPLEMENTATION) || defined(i_imp)
#ifndef CVEC_H_INCLUDED
-#define CVEC_H_INCLUDED
static struct cvec_rep _cvec_sentinel = {0, 0};
#endif
@@ -363,3 +362,4 @@ cx_memb(_value_compare)(const cx_value_t* x, const cx_value_t* y) {
#endif
#include "template.h"
+#define CVEC_H_INCLUDED \ No newline at end of file