diff options
| author | Tyge <[email protected]> | 2020-04-26 23:30:14 +0200 |
|---|---|---|
| committer | Tyge <[email protected]> | 2020-04-26 23:30:14 +0200 |
| commit | 3ce522042c4d5cfdcbdffb8428f3405166ded373 (patch) | |
| tree | 438f63f42da8021e8a1bd2a3eec0063f55f205bf /stc/cvector.h | |
| parent | 782a2e7e627db4a8c5625b8986ea4a92b51e7808 (diff) | |
| download | STC-modified-3ce522042c4d5cfdcbdffb8428f3405166ded373.tar.gz STC-modified-3ce522042c4d5cfdcbdffb8428f3405166ded373.zip | |
More refactor.
Diffstat (limited to 'stc/cvector.h')
| -rw-r--r-- | stc/cvector.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/stc/cvector.h b/stc/cvector.h index 782c7954..4430a750 100644 --- a/stc/cvector.h +++ b/stc/cvector.h @@ -49,11 +49,6 @@ typedef struct CVector_##tag { \ Value* data; \
} CVector_##tag; \
\
-static inline void \
-cvector_##tag##_swap(CVector_##tag* a, CVector_##tag* b) { \
- c_swap(Value*, a->data, b->data); \
-} \
- \
STC_API void \
cvector_##tag##_destroy(CVector_##tag* self); \
\
@@ -83,19 +78,17 @@ cvector_##tag##_insert(CVector_##tag* self, size_t pos, Value value); \ STC_API void \
cvector_##tag##_erase(CVector_##tag* self, size_t pos, size_t size); \
\
-static inline int \
-cvector_##tag##_sortCompare(const void* x, const void* y) { \
- ValueRaw rx = valueGetRaw((const Value *) x); \
- ValueRaw ry = valueGetRaw((const Value *) y); \
- return valueCompare(&rx, &ry); \
-} \
- \
STC_API void \
cvector_##tag##_sort(CVector_##tag* self); \
\
STC_API size_t \
cvector_##tag##_find(CVector_##tag cv, ValueRaw rawValue); \
\
+static inline void \
+cvector_##tag##_swap(CVector_##tag* a, CVector_##tag* b) { \
+ c_swap(Value*, a->data, b->data); \
+} \
+ \
\
typedef struct cvector_##tag##_iter_t { \
Value *item, *end; \
@@ -185,6 +178,12 @@ cvector_##tag##_find(CVector_##tag cv, ValueRaw rawValue) { \ return c_npos; \
} \
\
+STC_API int \
+cvector_##tag##_sortCompare(const void* x, const void* y) { \
+ ValueRaw rx = valueGetRaw((const Value *) x); \
+ ValueRaw ry = valueGetRaw((const Value *) y); \
+ return valueCompare(&rx, &ry); \
+} \
extern void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*)); \
STC_API void \
cvector_##tag##_sort(CVector_##tag* self) { \
|
