diff options
| author | Tyge Løvset <[email protected]> | 2022-01-03 16:23:09 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-01-03 16:23:09 +0100 |
| commit | c935d2af7cf730fec80695d20529d0b15bda2898 (patch) | |
| tree | 61213ecd9d60575bdab79c7e8b039e1be7a8d6ae | |
| parent | 50825b5a3e635d22e7a6eaa1006ed5ec306b2995 (diff) | |
| download | STC-modified-c935d2af7cf730fec80695d20529d0b15bda2898.tar.gz STC-modified-c935d2af7cf730fec80695d20529d0b15bda2898.zip | |
Regression in csmap, and possible cvec in last commit. Reverting.
| -rw-r--r-- | include/stc/csmap.h | 4 | ||||
| -rw-r--r-- | include/stc/cvec.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/csmap.h b/include/stc/csmap.h index bdb2ec45..1a2134ad 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -255,7 +255,7 @@ STC_DEF bool _cx_memb(_reserve)(_cx_self* self, const size_t cap) {
struct csmap_rep* rep = _csmap_rep(self), *oldrep;
if (cap >= rep->size) {
- oldrep = rep == &_csmap_sentinel ? NULL : rep;
+ oldrep = rep->cap ? rep : NULL;
rep = (struct csmap_rep*) c_realloc(oldrep,
sizeof(struct csmap_rep) + (cap + 1)*sizeof(_cx_node));
if (!rep) return false;
@@ -506,7 +506,7 @@ _cx_memb(_drop_r_)(_cx_node* d, _cx_size tn) { STC_DEF void
_cx_memb(_drop)(_cx_self* self) {
struct csmap_rep* rep = _csmap_rep(self);
- if (rep != &_csmap_sentinel) {
+ if (rep->cap) {
_cx_memb(_drop_r_)(self->nodes, (_cx_size) rep->root);
c_free(rep);
}
diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 7d71c515..8e630926 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -258,7 +258,7 @@ _cx_memb(_clear)(_cx_self* self) { STC_DEF void
_cx_memb(_drop)(_cx_self* self) {
- if (cvec_rep_(self) == &_cvec_sentinel) return;
+ if (!cvec_rep_(self)->cap) return;
_cx_memb(_clear)(self);
c_free(cvec_rep_(self));
}
|
