Closed
Bug 156464
Opened 24 years ago
Closed 24 years ago
Remove static strings from Transformiix
Categories
(Core :: XSLT, defect)
Core
XSLT
Tracking
()
VERIFIED
FIXED
People
(Reporter: peterv, Assigned: peterv)
Details
(Whiteboard: TX_BRIDGE_1_1_FIXED 92284 92553)
Attachments
(2 files, 5 obsolete files)
|
20.64 KB,
patch
|
Details | Diff | Splinter Review | |
|
48.05 KB,
patch
|
peterv
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
We should get rid of most if not all static strings in Transformiix, most of
them can be replaced by using atoms anyway.
| Assignee | ||
Comment 1•24 years ago
|
||
Comment 2•24 years ago
|
||
merged to trunk, and added rv checks on qname.init.
If that's ok with peterv, I call this a r=axel@pike.org
Attachment #90616 -
Attachment is obsolete: true
| Assignee | ||
Comment 3•24 years ago
|
||
Comment on attachment 91100 [details] [diff] [review]
v2
record r=Pike.
Attachment #91100 -
Flags: review+
| Assignee | ||
Comment 4•24 years ago
|
||
Note: this bug will be fixed in several stages. I'll start by removing as much
usage of the static strings as possible and then remove all the unused strings
in a last patch.
Comment 5•24 years ago
|
||
Comment on attachment 91100 [details] [diff] [review]
v2
+#define CHECK_ELEMENT(_name) qname.mLocalName == txXSLTAtoms::##_name
+
Eek, I'd much rather see you pass qname as an argument to this macro, I hate
macro's that make assumptions about random locals being available where they're
used. Any reason to not make this a static inline function in stead of a macro?
Or even better, get the local name atom into a local variable and just use ==
in the if checks below, wouldn't that be the fastest and cleanest thing here?
sr=jst either way.
Attachment #91100 -
Flags: superreview+
| Assignee | ||
Updated•24 years ago
|
Attachment #92222 -
Flags: superreview+
Attachment #92222 -
Flags: review+
| Assignee | ||
Comment 7•24 years ago
|
||
Oops, wrong patch. Pike happy, Jst happy.
Attachment #92222 -
Attachment is obsolete: true
| Assignee | ||
Updated•24 years ago
|
Whiteboard: TX_BRIDGE_1_1_FIXED
| Assignee | ||
Comment 8•24 years ago
|
||
Comment 9•24 years ago
|
||
Comment on attachment 92405 [details] [diff] [review]
Second round v1
Looks fine to me, could you change the comment on FunctionCall::toString to
reflect that it just outputs the parameters?
Comment 10•24 years ago
|
||
adding the attachement number to the whiteboard, I'll be confused otherwise
Whiteboard: TX_BRIDGE_1_1_FIXED → TX_BRIDGE_1_1_FIXED 92284
Comment on attachment 92405 [details] [diff] [review]
Second round v1
>+void BooleanFunctionCall::toString(String& aDest)
>+{
>+ txAtom* functionName;
>+ switch (mType) {
>+ case TX_BOOLEAN:
>+ functionName = txXPathAtoms::boolean;
>+ break;
>+ case TX_LANG:
>+ functionName = txXPathAtoms::lang;
>+ break;
>+ case TX_NOT:
>+ functionName = txXPathAtoms::_not;
>+ break;
>+ case TX_TRUE:
>+ functionName = txXPathAtoms::_true;
>+ break;
>+ default:
>+ functionName = txXPathAtoms::_false;
>+ break;
>+ }
>+ if (TX_GET_ATOM_STRING(functionName, aDest)) {
>+ FunctionCall::toString(aDest);
>+ }
>+}
Another way to do this would be to have a private virtual function in
FunctionCall called 'getNameAtom' or some such that all FunctionCall inheriters
can override. Then FunctionCall::toString could call that and do the
atom->string conversion so that we only do that once. Not a requirement, but it
would IMHO be nice.
Also, TX_GET_ATOM_STRING will set aDest, not append to it.
>+// XXX This is ugly, but this is the last file to use them,
>+// once we convert the parser to directly compare with
>+// atoms we should remove these.
I take it you want to wait with that until next patch. IMHO we don't have to
wait until the lexer is atomized (and i know that Pike has some reservations
wrt that) until we do this.
>+void FunctionCall::toString(String& aDest)
> {
>- dest.append(this->name);
>- dest.append('(');
>- //-- add parameters
>+ aDest.append('(');
> txListIterator iter(¶ms);
>- int argc = 0;
>+ MBool addColon = MB_FALSE;
> while (iter.hasNext()) {
>- if (argc > 0)
>- dest.append(',');
>+ if (addColon) {
>+ aDest.append(',');
>+ }
>+ else {
>+ addColon = MB_TRUE;
>+ }
> Expr* expr = (Expr*)iter.next();
>- expr->toString(dest);
>- ++argc;
>+ expr->toString(aDest);
> }
>- dest.append(')');
>-} //-- toString
>-
>+ aDest.append(')');
>+}
It seems that this will only add a ',' after every other expression, instead of
ever one except the first? Also, wouldn't 'addComma' be a better name then
'addColon'?
| Assignee | ||
Comment 12•24 years ago
|
||
Attachment #92405 -
Attachment is obsolete: true
Comment on attachment 92446 [details] [diff] [review]
Second round v2
>+txAtom* BooleanFunctionCall::getNameAtom()
>+{
>+ switch (mType) {
>+ case TX_BOOLEAN:
>+ return txXPathAtoms::boolean;
>+ case TX_LANG:
>+ return txXPathAtoms::lang;
>+ case TX_NOT:
>+ return txXPathAtoms::_not;
>+ case TX_TRUE:
>+ return txXPathAtoms::_true;
>+ default:
>+ return txXPathAtoms::_false;
>+ }
>+}
It is kind'a ugly to return a non-addreffed atom, but if you're fine with it
then so am I. I'm also pondering if the above might cause a 'no value returned'
warning on some compilers?
If it doesn't, r=sicking
Attachment #92446 -
Flags: review+
| Assignee | ||
Comment 14•24 years ago
|
||
Attachment #92446 -
Attachment is obsolete: true
| Assignee | ||
Comment 15•24 years ago
|
||
Comment on attachment 92553 [details] [diff] [review]
Second round v2.1
Carrying over r=sicking.
Attachment #92553 -
Flags: review+
Comment 16•24 years ago
|
||
Comment on attachment 92553 [details] [diff] [review]
Second round v2.1
- In BooleanFunctionCall::getNameAtom(txAtom** aAtom):
+{
+ switch (mType) {
...
+ default:
+ {
+ return NS_ERROR_FAILURE;
+ }
You should null out the out param before returning here. Same thing in
NodeSetFunctionCall::getNameAtom(), NumberFunctionCall::getNameAtom(), and
StringFunctionCall::getNameAtom().
sr=jst
Attachment #92553 -
Flags: superreview+
| Assignee | ||
Updated•24 years ago
|
Whiteboard: TX_BRIDGE_1_1_FIXED 92284 → TX_BRIDGE_1_1_FIXED 92284 92553
| Assignee | ||
Comment 17•24 years ago
|
||
Landed the TX_BRIDGE_1_1_BRANCH to the trunk.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 18•24 years ago
|
||
we didn't verify for a long time.
I really checked, so VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•