[bind10-dev] in order to build bind10-20120517 against log4cplus-1.1.0-rc5

John Lumby jlumby at bluecatnetworks.com
Wed Jun 6 19:23:11 UTC 2012


Hello Jinmei-San,

Yes,  I think you are correct,    my patch is not good.    I am not sure what is the best correction.
Maybe the method could allocate a new string() and cast it to tstring,  but I could not get that idea to work,
and in any case it would then leak memory unless reclaimed.

I will see if I can find out the expected call usage for this method now that the log4cplus has changed it to return a ref.

John

________________________________________
From: JINMEI Tatuya / 神明達哉 [jinmei at isc.org]
Sent: Wednesday, June 06, 2012 1:51 PM
To: John Lumby
Cc: bind10-dev at lists.isc.org
Subject: Re: [bind10-dev] in order to build bind10-20120517 against     log4cplus-1.1.0-rc5

At Wed, 6 Jun 2012 12:35:29 +0000,
John Lumby <jlumby at bluecatnetworks.com> wrote:

> --- src/lib/log/logger_level_impl.cc.orig     2011-11-02 09:46:32.000000000 -0400
> +++ src/lib/log/logger_level_impl.cc  2012-06-05 15:17:06.452296171 -0400
> @@ -185,7 +185,7 @@ LoggerLevelImpl::logLevelFromString(cons
>
>  // Convert logging level to string.  If the level is a valid debug level,
>  // return the string DEBUG, else return the empty string.
> -log4cplus::tstring
> +log4cplus::tstring const &
>  LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
>      Level bindlevel = convertToBindLevel(level);
>      Severity& severity = bindlevel.severity;

Just from a quick look, this doesn't seem to be correct because this
method returns a temporary object:

log4cplus::tstring
LoggerLevelImpl::logLevelToString(log4cplus::LogLevel level) {
[...]
    if ((severity == DEBUG) &&
        ((dbglevel >= MIN_DEBUG_LEVEL) && (dbglevel <= MAX_DEBUG_LEVEL))) {
        return (tstring("DEBUG"));
    }

    // Unknown, so return empty string for log4cplus to try other conversion
    // functions.
    return (tstring());
}

---
JINMEI, Tatuya
Internet Systems Consortium, Inc.


More information about the bind10-dev mailing list