On 14 May 2011, M.R. wrote:
On 13/05/11 12:17, Konstantin Andreev wrote:
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 )
I don't think that everybody would agree: a canonical language construct is to me
much better than proliferation of constructs defined in some local (project,
programme, source book...) scope. <...>
(<...> Any large body of code simply must have 'style guidelines').
That's right.
But NSS has already defined 4 different macros for array size:
NSS_CKCAPI_ARRAY_SIZE, NSS_CKMK_ARRAY_SIZE, NUM_ELEM, NUM_SUITEINFOS.
NSPR has "countof" macro. The rest of Mozilla use 2 macros: NS_ARRAY_LENGTH,
JS_ARRAY_LENGTH.
A can of worms has already opened.
Regards, Konstantin.
--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto