[Groonga-mysql-commit] mroonga/mroonga [master] Add empty string check

Back to archive index

null+****@clear***** null+****@clear*****
2012年 3月 8日 (木) 21:35:20 JST


Kouhei Sutou	2012-03-08 21:35:20 +0900 (Thu, 08 Mar 2012)

  New Revision: c0687a89880b116d944ab3ce3972b8cdfa3e284d

  Log:
    Add empty string check

  Modified files:
    mrn_table.cc

  Modified: mrn_table.cc (+5 -2)
===================================================================
--- mrn_table.cc    2012-03-07 20:28:17 +0900 (eb511c2)
+++ mrn_table.cc    2012-03-08 21:35:20 +0900 (3c489f1)
@@ -35,6 +35,9 @@
 #  define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name))
 #endif
 
+#define LEX_STRING_IS_EMPTY(string)                                     \
+  ((string).length == 0 || !(string).str || (string).str[0] == '\0')
+
 #define MRN_DEFAULT_STR "DEFAULT"
 #define MRN_DEFAULT_LEN (sizeof(MRN_DEFAULT_STR) - 1)
 #define MRN_GROONGA_STR "GROONGA"
@@ -342,7 +345,7 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
         break;
 #endif
       case 2:
-        if (table->s->comment.length == 0)
+        if (LEX_STRING_IS_EMPTY(table->s->comment))
           continue;
         DBUG_PRINT("info", ("mroonga create comment string"));
         if (
@@ -356,7 +359,7 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
         DBUG_PRINT("info", ("mroonga comment string=%s", param_string));
         break;
       default:
-        if (table->s->connect_string.length == 0)
+        if (LEX_STRING_IS_EMPTY(table->s->connect_string))
           continue;
         DBUG_PRINT("info", ("mroonga create connect_string string"));
         if (




Groonga-mysql-commit メーリングリストの案内
Back to archive index