ObjFW  Check-in [a44005ee85]

Overview
Comment:Allow throwing OFOutOfMemoryExceptions without size.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a44005ee85d839368f0b38eabea7e24346895520ca7fa16354945f80233a51a0
User & Date: js on 2010-04-04 15:35:28
Other Links: manifest | tags
Context
2010-04-04
15:45
Out of memory is way more likely for vasprintf. check-in: 43b963aba6 user: js tags: trunk
15:35
Allow throwing OFOutOfMemoryExceptions without size. check-in: a44005ee85 user: js tags: trunk
2010-04-03
01:47
Pass a default mode to open(). check-in: 0c99c954e2 user: js tags: trunk
Changes

Modified src/OFExceptions.m from [fc53fd3cfe] to [a830318935].

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

147
148
149




150
151
152
153
154
155
156
+ newWithClass: (Class)class__
	  size: (size_t)size
{
	return [[self alloc] initWithClass: class__
				      size: size];
}

- initWithClass: (Class)class__
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithClass: (Class)class__
	   size: (size_t)size
{
	self = [super initWithClass: class__];

	req_size = size;

	return self;
}

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


	string = [[OFString alloc] initWithFormat:
	    @"Could not allocate %zu bytes in class %s!", req_size,
	    [class_ className]];





	return string;
}

- (size_t)requestedSize
{
	return req_size;







<
<
<
<
<
<















>
|
|
|
>
>
>
>







119
120
121
122
123
124
125






126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
+ newWithClass: (Class)class__
	  size: (size_t)size
{
	return [[self alloc] initWithClass: class__
				      size: size];
}







- initWithClass: (Class)class__
	   size: (size_t)size
{
	self = [super initWithClass: class__];

	req_size = size;

	return self;
}

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

	if (req_size)
		string = [[OFString alloc] initWithFormat:
		    @"Could not allocate %zu bytes in class %s!", req_size,
		    [class_ className]];
	else
		string = [[OFString alloc] initWithFormat:
		    @"Could not allocate enough memory in class %s!",
		    [class_ className]];

	return string;
}

- (size_t)requestedSize
{
	return req_size;