ndentation fixups

This commit is contained in:
Richard Frith-Macdonald 2018-01-23 16:17:57 +00:00
parent 07ba3ec932
commit 746f2a2a1a
5 changed files with 54 additions and 52 deletions

View file

@ -39,7 +39,7 @@ typedef void* dl_symbol_t;
static int static int
__objc_dynamic_init(const char* exec_path) __objc_dynamic_init(const char* exec_path)
{ {
return 0; return 0;
} }
/* Link in the module given by the name 'module'. Return a handle which can /* Link in the module given by the name 'module'. Return a handle which can
@ -48,7 +48,7 @@ __objc_dynamic_init(const char* exec_path)
static dl_handle_t static dl_handle_t
__objc_dynamic_link(const char* module, int mode, const char* debug_file) __objc_dynamic_link(const char* module, int mode, const char* debug_file)
{ {
return (dl_handle_t)shl_load(module, LINK_FLAGS, 0L); return (dl_handle_t)shl_load(module, LINK_FLAGS, 0L);
} }
/* Return the address of a symbol given by the name 'symbol' from the module /* Return the address of a symbol given by the name 'symbol' from the module
@ -61,19 +61,19 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
static dl_symbol_t static dl_symbol_t
__objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
{ {
int ok; int ok;
void *value; void *value;
ok = shl_findsym(&handle, symbol, TYPE_UNDEFINED, value); ok = shl_findsym(&handle, symbol, TYPE_UNDEFINED, value);
if (ok != 0) if (ok != 0)
value = 0; value = 0;
return value; return value;
} }
/* remove the code from memory associated with the module 'handle' */ /* remove the code from memory associated with the module 'handle' */
static int static int
__objc_dynamic_unlink(dl_handle_t handle) __objc_dynamic_unlink(dl_handle_t handle)
{ {
return shl_unload(handle); return shl_unload(handle);
} }
/* Print an error message (prefaced by 'error_string') relevant to the /* Print an error message (prefaced by 'error_string') relevant to the
@ -82,20 +82,20 @@ __objc_dynamic_unlink(dl_handle_t handle)
static void static void
__objc_dynamic_error(FILE *error_stream, const char *error_string) __objc_dynamic_error(FILE *error_stream, const char *error_string)
{ {
fprintf(error_stream, "%s\n", error_string); fprintf(error_stream, "%s\n", error_string);
} }
/* Debugging: define these if they are available */ /* Debugging: define these if they are available */
static int static int
__objc_dynamic_undefined_symbol_count(void) __objc_dynamic_undefined_symbol_count(void)
{ {
return 0; return 0;
} }
static char** static char**
__objc_dynamic_list_undefined_symbols(void) __objc_dynamic_list_undefined_symbols(void)
{ {
return NULL; return NULL;
} }
// TODO: search for an hp-ux equivalent of dladdr() */ // TODO: search for an hp-ux equivalent of dladdr() */

View file

@ -33,7 +33,7 @@ typedef void* dl_symbol_t;
static int static int
__objc_dynamic_init(const char* exec_path) __objc_dynamic_init(const char* exec_path)
{ {
return -1; return -1;
} }
/* Link in the module given by the name 'module'. Return a handle which can /* Link in the module given by the name 'module'. Return a handle which can
@ -42,7 +42,7 @@ __objc_dynamic_init(const char* exec_path)
static dl_handle_t static dl_handle_t
__objc_dynamic_link(const char* module, int mode, const char* debug_file) __objc_dynamic_link(const char* module, int mode, const char* debug_file)
{ {
return 0; return 0;
} }
/* Return the address of a symbol given by the name 'symbol' from the module /* Return the address of a symbol given by the name 'symbol' from the module
@ -55,14 +55,14 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
static dl_symbol_t static dl_symbol_t
__objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
{ {
return 0; return 0;
} }
/* remove the code from memory associated with the module 'handle' */ /* remove the code from memory associated with the module 'handle' */
static int static int
__objc_dynamic_unlink(dl_handle_t handle) __objc_dynamic_unlink(dl_handle_t handle)
{ {
return 0; return 0;
} }
/* Print an error message (prefaced by 'error_string') relevant to the /* Print an error message (prefaced by 'error_string') relevant to the
@ -71,20 +71,20 @@ __objc_dynamic_unlink(dl_handle_t handle)
static void static void
__objc_dynamic_error(FILE *error_stream, const char *error_string) __objc_dynamic_error(FILE *error_stream, const char *error_string)
{ {
fprintf(error_stream, "%s\n", error_string); fprintf(error_stream, "%s\n", error_string);
} }
/* Debugging: define these if they are available */ /* Debugging: define these if they are available */
static int static int
__objc_dynamic_undefined_symbol_count(void) __objc_dynamic_undefined_symbol_count(void)
{ {
return 0; return 0;
} }
static char** static char**
__objc_dynamic_list_undefined_symbols(void) __objc_dynamic_list_undefined_symbols(void)
{ {
return NULL; return NULL;
} }
static char * static char *

View file

@ -266,15 +266,17 @@ GSPrivateSymbolPath(Class theClass, Category *theCategory)
#elif LINKER_GETSYMBOL #elif LINKER_GETSYMBOL
NSString *GSPrivateSymbolPath(Class theClass, Category *theCategory) NSString *GSPrivateSymbolPath(Class theClass, Category *theCategory)
{ {
void *addr = (NULL == theCategory) ? (void*)theClass : (void*)theCategory; void *addr = (NULL == theCategory) ? (void*)theClass : (void*)theCategory;
Dl_info info; Dl_info info;
// This is correct: dladdr() does the opposite thing to all other UNIX
// functions. /* This is correct: dladdr() does the opposite thing to all other UNIX
if (0 == dladdr(addr, &info)) * functions.
{ */
return nil; if (0 == dladdr(addr, &info))
} {
return [NSString stringWithUTF8String: info.dli_fname]; return nil;
}
return [NSString stringWithUTF8String: info.dli_fname];
} }
#else #else
NSString * NSString *
@ -299,7 +301,7 @@ GSPrivateSymbolPath(Class theClass, Category *theCategory)
} }
memcpy(p, "__objc_class_name_", sizeof(char)*18); memcpy(p, "__objc_class_name_", sizeof(char)*18);
memcpy(&p[18*sizeof(char)], className, strlen(className) + 1); memcpy(&p[18*sizeof(char)], className, strlen(className) + 1);
} }
else else
{ {
@ -318,10 +320,10 @@ GSPrivateSymbolPath(Class theClass, Category *theCategory)
memcpy(p, "__objc_category_name_", sizeof(char)*21); memcpy(p, "__objc_category_name_", sizeof(char)*21);
memcpy(&p[21*sizeof(char)], theCategory->class_name, memcpy(&p[21*sizeof(char)], theCategory->class_name,
strlen(theCategory->class_name) + 1); strlen(theCategory->class_name) + 1);
memcpy(&p[strlen(p)], "_", 2*sizeof(char)); memcpy(&p[strlen(p)], "_", 2*sizeof(char));
memcpy(&p[strlen(p)], theCategory->category_name, memcpy(&p[strlen(p)], theCategory->category_name,
strlen(theCategory->category_name) + 1); strlen(theCategory->category_name) + 1);
} }
ret = __objc_dynamic_get_symbol_path(0, p); ret = __objc_dynamic_get_symbol_path(0, p);

View file

@ -53,7 +53,7 @@ typedef void* dl_symbol_t;
static int static int
__objc_dynamic_init(const char* exec_path) __objc_dynamic_init(const char* exec_path)
{ {
return 0; return 0;
} }
/* Link in the module given by the name 'module'. Return a handle which can /* Link in the module given by the name 'module'. Return a handle which can
@ -63,18 +63,18 @@ static dl_handle_t
__objc_dynamic_link(const char* module, int mode, const char* debug_file) __objc_dynamic_link(const char* module, int mode, const char* debug_file)
{ {
#ifdef RTLD_NOLOAD #ifdef RTLD_NOLOAD
/* /*
* If we've got RTLD_NOLOAD, then ask the dynamic linker first to check if * If we've got RTLD_NOLOAD, then ask the dynamic linker first to check if
* the library is already loaded. If it is, then just return a handle to * the library is already loaded. If it is, then just return a handle to
* it. If not, then load it again. * it. If not, then load it again.
*/ */
void *handle = dlopen(module, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD); void *handle = dlopen(module, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD);
if (NULL != handle) if (NULL != handle)
{ {
return handle; return handle;
} }
#endif #endif
return (dl_handle_t)dlopen(module, RTLD_LAZY | RTLD_GLOBAL); return (dl_handle_t)dlopen(module, RTLD_LAZY | RTLD_GLOBAL);
} }
/* Return the address of a symbol given by the name 'symbol' from the module /* Return the address of a symbol given by the name 'symbol' from the module
@ -87,14 +87,14 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
static dl_symbol_t static dl_symbol_t
__objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
{ {
return dlsym(handle, (char*)symbol); return dlsym(handle, (char*)symbol);
} }
/* remove the code from memory associated with the module 'handle' */ /* remove the code from memory associated with the module 'handle' */
static int static int
__objc_dynamic_unlink(dl_handle_t handle) __objc_dynamic_unlink(dl_handle_t handle)
{ {
return dlclose(handle); return dlclose(handle);
} }
/* Print an error message (prefaced by 'error_string') relevant to the /* Print an error message (prefaced by 'error_string') relevant to the
@ -103,20 +103,20 @@ __objc_dynamic_unlink(dl_handle_t handle)
static void static void
__objc_dynamic_error(FILE *error_stream, const char *error_string) __objc_dynamic_error(FILE *error_stream, const char *error_string)
{ {
fprintf(error_stream, "%s:%s\n", error_string, dlerror()); fprintf(error_stream, "%s:%s\n", error_string, dlerror());
} }
/* Debugging: define these if they are available */ /* Debugging: define these if they are available */
static int static int
__objc_dynamic_undefined_symbol_count(void) __objc_dynamic_undefined_symbol_count(void)
{ {
return 0; return 0;
} }
static char** static char**
__objc_dynamic_list_undefined_symbols(void) __objc_dynamic_list_undefined_symbols(void)
{ {
return NULL; return NULL;
} }
static inline const char * static inline const char *

View file

@ -59,14 +59,14 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
static dl_symbol_t static dl_symbol_t
__objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
{ {
return NULL; return NULL;
} }
/* remove the code from memory associated with the module 'handle' */ /* remove the code from memory associated with the module 'handle' */
static int static int
__objc_dynamic_unlink(dl_handle_t handle) __objc_dynamic_unlink(dl_handle_t handle)
{ {
return 0; return 0;
} }
static char * static char *
@ -88,13 +88,13 @@ __objc_dynamic_error(FILE *error_stream, const char *error_string)
static int static int
__objc_dynamic_undefined_symbol_count(void) __objc_dynamic_undefined_symbol_count(void)
{ {
return 0; return 0;
} }
static char** static char**
__objc_dynamic_list_undefined_symbols(void) __objc_dynamic_list_undefined_symbols(void)
{ {
return NULL; return NULL;
} }
#endif /* __sunos_load_h_INCLUDE */ #endif /* __sunos_load_h_INCLUDE */