From: arai Date: Fri, 17 May 2002 20:18:30 +0000 (+0000) Subject: * slide.c (encode_alloc): use xmalloc(). X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=884f19b881a7ba4cf3872bcdf0e55ddf6bd2d9f7;p=lha%2Flha.git * slide.c (encode_alloc): use xmalloc(). git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@44 6a8cc165-1e22-0410-a132-eb4e3f353aba --- diff --git a/src/slide.c b/src/slide.c index 9816f16..5968164 100644 --- a/src/slide.c +++ b/src/slide.c @@ -135,15 +135,12 @@ encode_alloc(method) if (hash) return method; - if (alloc_buf() == NULL) exit(207); /* I don't know this 207. */ + alloc_buf(); - hash = (unsigned int*)malloc(HSHSIZ * sizeof(unsigned int)); - prev = (unsigned int*)malloc(DICSIZ * sizeof(unsigned int)); - text = (unsigned char*)malloc(TXTSIZ); - too_flag = (unsigned char*)malloc(HSHSIZ); - - if (hash == NULL || prev == NULL || text == NULL || too_flag == NULL) - exit(207); + hash = (unsigned int*)xmalloc(HSHSIZ * sizeof(unsigned int)); + prev = (unsigned int*)xmalloc(DICSIZ * sizeof(unsigned int)); + text = (unsigned char*)xmalloc(TXTSIZ); + too_flag = (unsigned char*)xmalloc(HSHSIZ); return method; } @@ -398,10 +395,7 @@ decode(interface) crc = 0; prev_char = -1; dicsiz = 1L << dicbit; - dtext = (unsigned char *) malloc(dicsiz); - if (dtext == NULL) - /* error(MEMOVRERR, NULL); */ - exit(errno); + dtext = (unsigned char *)xmalloc(dicsiz); for (i=0; i