mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Tiny optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14806 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
49c2f8a4e5
commit
9171702fe6
2 changed files with 25 additions and 4 deletions
|
@ -2314,7 +2314,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
char c;
|
||||
BOOL unwrappingComplete = NO;
|
||||
|
||||
lineStart = lineEnd;
|
||||
lineStart = lineEnd = input;
|
||||
NSDebugMLLog(@"GSMimeH", @"entry: input:%u dataEnd:%u lineStart:%u '%*.*s'",
|
||||
input, dataEnd, lineStart, dataEnd - input, dataEnd - input, &bytes[input]);
|
||||
/*
|
||||
|
@ -2329,6 +2329,8 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
|
||||
if ((c = bytes[pos]) != '\r' && c != '\n')
|
||||
{
|
||||
unsigned end;
|
||||
|
||||
while (pos < dataEnd && (c = bytes[pos]) != '\r' && c != '\n')
|
||||
{
|
||||
pos++;
|
||||
|
@ -2337,6 +2339,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
{
|
||||
break; /* need more data */
|
||||
}
|
||||
end = pos;
|
||||
pos++;
|
||||
if (c == '\r' && pos < dataEnd && bytes[pos] == '\n')
|
||||
{
|
||||
|
@ -2347,11 +2350,18 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
break; /* need more data */
|
||||
}
|
||||
/*
|
||||
* Copy data up to end of line, and skip past end.
|
||||
* Copy data up to end of line ... skip the copy where possible.
|
||||
*/
|
||||
while (input < dataEnd && (c = bytes[input]) != '\r' && c != '\n')
|
||||
if (input == lineEnd)
|
||||
{
|
||||
bytes[lineEnd++] = bytes[input++];
|
||||
input = lineEnd = end;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (input < dataEnd && (c = bytes[input]) != '\r' && c != '\n')
|
||||
{
|
||||
bytes[lineEnd++] = bytes[input++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2298,6 +2298,12 @@ handle_printf_atsign (FILE *stream,
|
|||
return [d length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the contents of the receiver into the buffer.<br />
|
||||
* The buffer must be large enought to contain the CString representation
|
||||
* of the characters in the receiver, plus a null terminator which this
|
||||
* method adds.
|
||||
*/
|
||||
- (void) getCString: (char*)buffer
|
||||
{
|
||||
[self getCString: buffer maxLength: NSMaximumStringLength
|
||||
|
@ -2305,6 +2311,11 @@ handle_printf_atsign (FILE *stream,
|
|||
remainingRange: NULL];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve up to maxLength characters from the receiver into the buffer.<br />
|
||||
* The buffer must be at least maxLength characters long, so that it has
|
||||
* room for the null terminator that this method adds.
|
||||
*/
|
||||
- (void) getCString: (char*)buffer
|
||||
maxLength: (unsigned int)maxLength
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue