From 9867ce26b3b73ed9e54edb8549e1cb6728c9da04 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Fri, 27 Apr 2012 13:53:49 +0200 Subject: [PATCH] a vector_remove shouldn't clear the vector when failing to reallocate as a smaller chunk, just return false. The value is still removed from the vector, so no unstable state is generated by this, which makes a _remove safe to ignore where it makes sense. --- astir.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/astir.h b/astir.h index 09b9843..37f7627 100644 --- a/astir.h +++ b/astir.h @@ -73,10 +73,8 @@ bool GMQCC_WARN Tself##_##mem##_remove(Tself *self, size_t idx) \ { \ self->mem##_alloc /= 2; \ reall = (Twhat*)mem_a(sizeof(Twhat) * self->mem##_count); \ - if (!reall) { \ - MEM_VECTOR_CLEAR(self, mem); \ + if (!reall) \ return false; \ - } \ memcpy(reall, self->mem, sizeof(Twhat) * self->mem##_count); \ mem_d(self->mem); \ self->mem = reall; \ -- 2.39.2