From: Wolfgang (Blub) Bumiller Date: Fri, 27 Apr 2012 11:53:49 +0000 (+0200) Subject: a vector_remove shouldn't clear the vector when failing to reallocate as a smaller... X-Git-Tag: 0.1-rc1~580 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9867ce26b3b73ed9e54edb8549e1cb6728c9da04;p=xonotic%2Fgmqcc.git 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. --- 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; \