summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-03-04 17:48:42 +0100
committerGitHub <[email protected]>2020-03-04 17:48:42 +0100
commit35439649c502897049530dad47633d8e9b3af8c6 (patch)
treebce68fea835f65bc743b5d3b38135691846d3127
parent07c3e6d107e987d401f2c119c1ccc77699d32e9a (diff)
downloadSTC-modified-35439649c502897049530dad47633d8e9b3af8c6.tar.gz
STC-modified-35439649c502897049530dad47633d8e9b3af8c6.zip
Minors
-rw-r--r--cdef.h1
-rw-r--r--cmap_test.c7
-rw-r--r--cvector.h4
3 files changed, 9 insertions, 3 deletions
diff --git a/cdef.h b/cdef.h
index 8384778e..995d1ea3 100644
--- a/cdef.h
+++ b/cdef.h
@@ -16,6 +16,7 @@
// #define foo_1(X) foo_2(X, 100)
// #define foo_2(X, Y) X + Y
+#define _cdef_swap(T, x, y) { T __t = x; x = y; y = __t; }
#define cdef_initRaw(x) (x)
#define cdef_getRaw(x) (x)
diff --git a/cmap_test.c b/cmap_test.c
index aec99192..8d33a6ac 100644
--- a/cmap_test.c
+++ b/cmap_test.c
@@ -97,7 +97,12 @@ int main()
cmap_id_put(&mymap, i*i, i);
for (i = 1000; i < 1010; ++i)
- printf("look %d: %f\n", i*i, cmap_id_get(mymap, i*i)->value);
+ printf("lookup %d: %f\n", i*i, cmap_id_get(mymap, i*i)->value);
+
+ CMapEntry(id)* me = cmap_id_get(mymap, 10000);
+ printf("untouched: %d %f\n", me->untouched, me->value);
+ cmap_id_put(&mymap, 10000, 101.2);
+ printf("untouched: %d %f\n", me->untouched, me->value);
cmap_id_destroy(&mymap);
}
diff --git a/cvector.h b/cvector.h
index a5f49f39..49f06c77 100644
--- a/cvector.h
+++ b/cvector.h
@@ -52,8 +52,8 @@ static inline CVector(tag) cvector_##tag##_init(void) { \
return cv; \
} \
\
-static inline void cvector_##tag##_swap(CVector(tag)* v1, CVector(tag)* v2) { \
- T* data = v1->data; v1->data = v2->data; v2->data = data; \
+static inline void cvector_##tag##_swap(CVector(tag)* a, CVector(tag)* b) { \
+ T* data = a->data; a->data = b->data; b->data = data; \
} \
\
static inline void cvector_##tag##_destroy(CVector(tag)* self) { \