I see a lot of aspects in the NSS code, which would greatly benefit
(readability, maintainability, etc) from a trivial refactoring.
Here are a few trivial examples (NSS):
-- 123 occurrences of code like
| sizeof(longUnreadableName)/sizeof(*longUnreadableName)
Much more readable:
| PR_ARRAY_SIZE( longUnreadableName )
-- a lot of code like this:
| ((a->b.c + 7) >> 3)
Much better:
| BITS_TO_OCTETS( a->b.c )
-- loader.c duplicates the code below ~ 180 times (!!!):
| if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
| return rv;
Much better: #define LDVEC(rv) ...
-- every BLAPI function has two declarations:
blapi.h:
| extern SECStatus DH_Derive(SECItem * publicValue, SECItem * prime,
| SECItem *privateValue, SECItem *derivedSecret, unsigned int
maxOutBytes);
loader.h, copy-pasted declaration:
| SECStatus (* p_DH_Derive)(SECItem * publicValue, SECItem *prime,
| SECItem *privateValue, SECItem *derivedSecret, unsigned int
maxOutBytes );
Much better: typedef DH_DeriveFN; DH_DeriveFN DH_Derive, *p_DH_Derive;
Etc, etc...
The question is: will the patch, which addresses the aspect like above, be
accepted ? What is the policy?
I am especially curious, because Wan-Teh specially warned me [bug 654436] from supplying
patch for the 1st ( "sizeof/sizeof" ) example.
Keep well, Konstantin.
--
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto