mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
([CString -initWithCStringNoCopy:freeWhenDone:]): New method.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@757 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
456af2488a
commit
b6e25349a0
1 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/* Implementation for GNU Objective-C CString object
|
||||
Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993,1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: July 1994
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
@implementation CString
|
||||
|
||||
/* This is the designated initializer for this class */
|
||||
/* These next two methods are the two designated initializers for this class */
|
||||
- initWithCString: (const char*)aCharPtr range: (IndexRange)aRange
|
||||
{
|
||||
[super initWithType:@encode(char)];
|
||||
|
@ -40,6 +40,15 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- initWithCStringNoCopy: (const char*)aCharPtr freeWhenDone: (BOOL)f
|
||||
{
|
||||
[super initWithType:@encode(char)];
|
||||
_count = strlen(aCharPtr);
|
||||
_contents_chars = aCharPtr;
|
||||
_free_contents = f;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (_free_contents)
|
||||
|
|
Loading…
Reference in a new issue