Revision: 5132
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5132&view=rev
Author:   hofman
Date:     2009-01-20 11:32:16 +0000 (Tue, 20 Jan 2009)

Log Message:
-----------
no real need to cache separate name and data for rich text specifier

Modified Paths:
--------------
    trunk/SKRichTextFormat.h
    trunk/SKRichTextFormat.m

Modified: trunk/SKRichTextFormat.h
===================================================================
--- trunk/SKRichTextFormat.h    2009-01-20 10:13:29 UTC (rev 5131)
+++ trunk/SKRichTextFormat.h    2009-01-20 11:32:16 UTC (rev 5132)
@@ -41,7 +41,6 @@
 
 @interface SKRichTextFormat : NSObject {
     NSData *data;
-    NSString *name;
 }
 
 - (id)initWithData:(NSData *)aData;

Modified: trunk/SKRichTextFormat.m
===================================================================
--- trunk/SKRichTextFormat.m    2009-01-20 10:13:29 UTC (rev 5131)
+++ trunk/SKRichTextFormat.m    2009-01-20 11:32:16 UTC (rev 5132)
@@ -46,7 +46,6 @@
     if (self = [super init]) {
         if (aData) {
             data = [aData retain];
-            name = nil;
         } else {
             [self release];
             self = nil;
@@ -56,21 +55,14 @@
 }
 
 - (id)initWithName:(NSString *)aName {
-    if (self = [super init]) {
-        if (aName) {
-            name = [aName retain];
-            data = nil;
-        } else {
-            [self release];
-            self = nil;
-        }
-    }
+    NSData *aData = [[NSData alloc] initWithBase64String:aName 
withNewlines:NO];
+    self = [self initWithData:aData];
+    [aData release];
     return self;
 }
 
 - (void)dealloc {
     [data release];
-    [name release];
     [super dealloc];
 }
 
@@ -80,15 +72,11 @@
 }
 
 - (NSString *)name {
-    if (name == nil)
-        name = [[data base64StringWithNewlines:NO] retain];
-    return name;
+    return [data base64StringWithNewlines:NO];
 }
 
 - (NSTextStorage *)richText {
-    if (data == nil)
-        data = [[NSData alloc] initWithBase64String:name withNewlines:NO];
-    return data ? [[[NSTextStorage alloc] initWithRTF:data 
documentAttributes:nil] autorelease] : nil;
+    return [[[NSTextStorage alloc] initWithRTF:data documentAttributes:nil] 
autorelease];
 }
 
 @end


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to