Differences From Artifact [3c7d0ee24e]:
- File
src/OFString.m
— part of check-in
[139591afe1]
at
2009-04-19 20:34:38
on branch trunk
— Use isa instead of [self class].
Since we don't use Object anymore and define isa in OFObject, we can
rely on it. (user: js, size: 9160) [annotate] [blame] [check-ins using]
To Artifact [881fc1c877]:
- File src/OFString.m — part of check-in [d87df02e8b] at 2009-04-21 17:16:23 on branch trunk — The if ((self = [super init])) construct isn't needed anymore. (user: js, size: 9079) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
132 133 134 135 136 137 138 | { return [[[OFString alloc] initWithFormat: fmt andArguments: args] autorelease]; } - init { | | > | | | < | > | | | | | | | | | | | | < | 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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | { return [[[OFString alloc] initWithFormat: fmt andArguments: args] autorelease]; } - init { [super init]; length = 0; string = NULL; is_utf8 = NO; return self; } - initWithCString: (const char*)str { Class c; self = [super init]; if (str != NULL) { length = strlen(str); switch (check_utf8(str, length)) { case 1: is_utf8 = YES; break; case -1: c = isa; [super free]; @throw [OFInvalidEncodingException newWithClass: c]; } @try { string = [self getMemWithSize: length + 1]; } @catch (OFException *e) { [self free]; @throw e; } memcpy(string, str, length + 1); } return self; } - initWithFormat: (const char*)fmt, ... { |
︙ | ︙ | |||
192 193 194 195 196 197 198 | - initWithFormat: (const char*)fmt andArguments: (va_list)args { int t; Class c; | | > | | | | | | | | | < | | | | | | | | | < | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | - initWithFormat: (const char*)fmt andArguments: (va_list)args { int t; Class c; self = [super init]; if (fmt == NULL) { c = isa; [super free]; @throw [OFInvalidFormatException newWithClass: c]; } if ((t = vasprintf(&string, fmt, args)) == -1) { c = isa; [super free]; @throw [OFInitializationFailedException newWithClass: c]; } length = t; switch (check_utf8(string, length)) { case 1: is_utf8 = YES; break; case -1: free(string); c = isa; [super free]; @throw [OFInvalidEncodingException newWithClass: c]; } @try { [self addToMemoryPool: string]; } @catch (OFException *e) { free(string); @throw e; } return self; } - (const char*)cString { |
︙ | ︙ |