From c79af09bc6ec017fe70ebc8534c90e6993f39ce2 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 9 Jun 2018 20:27:16 +0200 Subject: Add check for variable size array feature Usage of VLA is not portable, wile supported by some compilers. For instance, GCC supports it even if -std=c89 is passed. Even if we would switch to C99, it would be still not portable at least with VC++. Thus, adding a centralized check so such code can be guarded and moved to alloca() if needed. --- ext/mysqlnd/mysqlnd_wireprotocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/mysqlnd/mysqlnd_wireprotocol.c') diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 0aee0d9b94..20b82ac658 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -2162,7 +2162,7 @@ size_t php_mysqlnd_cached_sha2_result_write(MYSQLND_CONN_DATA * conn, void * _pa MYSQLND_PFC * pfc = conn->protocol_frame_codec; MYSQLND_VIO * vio = conn->vio; MYSQLND_STATS * stats = conn->stats; -#ifndef _MSC_VER +#if HAVE_COMPILER_C99_VLA zend_uchar buffer[MYSQLND_HEADER_SIZE + packet->password_len + 1]; #else ALLOCA_FLAG(use_heap) @@ -2180,7 +2180,7 @@ size_t php_mysqlnd_cached_sha2_result_write(MYSQLND_CONN_DATA * conn, void * _pa sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info); } -#ifdef _MSC_VER +#if !HAVE_COMPILER_C99_VLA free_alloca(buffer, use_heap); #endif -- cgit v1.2.1