summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_wireprotocol.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2018-06-09 20:27:16 +0200
committerAnatol Belski <ab@php.net>2018-06-09 20:27:16 +0200
commitc79af09bc6ec017fe70ebc8534c90e6993f39ce2 (patch)
treec3f6a8f4203538607b16439eb759051f42b69ba9 /ext/mysqlnd/mysqlnd_wireprotocol.c
parentd877d186766fe43121510e6f48797dd33e060e35 (diff)
downloadphp-git-c79af09bc6ec017fe70ebc8534c90e6993f39ce2.tar.gz
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.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_wireprotocol.c')
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c4
1 files changed, 2 insertions, 2 deletions
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