Closed
Bug 230633
Opened 21 years ago
Closed 21 years ago
Constify Transformiix code a bit
Categories
(Core :: XSLT, defect)
Core
XSLT
Tracking
()
RESOLVED
FIXED
People
(Reporter: peterv, Assigned: peterv)
Details
Attachments
(4 files, 1 obsolete file)
24.31 KB,
patch
|
axel
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
21.85 KB,
patch
|
sicking
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
45.38 KB,
patch
|
Details | Diff | Splinter Review | |
569 bytes,
patch
|
peterv
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
I've contified some data in Transformiix, I've also moved to the new XPCOM static atoms. Here's what size shows: Trunk Segment __TEXT: 679936 Segment __DATA: 69632 Segment __LINKEDIT: 487424 total 1236992 With constify patch Segment __TEXT: 679936 Segment __DATA: 61440 Segment __LINKEDIT: 487424 total 1228800 With atoms patch Segment __TEXT: 663552 Segment __DATA: 65536 Segment __LINKEDIT: 491520 total 1220608
Assignee | ||
Comment 1•21 years ago
|
||
Assignee | ||
Comment 2•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #138807 -
Flags: review?(bugmail)
Assignee | ||
Updated•21 years ago
|
Attachment #138808 -
Flags: review?(axel)
Assignee | ||
Comment 3•21 years ago
|
||
Actually, nevermind the constify patch v1. It doesn't work, I'll attach a new one. Here's the numbers with atoms and the new constify patch: Segment __TEXT: 659456 Segment __DATA: 65536 Segment __LINKEDIT: 491520 total 1216512
Assignee | ||
Updated•21 years ago
|
Attachment #138807 -
Attachment is obsolete: true
Attachment #138807 -
Flags: review?(bugmail)
Assignee | ||
Comment 4•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #138816 -
Flags: review?(bugmail)
Comment 5•21 years ago
|
||
Comment on attachment 138808 [details] [diff] [review] Static atoms patch v1 AFAICT, +static const nsStaticAtom XMLAtoms_info[] = { +#define TX_ATOM(name_, value_) { value_, &txXMLAtoms::name_ }, +XML_ATOMS +#undef TX_ATOM +}; leaves us with a { {foo, &txXSLTAtoms::foo}, {bar, &txXSLTAtoms::bar}, } Note the trailing , in the last entry, does that compile cross platform? IIRC it does not for enums or so.
Assignee | ||
Comment 6•21 years ago
|
||
I copied that from the layout atoms (see for example nsHTMLAtoms: http://lxr.mozilla.org/seamonkey/source/content/shared/src/nsHTMLAtoms.cpp#47), and it certainly seems to be compiling there :-).
Comment 7•21 years ago
|
||
Comment on attachment 138808 [details] [diff] [review] Static atoms patch v1 >Index: source/base/txStringUtils.cpp >+PRBool >+TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom) >+{ >+ const char* atom; >+ aAtom->GetUTF8String(&atom); >+ >+ PRUint32 ASCIILength = strlen(atom); >+ nsDependentCString ASCIIString(atom, ASCIILength); This string ain't needed, drop ASCIIIter and just use atom. Or rename it atomchar or so. >+ >+ PRUint32 UTF16Length = aString.Length(); >+ if (ASCIILength != UTF16Length) { >+ return PR_FALSE; >+ } >+ >+ const char* ASCIIIter; >+ ASCIIString.BeginReading(ASCIIIter); >+ >+ const PRUnichar* UTF16Iter; >+ aString.BeginReading(UTF16Iter); >+ >+ while (ASCIIIter) { >+ if (PRUnichar(*ASCIIIter) != *UTF16Iter) { >+ return PR_FALSE; >+ } >+ ++ASCIIIter; >+ ++UTF16Iter; >+ } >+ >+ return PR_TRUE; >+} >+
Attachment #138808 -
Flags: review?(axel) → review+
Comment on attachment 138816 [details] [diff] [review] Constify patch v1.1 >@@ -374,7 +374,8 @@ txStylesheetCompiler::endElement() > } > } > >- txElementHandler* handler = NS_STATIC_CAST(txElementHandler*, popPtr()); >+ const txElementHandler* handler = >+ NS_STATIC_CAST(const txElementHandler*, popPtr()); > rv = (handler->mEndFunction)(*this); > NS_ENSURE_SUCCESS(rv, rv); I'm a little worried that this won't compile cross-platform ( casting from non-const to const using explicit static-cast). But if it works then this definitly looks better then any alternatives. >+#define INIT_HANDLER_WITH_ELEMENT_HANDLER(_name) \ >+ INIT_HANDLER(_name); \ >+ \ >+ rv = gTx##_name##Handler->init(&gTx##_name##ElementHandler, 1); \ >+ if (NS_FAILED(rv)) \ >+ return PR_FALSE >+ >+#define INIT_HANDLER_WITH_ELEMENT_HANDLERS(_name) \ >+ INIT_HANDLER(_name); \ >+ \ >+ rv = gTx##_name##Handler->init(gTx##_name##ElementHandlers, \ >+ NS_ARRAY_LENGTH(gTx##_name##ElementHandlers)); \ >+ if (NS_FAILED(rv)) \ >+ return PR_FALSE It think it'd fine to not differentiate between handlers that have 1 and handlers that have 2+ element-handlers. Just creating a list with one element shouldn't change the code. r=me either way
Attachment #138816 -
Flags: review?(bugmail) → review+
Assignee | ||
Updated•21 years ago
|
Attachment #138808 -
Flags: superreview?(jst)
Assignee | ||
Updated•21 years ago
|
Attachment #138816 -
Flags: superreview?
Comment 9•21 years ago
|
||
Comment on attachment 138808 [details] [diff] [review] Static atoms patch v1 TX_StringEqualsAtom(): + nsDependentCString ASCIIString(atom, ASCIILength); Like Pike said, loose ASCIIString. sr=jst
Attachment #138808 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 10•21 years ago
|
||
Comment on attachment 138816 [details] [diff] [review] Constify patch v1.1 Doh.
Attachment #138816 -
Flags: superreview? → superreview?(jst)
Comment 11•21 years ago
|
||
Comment on attachment 138816 [details] [diff] [review] Constify patch v1.1 sr=jst
Attachment #138816 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 12•21 years ago
|
||
Assignee | ||
Comment 13•21 years ago
|
||
Visual C++ seems to have a bug that causes it to break on struct whatever { const int i; }; const whatever temp = { 0 }; which is valid afaik, so i had to remove a bunch of const's from the patch. Fortunately it didn't seem to have an influence on the decrease in the Z numbers. Decrease in codesighs was about -11k on Windows, -17k on Linux and -22k on OS X.
Assignee | ||
Comment 14•21 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 15•21 years ago
|
||
Someone left a pile of poo in the living room. And I reviewed it. Darn. TX_StringEqualsAtom regressed, patch coming up.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 16•21 years ago
|
||
Comment 17•21 years ago
|
||
Comment on attachment 139413 [details] [diff] [review] check the char instead of the char* for null termination requesting r/sr from peterv for one-line-bustage-fix
Attachment #139413 -
Flags: superreview?(peterv)
Attachment #139413 -
Flags: review?(peterv)
Assignee | ||
Comment 18•21 years ago
|
||
Comment on attachment 139413 [details] [diff] [review] check the char instead of the char* for null termination sure
Attachment #139413 -
Flags: superreview+
Attachment #139413 -
Flags: review+
Assignee | ||
Updated•21 years ago
|
Attachment #139413 -
Flags: superreview?(peterv)
Attachment #139413 -
Flags: review?(peterv)
Comment 19•21 years ago
|
||
attachement 139413 checked in
Status: REOPENED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•