Artifact 35f5f8dc9157a2de0d768f5fb2d3bea1942fdd37db44146a71087772631c8945:
- File
src/OFConstCString.m
— part of check-in
[7a49441656]
at
2008-10-09 00:25:31
on branch trunk
— Multiple changes, see details.
* Use config.h.
* Check whether to use sel_get_name or sel_getName.
* Rename freeWithData to freeIncludingData. (user: js, size: 786) [annotate] [blame] [check-ins using]
/* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "config.h" #import <string.h> #import "OFConstCString.h" @implementation OFConstCString - initWithConstCString: (const char*)str { if ((self = [super init])) { if (str == NULL) { length = 0; string = NULL; } else { length = strlen(str); string = str; } } return self; } - (const char*)cString { return string; } - (OFString*)clone { return [OFString newWithConstCString: string]; } - (int)compareTo: (OFString*)str { return strcmp(string, [str cString]); } @end