diff options
| author | Tyge Løvset <[email protected]> | 2021-04-25 08:22:38 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-04-25 08:22:38 +0200 |
| commit | 023227b4c1f4a7f282bbd47858012b3b69584394 (patch) | |
| tree | 445028315b12933e13f3d08a97a7a44cc0f2a372 | |
| parent | d4cdbd52e6fed3d9790632a53939f45e99d6e1f8 (diff) | |
| download | STC-modified-023227b4c1f4a7f282bbd47858012b3b69584394.tar.gz STC-modified-023227b4c1f4a7f282bbd47858012b3b69584394.zip | |
Another small cleanup after the cdeq fix.
| -rw-r--r-- | stc/cdeq.h | 5 | ||||
| -rw-r--r-- | stc/cvec.h | 3 |
2 files changed, 3 insertions, 5 deletions
@@ -233,10 +233,9 @@ static struct cdeq_rep _cdeq_inits = {0, 0}; self->data = self->_base + nfront; \
} \
size_t pos = (cap - (len + n)) / 2; \
+ if (!at_front && nfront < pos) return; \
if (at_front && nback < pos) pos += pos - nback; \
- else if (!at_front && nfront < pos) pos = nfront; \
- if (pos != nfront) \
- self->data = (CX##_value_t *) memmove(self->_base + pos, self->data, len*sizeof(Value)); \
+ self->data = (CX##_value_t *) memmove(self->_base + pos, self->data, len*sizeof(Value)); \
} \
\
STC_DEF void \
@@ -46,7 +46,6 @@ struct cvec_rep { size_t size, cap; void* data[]; };
#define _cvec_rep(self) c_container_of((self)->data, struct cvec_rep, data)
-typedef int (*c_cmp_fn)(const void*, const void*);
#define _c_using_cvec(CX, Value, valueCompareRaw, valueDel, valueFromRaw, valueToRaw, RawValue) \
@@ -172,7 +171,7 @@ typedef int (*c_cmp_fn)(const void*, const void*); STC_INLINE void \
CX##_sort_range(CX##_iter_t i1, CX##_iter_t i2, \
int(*cmp)(const CX##_value_t*, const CX##_value_t*)) { \
- qsort(i1.ref, i2.ref - i1.ref, sizeof(CX##_value_t), (c_cmp_fn) cmp); \
+ qsort(i1.ref, i2.ref - i1.ref, sizeof(CX##_value_t), (int(*)(const void*, const void*)) cmp); \
} \
STC_INLINE void \
CX##_sort(CX* self) { \
|
