WL#1698: Better my_compress() functions

Affects: Server-7.1   —   Status: Un-Assigned   —   Priority: Medium

In the following I only talk about my_compress but the same thing is true about 

The current my_compress functions does a malloc/free for every compress and 
this is quite inefficent. What is worse is that my_compress copies the
compressed result back to the sent buffer, which may not be needed at all!

A better approach would be to send to my_compress an indirect pointer to a 
malloced area and a pointer to the length of this area. my_compress() would 
then use this area or reallocate it if needed and the caller would be 
responsible for allocating it.

my_compress() should be able to handle the case where the used_space == 0, in 
which case my_compress() should allocate the buffer. Note that my_realloc() can 
handle this case with the MY_ALLOW_ZERO_PTR flag!