From a5a5e3611963ec63082fc3dfb748e3e67b747bd8 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Sun, 20 Nov 2005 19:04:10 +0000 Subject: [PATCH] - Changed the assertion message text shown in the requester window. - The standard malloc() now sets errno to EINVAL for zero length allocations. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15066 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/stdlib_assertion_failure.c | 4 ++-- library/stdlib_malloc.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/library/stdlib_assertion_failure.c b/library/stdlib_assertion_failure.c index 1c929aa..b918093 100644 --- a/library/stdlib_assertion_failure.c +++ b/library/stdlib_assertion_failure.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_assertion_failure.c,v 1.10 2005-03-19 11:06:57 obarthel Exp $ + * $Id: stdlib_assertion_failure.c,v 1.11 2005-11-20 19:04:10 obarthel Exp $ * * :ts=4 * @@ -101,7 +101,7 @@ __assertion_failure( es.es_StructSize = sizeof(es); es.es_Title = (STRPTR)__program_name; - es.es_TextFormat = (STRPTR)"Assertion of expression\n\"%s\"\nfailed in file \"%s\", line %ld."; + es.es_TextFormat = (STRPTR)"Assertion of condition\n\"%s\"\nfailed in file \"%s\", line %ld."; es.es_GadgetFormat = (STRPTR)"Sorry"; EasyRequest(NULL,&es,NULL, diff --git a/library/stdlib_malloc.c b/library/stdlib_malloc.c index 67f3c90..613a995 100644 --- a/library/stdlib_malloc.c +++ b/library/stdlib_malloc.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_malloc.c,v 1.15 2005-11-20 17:00:22 obarthel Exp $ + * $Id: stdlib_malloc.c,v 1.16 2005-11-20 19:04:10 obarthel Exp $ * * :ts=4 * @@ -116,7 +116,10 @@ __allocate_memory(size_t size,BOOL never_free,const char * UNUSED unused_file,in /* Zero length allocations are by default rejected. */ if(size == 0) + { + __set_errno(EINVAL); goto out; + } if(__free_memory_threshold > 0 && AvailMem(MEMF_ANY|MEMF_LARGEST) < __free_memory_threshold) {