MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:March 4 2010 12:09pm
Subject:bzr commit into mysql-5.1-telco-6.3 branch (magnus.blaudd:3122)
View as plain text  
#At file:///home/msvensson/mysql/6.3/ based on revid:magnus.blaudd@strippedj3uzxl259s

 3122 Magnus Blåudd	2010-03-04
      ndb_mgm
       - Use bool as return type for execute function that return true/false

    modified:
      storage/ndb/src/mgmclient/CommandInterpreter.cpp
      storage/ndb/src/mgmclient/main.cpp
      storage/ndb/src/mgmclient/ndb_mgmclient.hpp
=== modified file 'storage/ndb/src/mgmclient/CommandInterpreter.cpp'
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2010-03-04 11:55:27 +0000
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2010-03-04 12:09:13 +0000
@@ -53,11 +53,12 @@ public:
    *
    *   @return true until quit/bye/exit has been typed
    */
-  int execute(const char *_line, int _try_reconnect=-1, bool interactive=1, int *error= 0);
+  bool execute(const char *line, int _try_reconnect = -1,
+               bool interactive = true, int *error = NULL);
 
 private:
   void printError();
-  int execute_impl(const char *_line, bool interactive=1);
+  bool execute_impl(const char *line, bool interactive);
 
   /**
    *   Analyse the command line, after the first token.
@@ -187,7 +188,8 @@ Ndb_mgmclient::~Ndb_mgmclient()
 {
   delete m_cmd;
 }
-int Ndb_mgmclient::execute(const char *_line, int _try_reconnect, bool interactive, int *error)
+bool Ndb_mgmclient::execute(const char *_line, int _try_reconnect,
+                            bool interactive, int *error)
 {
   return m_cmd->execute(_line,_try_reconnect,interactive, error);
 }
@@ -1027,13 +1029,13 @@ CommandInterpreter::disconnect(void)
 //*****************************************************************************
 //*****************************************************************************
 
-int 
+bool
 CommandInterpreter::execute(const char *_line, int _try_reconnect,
-			    bool interactive, int *error) 
+			    bool interactive, int *error)
 {
   if (_try_reconnect >= 0)
     try_reconnect=_try_reconnect;
-  int result= execute_impl(_line, interactive);
+  bool result= execute_impl(_line, interactive);
   if (error)
     *error= m_error;
 
@@ -1127,19 +1129,19 @@ split_args(const char* line, Vector<Base
 }
 
 
-int 
-CommandInterpreter::execute_impl(const char *_line, bool interactive) 
+bool
+CommandInterpreter::execute_impl(const char *_line, bool interactive)
 {
   DBUG_ENTER("CommandInterpreter::execute_impl");
-  DBUG_PRINT("enter",("line=\"%s\"",_line));
+  DBUG_PRINT("enter",("line='%s'", _line));
   m_error= 0;
 
-  char * line;
   if(_line == NULL) {
     m_error = -1;
     DBUG_RETURN(false);
   }
-  line = my_strdup(_line,MYF(MY_WME));
+
+  char* line = my_strdup(_line,MYF(MY_WME));
   My_auto_ptr<char> ptr(line);
 
   int do_continue;

=== modified file 'storage/ndb/src/mgmclient/main.cpp'
--- a/storage/ndb/src/mgmclient/main.cpp	2010-03-02 13:48:27 +0000
+++ b/storage/ndb/src/mgmclient/main.cpp	2010-03-04 12:09:13 +0000
@@ -85,8 +85,8 @@ static void usage()
   my_print_variables(my_long_options);
 }
 
-static int 
-read_and_execute(int _try_reconnect) 
+static bool
+read_and_execute(int _try_reconnect)
 {
   static char *line_read = (char *)NULL;
 
@@ -163,7 +163,8 @@ int main(int argc, char** argv){
 #endif
 
     ndbout << "-- NDB Cluster -- Management Client --" << endl;
-    while(read_and_execute(_try_reconnect));
+    while(read_and_execute(_try_reconnect))
+      ;
 
 #ifdef HAVE_READLINE
     if (histfile.length())
@@ -183,6 +184,7 @@ int main(int argc, char** argv){
   delete com;
 
   ndb_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+
   return ret;
 }
 

=== modified file 'storage/ndb/src/mgmclient/ndb_mgmclient.hpp'
--- a/storage/ndb/src/mgmclient/ndb_mgmclient.hpp	2010-03-04 11:54:03 +0000
+++ b/storage/ndb/src/mgmclient/ndb_mgmclient.hpp	2010-03-04 12:09:13 +0000
@@ -25,7 +25,8 @@ class Ndb_mgmclient
 public:
   Ndb_mgmclient(const char*,int verbose=0);
   ~Ndb_mgmclient();
-  int execute(const char *_line, int _try_reconnect=-1, bool interactive=1, int *error= 0);
+  bool execute(const char *_line, int _try_reconnect = -1,
+               bool interactive = true, int *error = NULL);
 private:
   CommandInterpreter *m_cmd;
 };

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20100304120913-iqsik8y0pxjt93g3.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (magnus.blaudd:3122)Magnus Blåudd4 Mar