From 746f2a2a1a70940a87882d2470c34ae3ebcf1bd4 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Tue, 23 Jan 2018 16:17:57 +0000 Subject: [PATCH] ndentation fixups --- Source/hpux-load.h | 24 ++++++++++++------------ Source/null-load.h | 14 +++++++------- Source/objc-load.m | 26 ++++++++++++++------------ Source/simple-load.h | 34 +++++++++++++++++----------------- Source/win32-load.h | 8 ++++---- 5 files changed, 54 insertions(+), 52 deletions(-) diff --git a/Source/hpux-load.h b/Source/hpux-load.h index d9800ca84..9afe42823 100644 --- a/Source/hpux-load.h +++ b/Source/hpux-load.h @@ -39,7 +39,7 @@ typedef void* dl_symbol_t; static int __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 @@ -48,7 +48,7 @@ __objc_dynamic_init(const char* exec_path) static dl_handle_t __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 @@ -61,19 +61,19 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) static dl_symbol_t __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) { - int ok; - void *value; - ok = shl_findsym(&handle, symbol, TYPE_UNDEFINED, value); - if (ok != 0) - value = 0; - return value; + int ok; + void *value; + ok = shl_findsym(&handle, symbol, TYPE_UNDEFINED, value); + if (ok != 0) + value = 0; + return value; } /* remove the code from memory associated with the module 'handle' */ static int __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 @@ -82,20 +82,20 @@ __objc_dynamic_unlink(dl_handle_t handle) static void __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 */ static int __objc_dynamic_undefined_symbol_count(void) { - return 0; + return 0; } static char** __objc_dynamic_list_undefined_symbols(void) { - return NULL; + return NULL; } // TODO: search for an hp-ux equivalent of dladdr() */ diff --git a/Source/null-load.h b/Source/null-load.h index 721af11d9..81081d4e8 100644 --- a/Source/null-load.h +++ b/Source/null-load.h @@ -33,7 +33,7 @@ typedef void* dl_symbol_t; static int __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 @@ -42,7 +42,7 @@ __objc_dynamic_init(const char* exec_path) static dl_handle_t __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 @@ -55,14 +55,14 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) static dl_symbol_t __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' */ static int __objc_dynamic_unlink(dl_handle_t handle) { - return 0; + return 0; } /* Print an error message (prefaced by 'error_string') relevant to the @@ -71,20 +71,20 @@ __objc_dynamic_unlink(dl_handle_t handle) static void __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 */ static int __objc_dynamic_undefined_symbol_count(void) { - return 0; + return 0; } static char** __objc_dynamic_list_undefined_symbols(void) { - return NULL; + return NULL; } static char * diff --git a/Source/objc-load.m b/Source/objc-load.m index b0da8df4e..84fdb2d76 100644 --- a/Source/objc-load.m +++ b/Source/objc-load.m @@ -266,15 +266,17 @@ GSPrivateSymbolPath(Class theClass, Category *theCategory) #elif LINKER_GETSYMBOL NSString *GSPrivateSymbolPath(Class theClass, Category *theCategory) { - void *addr = (NULL == theCategory) ? (void*)theClass : (void*)theCategory; - Dl_info info; - // This is correct: dladdr() does the opposite thing to all other UNIX - // functions. - if (0 == dladdr(addr, &info)) - { - return nil; - } - return [NSString stringWithUTF8String: info.dli_fname]; + void *addr = (NULL == theCategory) ? (void*)theClass : (void*)theCategory; + Dl_info info; + + /* This is correct: dladdr() does the opposite thing to all other UNIX + * functions. + */ + if (0 == dladdr(addr, &info)) + { + return nil; + } + return [NSString stringWithUTF8String: info.dli_fname]; } #else NSString * @@ -299,7 +301,7 @@ GSPrivateSymbolPath(Class theClass, Category *theCategory) } 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 { @@ -318,10 +320,10 @@ GSPrivateSymbolPath(Class theClass, Category *theCategory) memcpy(p, "__objc_category_name_", sizeof(char)*21); 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)], theCategory->category_name, - strlen(theCategory->category_name) + 1); + strlen(theCategory->category_name) + 1); } ret = __objc_dynamic_get_symbol_path(0, p); diff --git a/Source/simple-load.h b/Source/simple-load.h index 347643bc5..4f9040c28 100644 --- a/Source/simple-load.h +++ b/Source/simple-load.h @@ -53,7 +53,7 @@ typedef void* dl_symbol_t; static int __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 @@ -63,18 +63,18 @@ static dl_handle_t __objc_dynamic_link(const char* module, int mode, const char* debug_file) { #ifdef RTLD_NOLOAD - /* - * 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 - * it. If not, then load it again. - */ - void *handle = dlopen(module, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD); - if (NULL != handle) - { - return handle; - } + /* + * 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 + * it. If not, then load it again. + */ + void *handle = dlopen(module, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD); + if (NULL != handle) + { + return handle; + } #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 @@ -87,14 +87,14 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) static dl_symbol_t __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' */ static int __objc_dynamic_unlink(dl_handle_t handle) { - return dlclose(handle); + return dlclose(handle); } /* Print an error message (prefaced by 'error_string') relevant to the @@ -103,20 +103,20 @@ __objc_dynamic_unlink(dl_handle_t handle) static void __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 */ static int __objc_dynamic_undefined_symbol_count(void) { - return 0; + return 0; } static char** __objc_dynamic_list_undefined_symbols(void) { - return NULL; + return NULL; } static inline const char * diff --git a/Source/win32-load.h b/Source/win32-load.h index 172d5f851..d379641e9 100644 --- a/Source/win32-load.h +++ b/Source/win32-load.h @@ -59,14 +59,14 @@ __objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol) static dl_symbol_t __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' */ static int __objc_dynamic_unlink(dl_handle_t handle) { - return 0; + return 0; } static char * @@ -88,13 +88,13 @@ __objc_dynamic_error(FILE *error_stream, const char *error_string) static int __objc_dynamic_undefined_symbol_count(void) { - return 0; + return 0; } static char** __objc_dynamic_list_undefined_symbols(void) { - return NULL; + return NULL; } #endif /* __sunos_load_h_INCLUDE */