← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2823: small code cleanup - "good ifdef is no ifdef"

 

------------------------------------------------------------
revno: 2823
committer: Sergei Golubchik <sergii@xxxxxxxxx>
branch nick: maria-5.1
timestamp: Mon 2010-03-08 14:57:32 +0100
message:
  small code cleanup - "good ifdef is no ifdef"
modified:
  sql/handler.cc
  sql/set_var.cc
  sql/sql_plugin.cc
  sql/sql_plugin.h
  sql/sql_select.cc
  sql/table.cc


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'sql/handler.cc'
--- sql/handler.cc	2010-01-15 15:27:55 +0000
+++ sql/handler.cc	2010-03-08 13:57:32 +0000
@@ -82,7 +82,7 @@
 {
   if (thd->variables.table_plugin)
     return thd->variables.table_plugin;
-  return my_plugin_lock(thd, &global_system_variables.table_plugin);
+  return my_plugin_lock(thd, global_system_variables.table_plugin);
 }
 
 
@@ -163,13 +163,8 @@
 {
   if (hton)
   {
-    st_plugin_int **plugin= hton2plugin + hton->slot;
-    
-#ifdef DBUG_OFF
-    return my_plugin_lock(thd, plugin);
-#else
-    return my_plugin_lock(thd, &plugin);
-#endif
+    st_plugin_int *plugin= hton2plugin[hton->slot];
+    return my_plugin_lock(thd, plugin_int_to_ref(plugin));
   }
   return NULL;
 }

=== modified file 'sql/set_var.cc'
--- sql/set_var.cc	2010-01-14 16:32:41 +0000
+++ sql/set_var.cc	2010-03-08 13:57:32 +0000
@@ -3845,7 +3845,7 @@
   LEX_STRING *engine_name;
   plugin_ref plugin= thd->variables.*offset;
   if (type == OPT_GLOBAL)
-    plugin= my_plugin_lock(thd, &(global_system_variables.*offset));
+    plugin= my_plugin_lock(thd, global_system_variables.*offset);
   hton= plugin_data(plugin, handlerton*);
   engine_name= hton_name(hton);
   result= (uchar *) thd->strmake(engine_name->str, engine_name->length);
@@ -3866,7 +3866,7 @@
   else
   {
     value= &(thd->variables.*offset);
-    new_value= my_plugin_lock(NULL, &(global_system_variables.*offset));
+    new_value= my_plugin_lock(NULL, global_system_variables.*offset);
   }
   DBUG_ASSERT(new_value);
   old_value= *value;
@@ -3883,7 +3883,7 @@
   old_value= *value;
   if (old_value != var->save_result.plugin)
   {
-    *value= my_plugin_lock(NULL, &var->save_result.plugin);
+    *value= my_plugin_lock(NULL, var->save_result.plugin);
     plugin_unlock(NULL, old_value);
   }
   return 0;

=== modified file 'sql/sql_plugin.cc'
--- sql/sql_plugin.cc	2009-12-22 10:33:20 +0000
+++ sql/sql_plugin.cc	2010-03-08 13:57:32 +0000
@@ -19,14 +19,6 @@
 #define REPORT_TO_LOG  1
 #define REPORT_TO_USER 2
 
-#ifdef DBUG_OFF
-#define plugin_ref_to_int(A) A
-#define plugin_int_to_ref(A) A
-#else
-#define plugin_ref_to_int(A) (A ? A[0] : NULL)
-#define plugin_int_to_ref(A) &(A)
-#endif
-
 extern struct st_mysql_plugin *mysqld_builtins[];
 
 /**
@@ -658,13 +650,13 @@
 }
 
 
-plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO)
+plugin_ref plugin_lock(THD *thd, plugin_ref ptr CALLER_INFO_PROTO)
 {
   LEX *lex= thd ? thd->lex : 0;
   plugin_ref rc;
   DBUG_ENTER("plugin_lock");
   pthread_mutex_lock(&LOCK_plugin);
-  rc= my_intern_plugin_lock_ci(lex, *ptr);
+  rc= my_intern_plugin_lock_ci(lex, ptr);
   pthread_mutex_unlock(&LOCK_plugin);
   DBUG_RETURN(rc);
 }

=== modified file 'sql/sql_plugin.h'
--- sql/sql_plugin.h	2009-05-14 12:03:33 +0000
+++ sql/sql_plugin.h	2010-03-08 13:57:32 +0000
@@ -89,6 +89,8 @@
 */
 #ifdef DBUG_OFF
 typedef struct st_plugin_int *plugin_ref;
+#define plugin_ref_to_int(A) A
+#define plugin_int_to_ref(A) A
 #define plugin_decl(pi) ((pi)->plugin)
 #define plugin_dlib(pi) ((pi)->plugin_dl)
 #define plugin_data(pi,cast) ((cast)((pi)->data))
@@ -97,6 +99,8 @@
 #define plugin_equals(p1,p2) ((p1) == (p2))
 #else
 typedef struct st_plugin_int **plugin_ref;
+#define plugin_ref_to_int(A) (A ? A[0] : NULL)
+#define plugin_int_to_ref(A) &(A)
 #define plugin_decl(pi) ((pi)[0]->plugin)
 #define plugin_dlib(pi) ((pi)[0]->plugin_dl)
 #define plugin_data(pi,cast) ((cast)((pi)[0]->data))
@@ -120,7 +124,7 @@
 #define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO)
 #define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO)
 #define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO)
-extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO);
+extern plugin_ref plugin_lock(THD *thd, plugin_ref ptr CALLER_INFO_PROTO);
 extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name,
                                       int type CALLER_INFO_PROTO);
 extern void plugin_unlock(THD *thd, plugin_ref plugin);

=== modified file 'sql/sql_select.cc'
--- sql/sql_select.cc	2010-03-06 12:09:02 +0000
+++ sql/sql_select.cc	2010-03-08 13:57:32 +0000
@@ -11014,7 +11014,7 @@
   delete table->file;
   table->file=0;
   plugin_unlock(0, table->s->db_plugin);
-  share.db_plugin= my_plugin_lock(0, &share.db_plugin);
+  share.db_plugin= my_plugin_lock(0, share.db_plugin);
   new_table.s= table->s;                       // Keep old share
   *table= new_table;
   *table->s= share;

=== modified file 'sql/table.cc'
--- sql/table.cc	2010-02-10 19:06:24 +0000
+++ sql/table.cc	2010-03-08 13:57:32 +0000
@@ -899,7 +899,7 @@
           replacing it with a globally locked version of tmp_plugin
         */
         plugin_unlock(NULL, share->db_plugin);
-        share->db_plugin= my_plugin_lock(NULL, &tmp_plugin);
+        share->db_plugin= my_plugin_lock(NULL, tmp_plugin);
         DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
                             str_db_type_length, next_chunk + 2,
                             ha_legacy_type(share->db_type())));