[Groonga-commit] groonga/groonga [master] removed unsafe comparisons (== 0.0).

Back to archive index

null+****@clear***** null+****@clear*****
2012年 1月 11日 (水) 14:27:11 JST


Susumu Yata	2012-01-11 14:27:11 +0900 (Wed, 11 Jan 2012)

  New Revision: d22672d69b61aa6f9cc39a1355c1cbe779c3c1cc

  Log:
    removed unsafe comparisons (== 0.0).

  Modified files:
    lib/dat/trie.cpp

  Modified: lib/dat/trie.cpp (+4 -4)
===================================================================
--- lib/dat/trie.cpp    2012-01-11 14:17:29 +0900 (4c64520)
+++ lib/dat/trie.cpp    2012-01-11 14:27:11 +0900 (7c93538)
@@ -40,12 +40,12 @@ void Trie::create(const char *file_name,
                   double average_key_length) {
   GRN_DAT_THROW_IF(PARAM_ERROR, (file_size != 0) && (max_num_keys != 0));
 
-  if (num_nodes_per_key == 0.0) {
+  if (num_nodes_per_key < 1.0) {
     num_nodes_per_key = DEFAULT_NUM_NODES_PER_KEY;
   }
   GRN_DAT_THROW_IF(PARAM_ERROR, num_nodes_per_key < 1.0);
 
-  if (average_key_length == 0.0) {
+  if (average_key_length < 1.0) {
     average_key_length = DEFAULT_AVERAGE_KEY_LENGTH;
   }
   GRN_DAT_THROW_IF(PARAM_ERROR, average_key_length < 1.0);
@@ -76,7 +76,7 @@ void Trie::create(const Trie &trie,
                   double average_key_length) {
   GRN_DAT_THROW_IF(PARAM_ERROR, (file_size != 0) && (max_num_keys != 0));
 
-  if (num_nodes_per_key == 0.0) {
+  if (num_nodes_per_key < 1.0) {
     if (trie.num_keys() == 0) {
       num_nodes_per_key = DEFAULT_NUM_NODES_PER_KEY;
     } else {
@@ -85,7 +85,7 @@ void Trie::create(const Trie &trie,
   }
   GRN_DAT_THROW_IF(PARAM_ERROR, num_nodes_per_key < 1.0);
 
-  if (average_key_length == 0.0) {
+  if (average_key_length < 1.0) {
     if (trie.num_keys() == 0) {
       average_key_length = DEFAULT_AVERAGE_KEY_LENGTH;
     } else {




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