bugfix: remove duplicate code
bugfix: don't export uninitialized data
bugfix: correct variable mismatch
bugfix: add a missing flag and prevent memleak
Set default value of eParamPassing explicitly
bugfix: allocate correct object type
Use uchar instead of char for type size reference
bugfix: prevent passing NULL to strstr, strlen
bugfix: prevent division by zero

The result is set to 0 in that case. Might be better to do something
else in the future, but at least it'll stop crashing for now.
bugfix: relax a too strict condition
unpick commit 5c4cb78ac15e841726af672a8a227017a2516cfa

The variable initialized there was removed by my larger patch
a couple of days ago. Accidently cherry-picked that commit.