Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -564,10 +564,17 @@ * * @return The allocated object */ + (instancetype)alloc; +/*! + * @brief Calls @ref alloc on `self` and then `init` on the returned object. + * + * @return An allocated and initialized object + */ ++ (instancetype)new; + /*! * @brief Returns the class. * * @return The class */ Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -283,10 +283,15 @@ + (instancetype)alloc { return of_alloc_object(self, 0, 0, NULL); } + ++ (instancetype)new +{ + return [[self alloc] init]; +} + (Class)class { return self; }