ObjFW  Check-in [69b468f9f2]

Overview
Comment:Free the list in the dictionary when the last object in it was removed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 69b468f9f24eb79f6e52b86678531c24aadb6ae118eec2fdf23c74e53c9588a7
User & Date: js on 2009-04-23 12:07:51
Other Links: manifest | tags
Context
2009-04-23
12:19
Add OFIterator to iterate through an OFDictionary. check-in: cd08bff565 user: js tags: trunk
12:07
Free the list in the dictionary when the last object in it was removed. check-in: 69b468f9f2 user: js tags: trunk
2009-04-22
22:43
gcc seems to accept a @throw instead of a return as well. check-in: 8dbc052d49 user: js tags: trunk
Changes

Modified src/OFDictionary.m from [e981a8bffe] to [2b0561f376].

130
131
132
133
134
135
136





137
138
139
140
141
142
143
	if (data[hash] == nil)
		@throw [OFNotInSetException newWithClass: isa];

	for (iter = [data[hash] first]; iter != NULL; iter = iter->next->next) {
		if ([iter->object isEqual: key]) {
			[data[hash] remove: iter->next];
			[data[hash] remove: iter];






			return self;
		}
	}

	@throw [OFNotInSetException newWithClass: isa];
}







>
>
>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	if (data[hash] == nil)
		@throw [OFNotInSetException newWithClass: isa];

	for (iter = [data[hash] first]; iter != NULL; iter = iter->next->next) {
		if ([iter->object isEqual: key]) {
			[data[hash] remove: iter->next];
			[data[hash] remove: iter];

			if ([data[hash] first] == NULL) {
				[data[hash] release];
				data[hash] = nil;
			}

			return self;
		}
	}

	@throw [OFNotInSetException newWithClass: isa];
}