hi folks,

I think we should not introduce a lot more IMPs in GSWeb than we now have.
There are other areas that should be addressed.

This is a example of a potential thing that could be faster.
If somebody uses cString it is likely that he also uses cStringLength on the 
same string.
Both does basically the same. Has somebody an idea how to optimize here?

- (const char*) cString
{
  NSData        *d;
  NSMutableData *m;

  d = [self dataUsingEncoding: _DefaultStringEncoding
         allowLossyConversion: NO];
  if (d == nil)
    {
      [NSException raise: NSCharacterConversionException
                  format: @"unable to convert to cString"];
    }
  m = [d mutableCopy];
  [m appendBytes: "" length: 1];
  AUTORELEASE(m);
  return (const char*)[m bytes];
}

- (unsigned int) cStringLength
{
  NSData        *d;

  d = [self dataUsingEncoding: _DefaultStringEncoding
         allowLossyConversion: NO];
  return [d length];
}


dave

---
   _  _
 _(_)(_)_  David Wetzel, Turbocat's Development,
(_) __ (_) Buchhorster Strasse 23, D-16567 Muehlenbeck/Berlin, FRG,
  _/  \_   Fax +49 33056 82835 Phone +49 33056 82834
 (______)  http://www.turbocat.de/



_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to