stew

a monorepo of some sort
Log | Files | Refs

commit 9cd0007204972fc84ee36857ae82e1c4eed72749
parent 6ae6525074eb4c0a703c6e560bf013e9cf429773
Author: rpa <rpa@laika>
Date:   Sun, 11 Dec 2022 23:29:25 +0000

tabul: no tstore if original and new are nil

Diffstat:
Msrc/tabul/tabul.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/tabul/tabul.c b/src/tabul/tabul.c @@ -538,6 +538,8 @@ tfetch(Table *t, Point xy) void tstore(Table *t, Point xy, char *s) { + char **v = tfetch(t, xy); + if ((s == nil) && ((v == nil) || (*v == nil))) return; Rectangle new = { (xy.x < t->r.min.x) ? xy.x : t->r.min.x, (xy.y < t->r.min.y) ? xy.y : t->r.min.y, @@ -547,7 +549,7 @@ tstore(Table *t, Point xy, char *s) if (eqrect(new, t->r) == 0) { resizetable(t, new); } - char **v = tfetch(t, xy); + v = tfetch(t, xy); free(*v); *v = s; }