Index: src/OFPlugin.h ================================================================== --- src/OFPlugin.h +++ src/OFPlugin.h @@ -19,16 +19,16 @@ #ifndef OF_WINDOWS # include # define OF_RTLD_LAZY RTLD_LAZY # define OF_RTLD_NOW RTLD_NOW -typedef void *of_plugin_handle_t; +typedef void *OFPluginHandle; #else # include # define OF_RTLD_LAZY 0 # define OF_RTLD_NOW 0 -typedef HMODULE of_plugin_handle_t; +typedef HMODULE OFPluginHandle; #endif OF_ASSUME_NONNULL_BEGIN /** @@ -36,11 +36,11 @@ * * @brief Provides a system for loading plugins at runtime. */ @interface OFPlugin: OFObject { - of_plugin_handle_t _pluginHandle; + OFPluginHandle _pluginHandle; OF_RESERVE_IVARS(OFPlugin, 4) } /** * @brief Loads a plugin from a file. @@ -52,14 +52,14 @@ @end #ifdef __cplusplus extern "C" { #endif -extern of_plugin_handle_t of_dlopen(OFString *path, int flags); -extern void *of_dlsym(of_plugin_handle_t handle, const char *symbol); -extern OFString *_Nullable of_dlerror(void); -extern void of_dlclose(of_plugin_handle_t handle); +extern OFPluginHandle OFDlopen(OFString *path, int flags); +extern void *OFDlsym(OFPluginHandle handle, const char *symbol); +extern OFString *_Nullable OFDlerror(void); +extern void OFDlclose(OFPluginHandle handle); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -30,12 +30,12 @@ #import "OFInitializationFailedException.h" #import "OFLoadPluginFailedException.h" typedef OFPlugin *(*init_plugin_t)(void); -of_plugin_handle_t -of_dlopen(OFString *path, int flags) +OFPluginHandle +OFDlopen(OFString *path, int flags) { #ifndef OF_WINDOWS return dlopen([path cStringWithEncoding: [OFLocale encoding]], flags); #else if (path == nil) @@ -48,31 +48,31 @@ [path cStringWithEncoding: [OFLocale encoding]]); #endif } void * -of_dlsym(of_plugin_handle_t handle, const char *symbol) +OFDlsym(OFPluginHandle handle, const char *symbol) { #ifndef OF_WINDOWS return dlsym(handle, symbol); #else return (void *)(uintptr_t)GetProcAddress(handle, symbol); #endif } void -of_dlclose(of_plugin_handle_t handle) +OFDlclose(OFPluginHandle handle) { #ifndef OF_WINDOWS dlclose(handle); #else FreeLibrary(handle); #endif } OFString * -of_dlerror(void) +OFDlerror(void) { #ifndef OF_WINDOWS return [OFString stringWithCString: dlerror() encoding: [OFLocale encoding]]; #else @@ -82,11 +82,11 @@ @implementation OFPlugin + (id)pluginWithPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); - of_plugin_handle_t handle; + OFPluginHandle handle; init_plugin_t initPlugin; OFPlugin *plugin; #if defined(OF_MACOS) path = [path stringByAppendingFormat: @".bundle/Contents/MacOS/%@", @@ -96,20 +96,20 @@ path.lastPathComponent]; #else path = [path stringByAppendingString: @PLUGIN_SUFFIX]; #endif - if ((handle = of_dlopen(path, OF_RTLD_LAZY)) == NULL) + if ((handle = OFDlopen(path, OF_RTLD_LAZY)) == NULL) @throw [OFLoadPluginFailedException exceptionWithPath: path - error: of_dlerror()]; + error: OFDlerror()]; objc_autoreleasePoolPop(pool); - initPlugin = (init_plugin_t)(uintptr_t)of_dlsym(handle, "init_plugin"); + initPlugin = (init_plugin_t)(uintptr_t)OFDlsym(handle, "init_plugin"); if (initPlugin == (init_plugin_t)0 || (plugin = initPlugin()) == nil) { - of_dlclose(handle); + OFDlclose(handle); @throw [OFInitializationFailedException exceptionWithClass: self]; } plugin->_pluginHandle = handle; @@ -132,12 +132,12 @@ return [super init]; } - (void)dealloc { - of_plugin_handle_t h = _pluginHandle; + OFPluginHandle h = _pluginHandle; [super dealloc]; - of_dlclose(h); + OFDlclose(h); } @end Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -283,11 +283,11 @@ { if (self != [OFHTTP class]) return; /* Opportunistically try loading ObjOpenSSL and ignore any errors. */ - of_dlopen(@LIB_PREFIX @"objopenssl" @LIB_SUFFIX, OF_RTLD_LAZY); + OFDlopen(@LIB_PREFIX @"objopenssl" @LIB_SUFFIX, OF_RTLD_LAZY); } #endif - (instancetype)init {