Merge pull request #2155 from citusdata/valgrind_fix

valgrind tests fixed
pull/2143/head
Mehmet Furkan ŞAHİN 2018-05-10 10:46:02 +03:00 committed by GitHub
commit ae97df43be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -818,8 +818,7 @@ DefaultCitusNoticeProcessor(void *arg, const char *message)
MultiConnection *connection = (MultiConnection *) arg;
char *nodeName = connection->hostname;
uint32 nodePort = connection->port;
char *chompedMessage = pchomp(message);
char *trimmedMessage = TrimLogLevel(chompedMessage);
char *trimmedMessage = TrimLogLevel(message);
char *level = strtok((char *) message, ":");
ereport(CitusNoticeLogLevel, (errmsg("%s", trimmedMessage),
@ -829,7 +828,7 @@ DefaultCitusNoticeProcessor(void *arg, const char *message)
/*
* TrimLogLevel makes a copy of the string with the leading log level
* TrimLogLevel returns a copy of the string with the leading log level
* and spaces removed such as
* From:
* INFO: "normal2_102070": scanned 0 of 0 pages...
@ -839,17 +838,18 @@ DefaultCitusNoticeProcessor(void *arg, const char *message)
char *
TrimLogLevel(const char *message)
{
char *chompedMessage = pchomp(message);
size_t n;
n = 0;
while (n < strlen(message) && message[n] != ':')
while (n < strlen(chompedMessage) && chompedMessage[n] != ':')
{
n++;
}
do {
n++;
} while (n < strlen(message) && message[n] == ' ');
} while (n < strlen(chompedMessage) && chompedMessage[n] == ' ');
return pstrdup(message + n);
return chompedMessage + n;
}