Bug 442714 - Mark NS_STACK_CLASS on nsAutoString, r=dbaron
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 30 Jun 2008 14:46:47 -0400
changeset 15589 2a894be5a1b619ca34d19b5222142221eb3931e9
parent 15588 91aa2d65f92d548c3688e0baff8bff3ecea0137d
child 15590 9821bc3cf2371b1f8cf00c914b54529321e52f0b
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs442714
milestone1.9.1a1pre
Bug 442714 - Mark NS_STACK_CLASS on nsAutoString, r=dbaron
intl/uconv/src/nsScriptableUConv.h
modules/libpref/src/nsPrefBranch.h
netwerk/base/src/nsDirectoryIndexStream.h
netwerk/streamconv/converters/nsFTPDirListingConv.h
xpcom/string/public/nsTString.h
--- a/intl/uconv/src/nsScriptableUConv.h
+++ b/intl/uconv/src/nsScriptableUConv.h
@@ -49,19 +49,17 @@ class nsScriptableUnicodeConverter : pub
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISCRIPTABLEUNICODECONVERTER
 
   nsScriptableUnicodeConverter();
   virtual ~nsScriptableUnicodeConverter();
 
 protected:
-  // charsets are ALWAYS very short, so its actually better to use
-  // nsCAutoString here
-  nsCAutoString mCharset;
+  nsCString mCharset;
   nsCOMPtr<nsIUnicodeEncoder> mEncoder;
   nsCOMPtr<nsIUnicodeDecoder> mDecoder;
 
   nsresult FinishWithLength(char **_retval, PRInt32* aLength);
   nsresult ConvertFromUnicodeWithLength(const nsAString& aSrc,
                                         PRInt32* aOutLen,
                                         char **_retval);
 
--- a/modules/libpref/src/nsPrefBranch.h
+++ b/modules/libpref/src/nsPrefBranch.h
@@ -116,11 +116,10 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRELATIVEFILEPREF
   
                 nsRelativeFilePref();
   virtual       ~nsRelativeFilePref();
   
 private:
   nsCOMPtr<nsILocalFile> mFile;
-  nsCAutoString mRelativeToKey; // An nsCAutoString because length is always very short.
-                                // While this makes the object larger, avoids allocation.
+  nsCString mRelativeToKey;
 };
--- a/netwerk/base/src/nsDirectoryIndexStream.h
+++ b/netwerk/base/src/nsDirectoryIndexStream.h
@@ -43,17 +43,17 @@
 #include "nsIInputStream.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsITextToSubURI.h"
 
 class nsDirectoryIndexStream : public nsIInputStream
 {
 private:
-    nsCAutoString mBuf;
+    nsCString mBuf;
     PRInt32 mOffset;
     nsresult mStatus;
 
     PRInt32             mPos;   // position within mArray
     nsCOMArray<nsIFile> mArray; // file objects within the directory
 
     nsDirectoryIndexStream();
     /**
--- a/netwerk/streamconv/converters/nsFTPDirListingConv.h
+++ b/netwerk/streamconv/converters/nsFTPDirListingConv.h
@@ -72,15 +72,15 @@ public:
     nsresult Init();
 
 private:
     // Get the application/http-index-format headers
     nsresult GetHeaders(nsACString& str, nsIURI* uri);
     char*    DigestBufferLines(char *aBuffer, nsCString &aString);
 
     // member data
-    nsCAutoString       mBuffer;            // buffered data.
+    nsCString           mBuffer;            // buffered data.
     PRBool              mSentHeading;       // have we sent 100, 101, 200, and 300 lines yet?
 
     nsIStreamListener   *mFinalListener; // this guy gets the converted data via his OnDataAvailable()
 };
 
 #endif /* __nsftpdirlistingdconv__h__ */
--- a/xpcom/string/public/nsTString.h
+++ b/xpcom/string/public/nsTString.h
@@ -482,17 +482,17 @@ class nsTFixedString_CharT : public nsTS
 
 
   /**
    * nsTAutoString_CharT
    *
    * Subclass of nsTString_CharT that adds support for stack-based string
    * allocation.  Do not allocate this class on the heap! ;-)
    */
-class nsTAutoString_CharT : public nsTFixedString_CharT
+class NS_STACK_CLASS nsTAutoString_CharT : public nsTFixedString_CharT
   {
     public:
 
       typedef nsTAutoString_CharT    self_type;
 
     public:
 
         /**
@@ -626,17 +626,17 @@ class nsTXPIDLString_CharT : public nsTS
    *    
    *    void some_function()
    *    {
    *      nsXPIDLCString blah;
    *      GetBlah(getter_Copies(blah));
    *      // ...
    *    }
    */
-class nsTGetterCopies_CharT
+class NS_STACK_CLASS nsTGetterCopies_CharT
   {
     public:
       typedef CharT char_type;
 
       nsTGetterCopies_CharT(nsTSubstring_CharT& str)
         : mString(str), mData(nsnull) {}
 
       ~nsTGetterCopies_CharT()