sled

Једноставни уређивач текста
git clone https://git.sr.ht/~strahinja/sled
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување a98e2dc29f3c95918dd26063aef3d95d678197c4
родитељ c71fd27e9970fd70d88a531a26ef332589a6fca5
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Thu, 26 Sep 2024 09:32:11 +0200

util.h(ENSURE_SIZE): Move the assignment to tosize after successful 
reallocation, use fromsize directly in the call to realloc

Diffstat:
Mutil.h | 6+++---
измењених датотека: 1, додавања: 3(+), брисања: 3(-)

diff --git a/util.h b/util.h @@ -58,8 +58,7 @@ { \ if (!to || tosize < testsize) \ { \ - tosize = fromsize; \ - temp = realloc(to, tosize * sizeof(type)); \ + temp = realloc(to, fromsize * sizeof(type)); \ if (!temp) \ { \ char* ctemp = NULL; \ @@ -68,7 +67,8 @@ LINE_DEFAULT, ctemp); \ goto label; \ } \ - to = temp; \ + tosize = fromsize; \ + to = temp; \ } \ } while (0) /*