[Groonga-mysql-commit] mroonga/mroonga at e135b47 [master] Don't use variable length array declaration

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Mar 24 18:32:01 JST 2015


Kouhei Sutou	2015-03-24 18:32:01 +0900 (Tue, 24 Mar 2015)

  New Revision: e135b47d72ef577d61b5e040229bf01ced4ca1eb
  https://github.com/mroonga/mroonga/commit/e135b47d72ef577d61b5e040229bf01ced4ca1eb

  Message:
    Don't use variable length array declaration
    
    It seems that MariaDB 10.0 dislikes the feature.

  Modified files:
    ha_mroonga.cpp

  Modified: ha_mroonga.cpp (+6 -6)
===================================================================
--- ha_mroonga.cpp    2015-03-24 17:35:50 +0900 (81a336e)
+++ ha_mroonga.cpp    2015-03-24 18:32:01 +0900 (3c108c0)
@@ -55,9 +55,6 @@
 #ifdef WIN32
 #  include <math.h>
 #  include <direct.h>
-#  define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \
-    type *variable_name = (type *)_malloca(sizeof(type) * (variable_size))
-#  define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name) _freea(variable_name)
 #  define MRN_TABLE_SHARE_LOCK_SHARE_PROC "?key_TABLE_SHARE_LOCK_share@@3IA"
 #  define MRN_TABLE_SHARE_LOCK_HA_DATA_PROC "?key_TABLE_SHARE_LOCK_ha_data@@3IA"
 #  ifdef _WIN64
@@ -70,11 +67,14 @@
 #else
 #  include <dirent.h>
 #  include <unistd.h>
-#  define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \
-    type variable_name[variable_size]
-#  define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name)
 #endif
 
+#define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \
+  type *variable_name =                                                 \
+    (type *)mrn_my_malloc(sizeof(type) * (variable_size), MYF(MY_WME))
+#define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name) \
+  my_free(variable_name)
+
 #include "mrn_err.h"
 #include "mrn_table.hpp"
 #include "ha_mroonga.hpp"
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-mysql-commit mailing list
Back to archive index