sled

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

чување 6579c3ea142cb4178480ac26edc4aa3caf190fcc
родитељ ceddaf6b6424324544ec7d2e569fd79282637a11
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Sun,  9 Jun 2024 17:13:54 +0200

Bugfix: "to" passed to U32_SAFE_COPY was not always initialized

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

diff --git a/TODO b/TODO @@ -1,9 +1,6 @@ TODO ==== -[ ] Investigate: paste text longer than a line, then type in the middle - of it -> overwrites the text?! - < > Make allocation errors prompt to save the file before exiting? - Would this make sense? diff --git a/TODO.done b/TODO.done @@ -1,6 +1,12 @@ Done or canceled todos ====================== +[x] Investigate: paste text longer than a line, then type in the middle + of it -> overwrites the text?! + - Fixed; "to" parameter passed to U32_SAFE_COPY was not always + initialized?! Odd, since create_file/load_file should have initialized + it to LINE_DEFAULT. Now ENSURE_SIZE also initializes it if !to + [x] *str*cpy -> memccpy? [x] Check (and possibly remove) leftover constants diff --git a/util.h b/util.h @@ -28,7 +28,7 @@ #define ENSURE_SIZE(to, temp, tosize, testsize, fromsize, label, type) \ do \ { \ - if (tosize < testsize) \ + if (!to || tosize < testsize) \ { \ tosize = fromsize; \ temp = realloc(to, tosize * sizeof(type)); \