Mladen Turk wrote:
[EMAIL PROTECTED] wrote:
Author: rjung
Date: Tue Nov 20 09:29:26 2007
New Revision: 596747

URL: http://svn.apache.org/viewvc?rev=596747&view=rev
Log:
Add comments to explain timestamp formatting for sub seconds resolution.

Furthermore increased the accepted format length a bit.
Before we accepted JK_TIME_MAX_SIZE=64 bytes after replacing
the first subsecond format character, now we accept the same size
before replacing the formatting character.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_util.c


Hmm, you still have

const char * log_fmt_subsec
...
char *fmt = malloc( ...)
...
l->log_fmt_subsec = fmt;
...
free(l->log_fmt_subsec)

That's not good.

Why don't you declare
char log_fmt_subsec[SOME_MAX_SIZE] instead having it as const char* ?

I wasn't sure about which way is better. The const char doesn't say the pointer is const, but we don't change the contents of the string. And in fact once we assign the pointer to log_fmt_subsec (and the same for log_fmt), we don't change it - except when calling free, where we immediately replace the pointer by another const char afterwards. So somehow the semantics of const char* are still there (and in fact we don't want to change the string as long as we use it).

But I'm open. If we remove the const, we also need to remove it for the log_fmt (got as compiler warning also there, but don't have the line number at hand).

Which would you prefer? Do you see a problem with the const, like wrong compiler optimization or so?

Regards,
Mladen

Regards,

Rainer

P.S.: You win the prize for the fastest reviewer :)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to