From bd4e65515f556b6bca45d06d81370d99cf649647 Mon Sep 17 00:00:00 2001
From: Michael Widenius <monty@mysql.com>
Date: Sat, 31 Jan 2009 23:22:44 +0200
Subject: Fixed compiler warnings found by gcc 4.3.2 - Added braces around
 expressions with &&, ||, & and | - Added empty line before ; for empty while
 and for loops - Added () around if with assignments - Removed const before
 function returning simple type

Changed BUILD scripts to not build with NDB


BUILD/SETUP.sh:
  By default, don't build ndb with --max in Maria tree.
  NDB is not kept up to date anyway in 5.1
client/mysql.cc:
  Added braces around && to get rid of compiler warnings
sql/event_db_repository.cc:
  Added braces around && to get rid of compiler warnings
sql/events.cc:
  Added braces around && to get rid of compiler warnings
sql/field.cc:
  Added braces around && to get rid of compiler warnings
  Fixed for loops
sql/field.h:
  Added braces around & to get rid of compiler warnings
sql/field_conv.cc:
  Added braces around && to get rid of compiler warnings
  Fixed bug when copying between DATETIME fields and strict dates are used
  Removed not needeed else
sql/gstream.cc:
  Added braces around && to get rid of compiler warnings
sql/ha_ndbcluster.cc:
  Added braces around && to get rid of compiler warnings
  Added {} to get rid of compiler warnings
sql/handler.cc:
  Added braces around && to get rid of compiler warnings
sql/item.cc:
  Added braces around && to get rid of compiler warnings
sql/item_cmpfunc.cc:
  Added braces around && to get rid of compiler warnings
  Removed some not needed space
sql/item_func.cc:
  Added braces around && to get rid of compiler warnings
sql/item_strfunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_subselect.cc:
  Added braces around && to get rid of compiler warnings
sql/item_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/item_timefunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_xmlfunc.cc:
  Added empty line before ; for empty while and for loops
sql/log.cc:
  Added braces around && to get rid of compiler warnings
sql/log_event.cc:
  Added braces around && to get rid of compiler warnings
  Removed not needed else
sql/log_event_old.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_range.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/set_var.cc:
  Added empty line before ; for empty while and for loops
  Added () around if with assignments
sql/slave.cc:
  Added braces around && to get rid of compiler warnings
  Added empty line before ; for empty while and for loops
sql/spatial.h:
  Added braces around && to get rid of compiler warnings
sql/sql_acl.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_analyse.cc:
  Added empty line before ; for empty while and for loops
sql/sql_base.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_connect.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_db.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_delete.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_help.cc:
  Added empty line before ; for empty while and for loops
sql/sql_insert.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
sql/sql_lex.cc:
  Cast char array references to uchar; Fixed wrong array referencing when using characters > ASCII 128 in SQL statments
  Added empty line before ; for empty while and for loops
  Trivial indent fixes
  Added braces around && to get rid of compiler warnings
sql/sql_load.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_parse.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_partition.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_plugin.cc:
  Fixed bug in detecing if option variable should be readonly
  Added empty line before ; for empty while and for loops
sql/sql_prepare.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_select.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
  Added empty line before ; for empty while and for loops
sql/sql_show.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_table.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_trigger.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_update.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_yacc.yy:
  Added braces around && to get rid of compiler warnings
sql/table.cc:
  Added braces around && to get rid of compiler warnings
sql/table.h:
  Added braces around && to get rid of compiler warnings
sql/time.cc:
  Added braces around && to get rid of compiler warnings
sql/tztime.cc:
  Added braces around && to get rid of compiler warnings
sql/uniques.cc:
  Added braces around && to get rid of compiler warnings
storage/federated/ha_federated.cc:
  Fixed bug in testing of variable to ha_info() (Not critical)
storage/heap/ha_heap.cc:
  Added braces around && to get rid of compiler warnings
storage/maria/ha_maria.cc:
  Fixed bug: Mark that maria_log_dir_path is readonly
  Added braces around && to get rid of compiler warnings
storage/ndb/include/ndbapi/NdbEventOperation.hpp:
  Removed const before function returning simple type
storage/ndb/include/ndbapi/NdbOperation.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/Ndb.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/NdbEventOperation.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/TransporterFacade.hpp:
  Added braces around && to get rid of compiler warnings
---
 sql/uniques.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'sql/uniques.cc')

diff --git a/sql/uniques.cc b/sql/uniques.cc
index 0394eee9c6d..c2f16f2e05b 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -603,9 +603,10 @@ bool Unique::get(TABLE *table)
   outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
                                 MYF(MY_ZEROFILL));
 
-  if (!outfile || ! my_b_inited(outfile) &&
-      open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
-		       MYF(MY_WME)))
+  if (!outfile ||
+      (! my_b_inited(outfile) &&
+       open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
+                        MYF(MY_WME))))
     return 1;
   reinit_io_cache(outfile,WRITE_CACHE,0L,0,0);
 
-- 
cgit v1.2.1


From ecbcddc03dc298ea1e6c0aa1a120bd0b4b04b3fd Mon Sep 17 00:00:00 2001
From: Michael Widenius <monty@askmonty.org>
Date: Fri, 16 Jul 2010 10:33:01 +0300
Subject: Improved speed of thr_alarm from O(N) to O(1). thr_alarm is used to
 handle timeouts and kill of connections. Fixed compiler warnings. queues.h
 and queues.c are now based on the UNIREG code and thus made BSD. Fix code to
 use new queue() interface. This mostly affects how you access elements in the
 queue. If USE_NET_CLEAR is not set, don't clear connection from unexpected
 characters. This should give a speed up when doing a lot of fast queries.
 Fixed some code in ma_ft_boolean_search.c that had not made it from
 myisam/ft_boolean_search.c

include/queues.h:
  Use UNIREG code base (BSD)
  Changed init_queue() to take all initialization arguments.
  New interface to access elements in queue
include/thr_alarm.h:
  Changed to use time_t instead of ulong (portability)
  Added index_in_queue, to be able to remove random element from queue in O(1)
mysys/queues.c:
  Use UNIREG code base (BSD)
  init_queue() and reinit_queue() now takes more initialization arguments. (No need for init_queue_ex() anymore)
  Now one can tell queue_insert() to store in the element a pointer to where element is in queue. This allows one to remove elements from queue in O(1) instead of O(N)
mysys/thr_alarm.c:
  Use new option in queue() to allow fast removal of elements.
  Do less inside LOCK_alarm mutex.
  This should give a major speed up of thr_alarm usage when there is many threads
sql/create_options.cc:
  Fixed wrong printf
sql/event_queue.cc:
  Use new queue interface()
sql/filesort.cc:
  Use new queue interface()
sql/ha_partition.cc:
  Use new queue interface()
sql/ha_partition.h:
  Fixed compiler warning
sql/item_cmpfunc.cc:
  Fixed compiler warning
sql/item_subselect.cc:
  Use new queue interface()
  Removed not used variable
sql/net_serv.cc:
  If USE_NET_CLEAR is not set, don't clear connection from unexpected characters.
  This should give a speed up when doing a lot of fast queries at the disadvantage that if there is a bug in the client protocol the connection will be dropped instead of being unnoticed.
sql/opt_range.cc:
  Use new queue interface()
  Fixed compiler warnings
sql/uniques.cc:
  Use new queue interface()
storage/maria/ma_ft_boolean_search.c:
  Copy code from myisam/ft_boolean_search.c
  Use new queue interface()
storage/maria/ma_ft_nlq_search.c:
  Use new queue interface()
storage/maria/ma_sort.c:
  Use new queue interface()
storage/maria/maria_pack.c:
  Use new queue interface()
  Use queue_fix() instead of own loop to fix queue.
storage/myisam/ft_boolean_search.c:
  Use new queue interface()
storage/myisam/ft_nlq_search.c:
  Use new queue interface()
storage/myisam/mi_test_all.sh:
  Remove temporary file from last run
storage/myisam/myisampack.c:
  Use new queue interface()
  Use queue_fix() instead of own loop to fix queue.
storage/myisam/sort.c:
  Use new queue interface()
storage/myisammrg/myrg_queue.c:
  Use new queue interface()
storage/myisammrg/myrg_rnext.c:
  Use new queue interface()
storage/myisammrg/myrg_rnext_same.c:
  Use new queue interface()
storage/myisammrg/myrg_rprev.c:
  Use new queue interface()
---
 sql/uniques.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'sql/uniques.cc')

diff --git a/sql/uniques.cc b/sql/uniques.cc
index 3d1ea9243b9..561b1068097 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -423,7 +423,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
   if (end <= begin ||
       merge_buffer_size < (ulong) (key_length * (end - begin + 1)) ||
       init_queue(&queue, (uint) (end - begin), offsetof(BUFFPEK, key), 0,
-                 buffpek_compare, &compare_context))
+                 buffpek_compare, &compare_context, 0, 0))
     return 1;
   /* we need space for one key when a piece of merge buffer is re-read */
   merge_buffer_size-= key_length;
@@ -468,7 +468,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
     */
     top->key+= key_length;
     if (--top->mem_count)
-      queue_replaced(&queue);
+      queue_replace_top(&queue);
     else /* next piece should be read */
     {
       /* save old_key not to overwrite it in read_to_buffer */
@@ -478,14 +478,14 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
       if (bytes_read == (uint) (-1))
         goto end;
       else if (bytes_read > 0)      /* top->key, top->mem_count are reset */
-        queue_replaced(&queue);     /* in read_to_buffer */
+        queue_replace_top(&queue);             /* in read_to_buffer */
       else
       {
         /*
           Tree for old 'top' element is empty: remove it from the queue and
           give all its memory to the nearest tree.
         */
-        queue_remove(&queue, 0);
+        queue_remove_top(&queue);
         reuse_freed_buff(&queue, top, key_length);
       }
     }
-- 
cgit v1.2.1