ObjFW  Check-in [0340b72d43]

Overview
Comment:Allow OFNoMemException and OFOverflowException to have obj == nil.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0340b72d43fe4895622915373f559395f4cbf0dbd94850139ec763113046f98b
User & Date: js on 2008-10-25 23:53:55
Other Links: manifest | tags
Context
2008-10-25
23:59
Cleaner return in atEndOfFile. check-in: 14c872dbfd user: js tags: trunk
23:53
Allow OFNoMemException and OFOverflowException to have obj == nil. check-in: 0340b72d43 user: js tags: trunk
23:46
Remove -fconstant-string-class. check-in: b405f355be user: js tags: trunk
Changes

Modified src/OFExceptions.m from [aa5a117197] to [2ecf3b040e].

10
11
12
13
14
15
16

17
18
19
20
21
22
23
 */

#import "config.h"

#define _GNU_SOURCE
#import <stdio.h>
#import <stdlib.h>


#import <objc/objc-api.h>

#import "OFExceptions.h"

#if defined HAVE_SEL_GET_NAME
#define SEL_NAME(x) sel_get_name(x)







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 */

#import "config.h"

#define _GNU_SOURCE
#import <stdio.h>
#import <stdlib.h>
#import <string.h>

#import <objc/objc-api.h>

#import "OFExceptions.h"

#if defined HAVE_SEL_GET_NAME
#define SEL_NAME(x) sel_get_name(x)
65
66
67
68
69
70
71
72

73
74




75
76
77
78
79
80
81
	return [[OFNoMemException alloc] initWithObject: obj
						andSize: size];
}

- initWithObject: (id)obj
	 andSize: (size_t)size
{
	if ((self = [super init]))

		asprintf(&errstr, "ERROR: Could not allocate %zu bytes for "
		    "object of class %s!\n", size, [obj name]);





	return self;
}
@end

@implementation OFNotImplementedException
+ newWithObject: (id)obj







|
>
|
|
>
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	return [[OFNoMemException alloc] initWithObject: obj
						andSize: size];
}

- initWithObject: (id)obj
	 andSize: (size_t)size
{
	if ((self = [super init])) {
		if (obj != nil)
			asprintf(&errstr, "ERROR: Could not allocate %zu bytes "
			    "for object of class %s!\n", size, [obj name]);
		else
			asprintf(&errstr, "ERROR: Could not allocate %zu bytes "
			    "for object of class (null)!\n", size);
	}

	return self;
}
@end

@implementation OFNotImplementedException
+ newWithObject: (id)obj
123
124
125
126
127
128
129
130

131
132




133
134
135
136
137
138
139
+ newWithObject: (id)obj
{
	return [[OFOverflowException alloc] initWithObject: obj];
}

- initWithObject: (id)obj
{
	if ((self = [super init]))

		asprintf(&errstr, "ERROR: Overflow in object of class %s!\n",
		    [obj name]);





	return self;
}
@end

@implementation OFOpenFileFailedException
+ newWithObject: (id)obj







|
>
|
|
>
>
>
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
+ newWithObject: (id)obj
{
	return [[OFOverflowException alloc] initWithObject: obj];
}

- initWithObject: (id)obj
{
	if ((self = [super init])) {
		if (obj != nil)
			asprintf(&errstr, "ERROR: Overflow in object of class "
			    "%s!\n", [obj name]);
		else
			errstr = strdup("ERROR: Overflow in object of class "
			    "(null)!\n");
	}

	return self;
}
@end

@implementation OFOpenFileFailedException
+ newWithObject: (id)obj