MAINT: optimize: static on internal function
MAINT: signal: remove K&R-isms

Code was (1) mixing C89 and pre-standard syntax, (2) not including
<stdlib.h> and casting the return value from malloc (thus implicitly
relying on other headers to include this on 64-bit platforms) and
(3) using int instead of size_t for memory buffer sizes.
Merge pull request #4114 from larsmans/c-fixes

MAINT: C fixes