Skip to content

Commit

Permalink
Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchisnall committed Feb 12, 2019
1 parent 70a12d3 commit d015f01
Show file tree
Hide file tree
Showing 19 changed files with 220 additions and 220 deletions.
8 changes: 4 additions & 4 deletions NSBlocks.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "dtable.h"
#include <assert.h>

PUBLIC struct objc_class _NSConcreteGlobalBlock;
PUBLIC struct objc_class _NSConcreteStackBlock;
PUBLIC struct objc_class _NSConcreteMallocBlock;
OBJC_PUBLIC struct objc_class _NSConcreteGlobalBlock;
OBJC_PUBLIC struct objc_class _NSConcreteStackBlock;
OBJC_PUBLIC struct objc_class _NSConcreteMallocBlock;

static struct objc_class _NSConcreteGlobalBlockMeta;
static struct objc_class _NSConcreteStackBlockMeta;
Expand Down Expand Up @@ -40,7 +40,7 @@ static void createNSBlockSubclass(Class superclass, Class newClass,
#define NEW_CLASS(super, sub) \
createNSBlockSubclass(super, &sub, &sub ## Meta, #sub)

PUBLIC
OBJC_PUBLIC
BOOL objc_create_block_classes_as_subclasses_of(Class super)
{
if (_NSBlock.super_class != NULL) { return NO; }
Expand Down
2 changes: 1 addition & 1 deletion alias.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
*/
#include "objc/runtime.h"

PUBLIC Class alias_getClass(const char *alias_name);
OBJC_PUBLIC Class alias_getClass(const char *alias_name);
4 changes: 2 additions & 2 deletions alias_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static Alias alias_table_get_safe(const char *alias_name)
}


PUBLIC Class alias_getClass(const char *alias_name)
OBJC_PUBLIC Class alias_getClass(const char *alias_name)
{
if (NULL == alias_name)
{
Expand All @@ -99,7 +99,7 @@ PRIVATE void alias_table_insert(Alias alias)
alias_table_internal_insert(alias_table, alias);
}

PUBLIC BOOL class_registerAlias_np(Class class, const char *alias)
OBJC_PUBLIC BOOL class_registerAlias_np(Class class, const char *alias)
{
if ((NULL == alias) || (NULL == class))
{
Expand Down
48 changes: 24 additions & 24 deletions arc.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ static TLS_CALLBACK(cleanupPools)(struct arc_tls* tls)
*/
static const long refcount_mask = ~weak_mask;

PUBLIC size_t object_getRetainCount_np(id obj)
OBJC_PUBLIC size_t object_getRetainCount_np(id obj)
{
uintptr_t *refCount = ((uintptr_t*)obj) - 1;
uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0);
return (((size_t)refCountVal) & refcount_mask) + 1;
}

PUBLIC id objc_retain_fast_np(id obj)
OBJC_PUBLIC id objc_retain_fast_np(id obj)
{
uintptr_t *refCount = ((uintptr_t*)obj) - 1;
uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0);
Expand Down Expand Up @@ -293,7 +293,7 @@ static inline id retain(id obj)
return [obj retain];
}

PUBLIC BOOL objc_release_fast_no_destroy_np(id obj)
OBJC_PUBLIC BOOL objc_release_fast_no_destroy_np(id obj)
{
uintptr_t *refCount = ((uintptr_t*)obj) - 1;
uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0);
Expand Down Expand Up @@ -331,7 +331,7 @@ PUBLIC BOOL objc_release_fast_no_destroy_np(id obj)
return NO;
}

PUBLIC void objc_release_fast_np(id obj)
OBJC_PUBLIC void objc_release_fast_np(id obj)
{
if (objc_release_fast_no_destroy_np(obj))
{
Expand Down Expand Up @@ -421,7 +421,7 @@ static inline id autorelease(id obj)
return [obj autorelease];
}

PUBLIC unsigned long objc_arc_autorelease_count_np(void)
OBJC_PUBLIC unsigned long objc_arc_autorelease_count_np(void)
{
struct arc_tls* tls = getARCThreadData();
unsigned long count = 0;
Expand All @@ -435,7 +435,7 @@ PUBLIC unsigned long objc_arc_autorelease_count_np(void)
}
return count;
}
PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id obj)
OBJC_PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id obj)
{
struct arc_tls* tls = getARCThreadData();
unsigned long count = 0;
Expand Down Expand Up @@ -489,7 +489,7 @@ PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id obj)
if (0 == NewAutoreleasePool) { return NULL; }
return NewAutoreleasePool(AutoreleasePool, SELECTOR(new));
}
PUBLIC void objc_autoreleasePoolPop(void *pool)
OBJC_PUBLIC void objc_autoreleasePoolPop(void *pool)
{
if (useARCAutoreleasePool)
{
Expand All @@ -512,7 +512,7 @@ PUBLIC void objc_autoreleasePoolPop(void *pool)
}
}

PUBLIC id objc_autorelease(id obj)
OBJC_PUBLIC id objc_autorelease(id obj)
{
if (nil != obj)
{
Expand All @@ -521,7 +521,7 @@ PUBLIC id objc_autorelease(id obj)
return obj;
}

PUBLIC id objc_autoreleaseReturnValue(id obj)
OBJC_PUBLIC id objc_autoreleaseReturnValue(id obj)
{
if (!useARCAutoreleasePool)
{
Expand All @@ -536,7 +536,7 @@ PUBLIC id objc_autoreleaseReturnValue(id obj)
return objc_autorelease(obj);
}

PUBLIC id objc_retainAutoreleasedReturnValue(id obj)
OBJC_PUBLIC id objc_retainAutoreleasedReturnValue(id obj)
{
// If the previous object was released with objc_autoreleaseReturnValue()
// just before return, then it will not have actually been autoreleased.
Expand Down Expand Up @@ -568,36 +568,36 @@ PUBLIC id objc_retainAutoreleasedReturnValue(id obj)
return objc_retain(obj);
}

PUBLIC id objc_retain(id obj)
OBJC_PUBLIC id objc_retain(id obj)
{
if (nil == obj) { return nil; }
return retain(obj);
}

PUBLIC id objc_retainAutorelease(id obj)
OBJC_PUBLIC id objc_retainAutorelease(id obj)
{
return objc_autorelease(objc_retain(obj));
}

PUBLIC id objc_retainAutoreleaseReturnValue(id obj)
OBJC_PUBLIC id objc_retainAutoreleaseReturnValue(id obj)
{
if (nil == obj) { return obj; }
return objc_autoreleaseReturnValue(retain(obj));
}


PUBLIC id objc_retainBlock(id b)
OBJC_PUBLIC id objc_retainBlock(id b)
{
return _Block_copy(b);
}

PUBLIC void objc_release(id obj)
OBJC_PUBLIC void objc_release(id obj)
{
if (nil == obj) { return; }
release(obj);
}

PUBLIC id objc_storeStrong(id *addr, id value)
OBJC_PUBLIC id objc_storeStrong(id *addr, id value)
{
value = objc_retain(value);
id oldValue = *addr;
Expand Down Expand Up @@ -698,7 +698,7 @@ static inline BOOL weakRefRelease(WeakRef *ref)

void* block_load_weak(void *block);

PUBLIC id objc_storeWeak(id *addr, id obj)
OBJC_PUBLIC id objc_storeWeak(id *addr, id obj)
{
LOCK_FOR_SCOPE(&weakRefLock);
WeakRef *oldRef;
Expand Down Expand Up @@ -789,7 +789,7 @@ PUBLIC id objc_storeWeak(id *addr, id obj)
return obj;
}

PUBLIC BOOL objc_delete_weak_refs(id obj)
OBJC_PUBLIC BOOL objc_delete_weak_refs(id obj)
{
LOCK_FOR_SCOPE(&weakRefLock);
if (objc_test_class_flag(classForObject(obj), objc_class_flag_fast_arc))
Expand Down Expand Up @@ -827,7 +827,7 @@ PUBLIC BOOL objc_delete_weak_refs(id obj)
return YES;
}

PUBLIC id objc_loadWeakRetained(id* addr)
OBJC_PUBLIC id objc_loadWeakRetained(id* addr)
{
LOCK_FOR_SCOPE(&weakRefLock);
id obj;
Expand Down Expand Up @@ -865,12 +865,12 @@ PUBLIC id objc_loadWeakRetained(id* addr)
return objc_retain(obj);
}

PUBLIC id objc_loadWeak(id* object)
OBJC_PUBLIC id objc_loadWeak(id* object)
{
return objc_autorelease(objc_loadWeakRetained(object));
}

PUBLIC void objc_copyWeak(id *dest, id *src)
OBJC_PUBLIC void objc_copyWeak(id *dest, id *src)
{
// Don't retain or release. While the weak ref lock is held, we know that
// the object can't be deallocated, so we just move the value and update
Expand All @@ -892,7 +892,7 @@ PUBLIC void objc_copyWeak(id *dest, id *src)
}
}

PUBLIC void objc_moveWeak(id *dest, id *src)
OBJC_PUBLIC void objc_moveWeak(id *dest, id *src)
{
// Don't retain or release. While the weak ref lock is held, we know that
// the object can't be deallocated, so we just move the value and update
Expand All @@ -910,12 +910,12 @@ PUBLIC void objc_moveWeak(id *dest, id *src)
}
}

PUBLIC void objc_destroyWeak(id* obj)
OBJC_PUBLIC void objc_destroyWeak(id* obj)
{
objc_storeWeak(obj, nil);
}

PUBLIC id objc_initWeak(id *object, id value)
OBJC_PUBLIC id objc_initWeak(id *object, id value)
{
*object = nil;
return objc_storeWeak(object, value);
Expand Down
4 changes: 2 additions & 2 deletions associate.m
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ PRIVATE void gc_setTypeForClass(Class cls, void *type)
list->gc_type = type;
}

PUBLIC
OBJC_PUBLIC
int objc_sync_enter(id object)
{
if ((object == 0) || isSmallObject(object)) { return 0; }
Expand All @@ -397,7 +397,7 @@ int objc_sync_enter(id object)
return 0;
}

PUBLIC
OBJC_PUBLIC
int objc_sync_exit(id object)
{
if ((object == 0) || isSmallObject(object)) { return 0; }
Expand Down
14 changes: 7 additions & 7 deletions blocks_runtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
static void *_HeapBlockByRef = (void*)1;


PUBLIC _Bool _Block_has_signature(id b)
OBJC_PUBLIC _Bool _Block_has_signature(id b)
{
const struct Block_layout *block = (struct Block_layout*)b;
return ((NULL != block) && (block->flags & BLOCK_HAS_SIGNATURE));
}
/**
* Returns the Objective-C type encoding for the block.
*/
PUBLIC const char * _Block_signature(id b)
OBJC_PUBLIC const char * _Block_signature(id b)
{
const struct Block_layout *block = (struct Block_layout*)b;
if ((NULL == block) || !(block->flags & BLOCK_HAS_SIGNATURE))
Expand All @@ -60,7 +60,7 @@ PUBLIC _Bool _Block_has_signature(id b)
}
return block->descriptor->encoding;
}
PUBLIC const char *block_getType_np(const void *b)
OBJC_PUBLIC const char *block_getType_np(const void *b)
{
return _Block_signature(b);
}
Expand Down Expand Up @@ -120,7 +120,7 @@ static int cas(void *ptr, void *old, void *new)
* the other choices which are mutually exclusive. Only in a Block copy helper
* will one see BLOCK_FIELD_IS_BYREF.
*/
PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int flags)
OBJC_PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int flags)
{
//printf("Copying %x to %x with flags %x\n", object, destAddr, flags);
// FIXME: Needs to be implemented
Expand Down Expand Up @@ -199,7 +199,7 @@ PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int f
* The same flags used in the copy helper should be used for each call
* generated to this function:
*/
PUBLIC void _Block_object_dispose(const void *object, const int flags)
OBJC_PUBLIC void _Block_object_dispose(const void *object, const int flags)
{
// FIXME: Needs to be implemented
//if(flags & BLOCK_FIELD_IS_WEAK)
Expand Down Expand Up @@ -244,7 +244,7 @@ PUBLIC void _Block_object_dispose(const void *object, const int flags)


// Copy a block to the heap if it's still on the stack or increments its retain count.
PUBLIC void *_Block_copy(const void *src)
OBJC_PUBLIC void *_Block_copy(const void *src)
{
if (NULL == src) { return NULL; }
struct Block_layout *self = (struct Block_layout*)src;
Expand Down Expand Up @@ -278,7 +278,7 @@ PUBLIC void _Block_object_dispose(const void *object, const int flags)
}

// Release a block and frees the memory when the retain count hits zero.
PUBLIC void _Block_release(const void *src)
OBJC_PUBLIC void _Block_release(const void *src)
{
if (NULL == src) { return; }
struct Block_layout *self = (struct Block_layout*)src;
Expand Down
2 changes: 1 addition & 1 deletion caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static const int32_t caps =
#endif
0;

PUBLIC int objc_test_capability(int x)
OBJC_PUBLIC int objc_test_capability(int x)
{
if (x >= 32) { return 0; }
if (caps & (1<<x)) { return 1; }
Expand Down
4 changes: 2 additions & 2 deletions dtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ static inline int classHasInstalledDtable(struct objc_class *cls)
return (cls->dtable != uninstalled_dtable);
}

PUBLIC
OBJC_PUBLIC
int objc_sync_enter(id object);
PUBLIC
OBJC_PUBLIC
int objc_sync_exit(id object);
/**
* Returns the dtable for a given class. If we are currently in an +initialize
Expand Down
4 changes: 2 additions & 2 deletions loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static enum {

void registerProtocol(Protocol *proto);

PUBLIC void __objc_load(struct objc_init *init)
OBJC_PUBLIC void __objc_load(struct objc_init *init)
{
init_runtime();
#ifdef DEBUG_LOADING
Expand Down Expand Up @@ -313,7 +313,7 @@ PUBLIC void __objc_load(struct objc_init *init)
}

#ifdef OLDABI_COMPAT
PUBLIC void __objc_exec_class(struct objc_module_abi_8 *module)
OBJC_PUBLIC void __objc_exec_class(struct objc_module_abi_8 *module)
{
init_runtime();

Expand Down
14 changes: 7 additions & 7 deletions objc/blocks_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
#define BLOCKS_EXPORT extern
#endif

PUBLIC BLOCKS_EXPORT void *_Block_copy(const void *);
PUBLIC BLOCKS_EXPORT void _Block_release(const void *);
PUBLIC BLOCKS_EXPORT const char *block_getType_np(const void *b) OBJC_NONPORTABLE;
OBJC_PUBLIC BLOCKS_EXPORT void *_Block_copy(const void *);
OBJC_PUBLIC BLOCKS_EXPORT void _Block_release(const void *);
OBJC_PUBLIC BLOCKS_EXPORT const char *block_getType_np(const void *b) OBJC_NONPORTABLE;
#ifdef __OBJC__
PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(id);
PUBLIC BLOCKS_EXPORT const char * _Block_signature(id);
OBJC_PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(id);
OBJC_PUBLIC BLOCKS_EXPORT const char * _Block_signature(id);
#else
PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(void *);
PUBLIC BLOCKS_EXPORT const char * _Block_signature(void *);
OBJC_PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(void *);
OBJC_PUBLIC BLOCKS_EXPORT const char * _Block_signature(void *);
#endif

#define Block_copy(x) ((__typeof(x))_Block_copy((const void *)(x)))
Expand Down
2 changes: 1 addition & 1 deletion objc/capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ extern "C" {
* Run time feature test. This function returns 1 if the runtime supports the
* specified feature or 0 if it does not.
*/
PUBLIC
OBJC_PUBLIC
int objc_test_capability(int x) OBJC_NONPORTABLE;
#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit d015f01

Please sign in to comment.