BUG-987: share empty instance

This shares the typically empty constraint instance, for both
mandatory=true and mandatory=false cases.

Change-Id: Ib555d8f4a2f6147a354d71432c86d065a359ec8b
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit d00546c864d1992994863e99cebc2d97fa147503)
Signed-off-by: Robert Varga <rovarga@cisco.com>
BUG-987: optimize illegal character search

As it turns out, we are not search for a substring, but rather for
characters. Move the array into static field so we do not allocate it
needlessly over and over. And make it a char array to save space and
increase checking speed.

Change-Id: I307813ad363441cf8ee63d383896e5fa6d2fb6e6
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 23df6e207d1dc0c705d50bd0014db7a3ae7d1484)
Signed-off-by: Robert Varga <rovarga@cisco.com>