Introduce and use ARRAY_LENGTH macro

Avoids repeating literals and constants.  Also remove redundant
memset.