ObjFW  Diff

Differences From Artifact [1897414e22]:

To Artifact [632b122d6b]:


16
17
18
19
20
21
22
23
24


25
26
27


28
29
30
31


32
33

34
35

36
37
38
39
40
41
42
43


44
45
46
47
48




49
50
51


52
53

54
55
56
57
58

59
60
16
17
18
19
20
21
22


23
24
25


26
27
28
29


30
31
32

33
34

35
36
37
38
39
40
41


42
43
44




45
46
47
48
49


50
51
52

53
54
55
56
57

58
59
60







-
-
+
+

-
-
+
+


-
-
+
+

-
+

-
+






-
-
+
+

-
-
-
-
+
+
+
+

-
-
+
+

-
+




-
+



#include "config.h"

#import "OFOutOfMemoryException.h"
#import "OFString.h"

@implementation OFOutOfMemoryException
+ (instancetype)exceptionWithClass: (Class)class_
		     requestedSize: (size_t)size
+ (instancetype)exceptionWithClass: (Class)class
		     requestedSize: (size_t)requestedSize
{
	return [[[self alloc] initWithClass: class_
			      requestedSize: size] autorelease];
	return [[[self alloc] initWithClass: class
			      requestedSize: requestedSize] autorelease];
}

- initWithClass: (Class)class_
  requestedSize: (size_t)size
- initWithClass: (Class)class
  requestedSize: (size_t)requestedSize
{
	self = [super initWithClass: class_];
	self = [super initWithClass: class];

	requestedSize = size;
	_requestedSize = requestedSize;

	return self;
}

- (OFString*)description
{
	if (description != nil)
		return description;
	if (_description != nil)
		return _description;

	if (requestedSize != 0)
		description = [[OFString alloc] initWithFormat:
		    @"Could not allocate %zu bytes in class %@!", requestedSize,
		    inClass];
	if (_requestedSize != 0)
		_description = [[OFString alloc] initWithFormat:
		    @"Could not allocate %zu bytes in class %@!",
		    _requestedSize, _inClass];
	else
		description = [[OFString alloc] initWithFormat:
		    @"Could not allocate enough memory in class %@!", inClass];
		_description = [[OFString alloc] initWithFormat:
		    @"Could not allocate enough memory in class %@!", _inClass];

	return description;
	return _description;
}

- (size_t)requestedSize
{
	return requestedSize;
	return _requestedSize;
}
@end