Fix build for systems without LZ4 dependency installed

This was introduced by commit 903c91cd30.
To fix it, we simply protect the try_compress_lz4 function with proper
ifdef guards.

Build log:

spicevmc.c: In function 'try_compress_lz4':
spicevmc.c:143:5: error: implicit declaration of function 'LZ4_compress_default' [-Werror=implicit-function-declaration]
     compressed_data_count = LZ4_compress_default((char*)&msg_item->buf,
     ^
spicevmc.c:143:5: error: nested extern declaration of 'LZ4_compress_default' [-Werror=nested-externs]

spicevmc.c: At top level:
spicevmc.c:124:24: error: 'try_compress_lz4' defined but not used [-Werror=unused-function]
 static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
                        ^

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
Eduardo Lima (Etrunko) 2016-06-15 14:37:25 -03:00
parent e3419b0e12
commit 33b45af275

View File

@ -121,6 +121,7 @@ static void spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
* - NULL upon failure.
* - a new pipe item with the compressed data in it upon success
*/
#ifdef USE_LZ4
static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
{
RedVmcPipeItem *msg_item_compressed;
@ -157,6 +158,7 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
free(msg_item_compressed);
return NULL;
}
#endif
static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
void *opaque)