mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Changes from Yoo C. Chung. See ChangeLog Mar 29 00:43:18
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2305 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8587a2d6ee
commit
e52800f26a
3 changed files with 25 additions and 12 deletions
|
@ -22,6 +22,11 @@ Sat May 3 12:28:48 1997 Andrew McCallum <mccallum@jprc.com>
|
||||||
Use NSBundle's pathForResource:ofType:inDirectory method properly.
|
Use NSBundle's pathForResource:ofType:inDirectory method properly.
|
||||||
(Reported by Stevo Crvenkovski <stevoc@lotus.mpt.com.mk>.)
|
(Reported by Stevo Crvenkovski <stevoc@lotus.mpt.com.mk>.)
|
||||||
|
|
||||||
|
Sat Mar 29 00:43:18 1997 Yoo C. Chung <wacko@laplace.snu.ac.kr>
|
||||||
|
|
||||||
|
* src/NSZone.m: New e-mail address. Default default zone
|
||||||
|
alignment problems fixed.
|
||||||
|
|
||||||
Sun Mar 23 19:55:19 1997 Mark Kettenis <kettenis@phys.uva.nl>
|
Sun Mar 23 19:55:19 1997 Mark Kettenis <kettenis@phys.uva.nl>
|
||||||
|
|
||||||
* src/Makefile.in: Update config.h.in in $(srcdir)/src/include.
|
* src/Makefile.in: Update config.h.in in $(srcdir)/src/include.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* Zone memory management. -*- Mode: ObjC -*-
|
/* Zone memory management. -*- Mode: ObjC -*-
|
||||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Yoo C. Chung <wacko@power1.snu.ac.kr>
|
Written by: Yoo C. Chung <wacko@laplace.snu.ac.kr>
|
||||||
Date: January 1997
|
Date: January 1997
|
||||||
|
|
||||||
This file is part of the GNUstep Base Library.
|
This file is part of the GNUstep Base Library.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* Zone memory management. -*- Mode: ObjC -*-
|
/* Zone memory management. -*- Mode: ObjC -*-
|
||||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Yoo C. Chung <wacko@power1.snu.ac.kr>
|
Written by: Yoo C. Chung <wacko@laplace.snu.ac.kr>
|
||||||
Date: January 1997
|
Date: January 1997
|
||||||
|
|
||||||
This file is part of the GNUstep Base Library.
|
This file is part of the GNUstep Base Library.
|
||||||
|
@ -39,7 +39,8 @@
|
||||||
- The default zone uses objc_malloc() and friends. We assume that
|
- The default zone uses objc_malloc() and friends. We assume that
|
||||||
they're thread safe and that they return NULL if we're out of
|
they're thread safe and that they return NULL if we're out of
|
||||||
memory (they currently don't, unfortunately, so this is a FIXME).
|
memory (they currently don't, unfortunately, so this is a FIXME).
|
||||||
We also need to prepend a zone pointer.
|
We also need to prepend a zone pointer. And because of this, we
|
||||||
|
need to waste even more space to satisfy alignment requirements.
|
||||||
|
|
||||||
- For freeable zones, a small linear buffer is used for
|
- For freeable zones, a small linear buffer is used for
|
||||||
deallocating and allocating. Anything that can't go into the
|
deallocating and allocating. Anything that can't go into the
|
||||||
|
@ -232,32 +233,39 @@ roundupto (size_t n, size_t base)
|
||||||
static void*
|
static void*
|
||||||
default_malloc (NSZone *zone, size_t size)
|
default_malloc (NSZone *zone, size_t size)
|
||||||
{
|
{
|
||||||
NSZone **mem;
|
void *mem;
|
||||||
|
NSZone **zoneptr;
|
||||||
|
|
||||||
mem = objc_malloc(ZPTRSZ+size);
|
mem = objc_malloc(ALIGN+size);
|
||||||
if (mem == NULL)
|
if (mem == NULL)
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Default zone has run out of memory"];
|
format: @"Default zone has run out of memory"];
|
||||||
*mem = zone;
|
zoneptr = mem+(ALIGN-ZPTRSZ);
|
||||||
return mem+1;
|
*zoneptr = zone;
|
||||||
|
return mem+ALIGN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void*
|
static void*
|
||||||
default_realloc (NSZone *zone, void *ptr, size_t size)
|
default_realloc (NSZone *zone, void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
NSZone **mem = ptr-ZPTRSZ;
|
void **mem = ptr-ALIGN;
|
||||||
|
|
||||||
mem = objc_realloc(mem, size+ZPTRSZ);
|
if (size == 0)
|
||||||
if ((size != 0) && (mem == NULL))
|
{
|
||||||
|
objc_free(mem);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
mem = objc_realloc(mem, size+ALIGN);
|
||||||
|
if (mem == NULL)
|
||||||
[NSException raise: NSMallocException
|
[NSException raise: NSMallocException
|
||||||
format: @"Default zone has run out of memory"];
|
format: @"Default zone has run out of memory"];
|
||||||
return mem+1;
|
return mem+ALIGN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
default_free (NSZone *zone, void *ptr)
|
default_free (NSZone *zone, void *ptr)
|
||||||
{
|
{
|
||||||
objc_free(ptr-ZPTRSZ);
|
objc_free(ptr-ALIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue