@@ -23,14 +23,15 @@ #include #endif #import "OFPlugin.h" #import "OFString.h" -#import "OFAutoreleasePool.h" #import "OFInitializationFailedException.h" #import "OFNotImplementedException.h" + +#import "autorelease.h" #ifdef _WIN32 # define dlopen(file, mode) LoadLibrary(file) # define dlsym(handle, symbol) GetProcAddress(handle, symbol) # define dlclose(handle) FreeLibrary(handle) @@ -37,26 +38,25 @@ #endif @implementation OFPlugin + (id)pluginFromFile: (OFString*)path { - OFAutoreleasePool *pool; + void *pool = objc_autoreleasePoolPush(); OFMutableString *file; of_plugin_handle_t handle; OFPlugin *(*initPlugin)(void); OFPlugin *plugin; - pool = [[OFAutoreleasePool alloc] init]; file = [OFMutableString stringWithString: path]; [file appendString: @PLUGIN_SUFFIX]; if ((handle = dlopen([file cStringWithEncoding: OF_STRING_ENCODING_NATIVE], RTLD_LAZY)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; - [pool release]; + objc_autoreleasePoolPop(pool); *(void**)&initPlugin = dlsym(handle, "init_plugin"); if (initPlugin == NULL || (plugin = initPlugin()) == nil) { dlclose(handle); @throw [OFInitializationFailedException