Hide internals of _NSZone struct for consistency with OSX

This commit is contained in:
rfm 2024-07-23 13:06:24 +01:00
parent 52c127c950
commit b49af95359
2 changed files with 41 additions and 38 deletions

View file

@ -30,28 +30,6 @@
#define __NSZone_h_GNUSTEP_BASE_INCLUDE #define __NSZone_h_GNUSTEP_BASE_INCLUDE
#import "GNUstepBase/GSVersionMacros.h" #import "GNUstepBase/GSVersionMacros.h"
/**
* Primary structure representing an <code>NSZone</code>. Technically it
* consists of a set of function pointers for zone upkeep functions plus some
* other things-
<example>
{
// Functions for zone.
void *(*malloc)(struct _NSZone *zone, size_t size);
void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size);
void (*free)(struct _NSZone *zone, void *ptr);
void (*recycle)(struct _NSZone *zone);
BOOL (*check)(struct _NSZone *zone);
BOOL (*lookup)(struct _NSZone *zone, void *ptr);
// Zone statistics (not always maintained).
struct NSZoneStats (*stats)(struct _NSZone *zone);
size_t gran; // Zone granularity (passed in on initialization)
NSString *name; // Name of zone (default is 'nil')
NSZone *next; // Pointer used for internal management of multiple zones.
}</example>
*/
typedef struct _NSZone NSZone; typedef struct _NSZone NSZone;
#import <Foundation/NSObjCRuntime.h> #import <Foundation/NSObjCRuntime.h>
@ -62,22 +40,6 @@ typedef struct _NSZone NSZone;
extern "C" { extern "C" {
#endif #endif
struct _NSZone
{
/* Functions for zone. */
void *(*malloc)(struct _NSZone *zone, size_t size);
void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size);
void (*free)(struct _NSZone *zone, void *ptr);
void (*recycle)(struct _NSZone *zone);
BOOL (*check)(struct _NSZone *zone);
BOOL (*lookup)(struct _NSZone *zone, void *ptr);
struct NSZoneStats (*stats)(struct _NSZone *zone);
size_t gran; // Zone granularity
__unsafe_unretained NSString *name; // Name of zone (default is 'nil')
NSZone *next;
};
/** /**
* Creates a new zone of start bytes, which will grow and shrink by * Creates a new zone of start bytes, which will grow and shrink by
* granularity bytes. If canFree is 0, memory in zone is allocated but * granularity bytes. If canFree is 0, memory in zone is allocated but

View file

@ -93,6 +93,47 @@
#import "GSPrivate.h" #import "GSPrivate.h"
#import "GSPThread.h" #import "GSPThread.h"
/**
* Primary structure representing an <code>NSZone</code>. Technically it
* consists of a set of function pointers for zone upkeep functions plus some
* other things-
<example>
{
// Functions for zone.
void *(*malloc)(struct _NSZone *zone, size_t size);
void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size);
void (*free)(struct _NSZone *zone, void *ptr);
void (*recycle)(struct _NSZone *zone);
BOOL (*check)(struct _NSZone *zone);
BOOL (*lookup)(struct _NSZone *zone, void *ptr);
// Zone statistics (not always maintained).
struct NSZoneStats (*stats)(struct _NSZone *zone);
size_t gran; // Zone granularity (passed in on initialization)
NSString *name; // Name of zone (default is 'nil')
NSZone *next; // Pointer used for internal management of multiple zones.
}</example>
*/
struct _NSZone
{
/* Functions for zone. */
void *(*malloc)(struct _NSZone *zone, size_t size);
void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size);
void (*free)(struct _NSZone *zone, void *ptr);
void (*recycle)(struct _NSZone *zone);
BOOL (*check)(struct _NSZone *zone);
BOOL (*lookup)(struct _NSZone *zone, void *ptr);
struct NSZoneStats (*stats)(struct _NSZone *zone);
size_t gran; // Zone granularity
__unsafe_unretained NSString *name; // Name of zone (default is 'nil')
NSZone *next;
};
static gs_mutex_t zoneLock = GS_MUTEX_INIT_STATIC; static gs_mutex_t zoneLock = GS_MUTEX_INIT_STATIC;
/** /**