List:Commits« Previous MessageNext Message »
From:msvensson Date:March 28 2007 4:37pm
Subject:bk commit into 5.1 tree (msvensson:1.2512)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-28 18:37:27+02:00, msvensson@stripped +1 -0
  Merge pilot.blaudden:/home/msvensson/mysql/bug27490/my50-bug27490
  into  pilot.blaudden:/home/msvensson/mysql/bug27490/my51-bug27490
  MERGE: 1.1810.2622.3

  sql/log.cc@stripped, 2007-03-28 18:37:26+02:00, msvensson@stripped +0 -2
    Manual merge, the -5 hack is not needed anymore
    MERGE: 1.158.20.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	pilot.blaudden
# Root:	/home/msvensson/mysql/bug27490/my51-bug27490/RESYNC

--- 1.270/sql/log.cc	2007-03-21 14:17:03 +01:00
+++ 1.271/sql/log.cc	2007-03-28 18:37:26 +02:00
@@ -1714,7 +1714,7 @@ err:
 #ifdef __NT__
 static int eventSource = 0;
 
-void setup_windows_event_source()
+static void setup_windows_event_source()
 {
   HKEY    hRegKey= NULL;
   DWORD   dwError= 0;
@@ -4216,7 +4216,7 @@ static bool test_if_number(register cons
 } /* test_if_number */
 
 
-void print_buffer_to_file(enum loglevel level, const char *buffer)
+static void print_buffer_to_file(enum loglevel level, const char *buffer)
 {
   time_t skr;
   struct tm tm_tmp;
@@ -4314,23 +4314,15 @@ void MYSQL_BIN_LOG::signal_update()
 }
 
 #ifdef __NT__
-void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
-                                 uint length, int buffLen)
+static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
+                                        uint length, int buffLen)
 {
   HANDLE event;
-  char   *buffptr;
-  LPCSTR *buffmsgptr;
+  char   *buffptr= buff;
   DBUG_ENTER("print_buffer_to_nt_eventlog");
 
-  buffptr= buff;
-  if (length > (uint)(buffLen-5))
-  {
-    char *newBuff= new char[length + 5];
-    strcpy(newBuff, buff);
-    buffptr= newBuff;
-  }
-  strmov(buffptr+length, "\r\n\r\n");
-  buffmsgptr= (LPCSTR*) &buffptr;               // Keep windows happy
+  /* Add ending CR/LF's to string, overwrite last chars if necessary */
+  strmov(buffptr+min(length, buffLen-5), "\r\n\r\n");
 
   setup_windows_event_source();
   if ((event= RegisterEventSource(NULL,"MySQL")))
@@ -4338,24 +4330,20 @@ void print_buffer_to_nt_eventlog(enum lo
     switch (level) {
       case ERROR_LEVEL:
         ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
-                    buffmsgptr, NULL);
+                    (LPCSTR*)&buffptr, NULL);
         break;
       case WARNING_LEVEL:
         ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
-                    buffmsgptr, NULL);
+                    (LPCSTR*) &buffptr, NULL);
         break;
       case INFORMATION_LEVEL:
         ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1,
-                    0, buffmsgptr, NULL);
+                    0, (LPCSTR*) &buffptr, NULL);
         break;
     }
     DeregisterEventSource(event);
   }
 
-  /* if we created a string buffer, then delete it */
-  if (buffptr != buff)
-    delete[] buffptr;
-
   DBUG_VOID_RETURN;
 }
 #endif /* __NT__ */
@@ -4398,8 +4386,7 @@ int vprint_msg_to_log(enum loglevel leve
   uint length;
   DBUG_ENTER("vprint_msg_to_log");
 
-  /* "- 5" is because of print_buffer_to_nt_eventlog() */
-  length= my_vsnprintf(buff, sizeof(buff) - 5, format, args);
+  length= my_vsnprintf(buff, sizeof(buff), format, args);
   print_buffer_to_file(level, buff);
 
 #ifdef __NT__
Thread
bk commit into 5.1 tree (msvensson:1.2512)msvensson28 Mar