Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -47,11 +47,10 @@ #import "OFAllocFailedException.h" #import "OFEnumerationMutationException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" -#import "OFMemoryNotPartOfObjectException.h" #import "OFNotImplementedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #if defined(OF_APPLE_RUNTIME) && __OBJC2__ Index: src/ObjFW.h ================================================================== --- src/ObjFW.h +++ src/ObjFW.h @@ -198,11 +198,10 @@ #ifdef OF_HAVE_PLUGINS # import "OFLoadPluginFailedException.h" #endif #import "OFLockFailedException.h" #import "OFMalformedXMLException.h" -#import "OFMemoryNotPartOfObjectException.h" #import "OFMoveItemFailedException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #ifdef OF_HAVE_SOCKETS # import "OFObserveFailedException.h" Index: src/exceptions/Makefile ================================================================== --- src/exceptions/Makefile +++ src/exceptions/Makefile @@ -21,11 +21,10 @@ OFInvalidJSONException.m \ OFInvalidServerReplyException.m \ OFLinkFailedException.m \ OFLockFailedException.m \ OFMalformedXMLException.m \ - OFMemoryNotPartOfObjectException.m \ OFMoveItemFailedException.m \ OFNotImplementedException.m \ OFNotOpenException.m \ OFOpenItemFailedException.m \ OFOutOfMemoryException.m \ DELETED src/exceptions/OFMemoryNotPartOfObjectException.h Index: src/exceptions/OFMemoryNotPartOfObjectException.h ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.h +++ src/exceptions/OFMemoryNotPartOfObjectException.h @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2008-2022 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFException.h" - -OF_ASSUME_NONNULL_BEGIN - -/** - * @class OFMemoryNotPartOfObjectException \ - * OFMemoryNotPartOfObjectException.h \ - * ObjFW/OFMemoryNotPartOfObjectException.h - * - * @brief An exception indicating the given memory is not part of the object. - */ -@interface OFMemoryNotPartOfObjectException: OFException -{ - void *_Nullable _pointer; - id _object; -} - -/** - * @brief A pointer to the memory which is not part of the object. - */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *pointer; - -/** - * @brief The object which the memory is not part of. - */ -@property (readonly, nonatomic) id object; - -+ (instancetype)exception OF_UNAVAILABLE; - -/** - * @brief Creates a new, autoreleased memory not part of object exception. - * - * @param pointer A pointer to the memory that is not part of the object - * @param object The object which the memory is not part of - * @return A new, autoreleased memory not part of object exception - */ -+ (instancetype)exceptionWithPointer: (nullable void *)pointer - object: (id)object; - -- (instancetype)init OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated memory not part of object exception. - * - * @param pointer A pointer to the memory that is not part of the object - * @param object The object which the memory is not part of - * @return An initialized memory not part of object exception - */ -- (instancetype)initWithPointer: (nullable void *)pointer - object: (id)object OF_DESIGNATED_INITIALIZER; -@end - -OF_ASSUME_NONNULL_END DELETED src/exceptions/OFMemoryNotPartOfObjectException.m Index: src/exceptions/OFMemoryNotPartOfObjectException.m ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.m +++ src/exceptions/OFMemoryNotPartOfObjectException.m @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2008-2022 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#import "OFMemoryNotPartOfObjectException.h" -#import "OFString.h" - -@implementation OFMemoryNotPartOfObjectException -@synthesize pointer = _pointer, object = _object; - -+ (instancetype)exception -{ - OF_UNRECOGNIZED_SELECTOR -} - -+ (instancetype)exceptionWithPointer: (void *)pointer object: (id)object -{ - return [[[self alloc] initWithPointer: pointer - object: object] autorelease]; -} - -- (instancetype)init -{ - OF_INVALID_INIT_METHOD -} - -- (instancetype)initWithPointer: (void *)pointer object: (id)object -{ - self = [super init]; - - _pointer = pointer; - _object = [object retain]; - - return self; -} - -- (void)dealloc -{ - [_object release]; - - [super dealloc]; -} - -- (OFString *)description -{ - return [OFString stringWithFormat: - @"Deallocation or reallocation of memory not allocated as part of " - @"object of type %@ was attempted! It is also possible that there " - @"was an attempt to free the same memory twice.", - [_object class]]; -} -@end