From fae8b54e540851e67844409e26d494e15deb21d9 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 11 Nov 2006 12:11:20 +0000 Subject: [PATCH] * Allow to resize canvases back to (0,0). --- cucul/cucul.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cucul/cucul.c b/cucul/cucul.c index 67770c8..27cdaaf 100644 --- a/cucul/cucul.c +++ b/cucul/cucul.c @@ -259,8 +259,8 @@ int _cucul_set_canvas_size(cucul_canvas_t *cv, unsigned int width, cv->allchars[f] = realloc(cv->allchars[f], new_size * sizeof(uint32_t)); cv->allattrs[f] = realloc(cv->allattrs[f], - new_size * sizeof(uint32_t)); - if(!cv->allchars[f] || !cv->allattrs[f]) + new_size * sizeof(uint32_t)); + if(new_size && (!cv->allchars[f] || !cv->allattrs[f])) { #if defined(HAVE_ERRNO_H) errno = ENOMEM; @@ -353,8 +353,8 @@ int _cucul_set_canvas_size(cucul_canvas_t *cv, unsigned int width, cv->allchars[f] = realloc(cv->allchars[f], new_size * sizeof(uint32_t)); cv->allattrs[f] = realloc(cv->allattrs[f], - new_size * sizeof(uint32_t)); - if(!cv->allchars[f] || !cv->allattrs[f]) + new_size * sizeof(uint32_t)); + if(new_size && (!cv->allchars[f] || !cv->allattrs[f])) { #if defined(HAVE_ERRNO_H) errno = ENOMEM;