
On 09/27/2012 10:44 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The __LINE__ macro value is specified to fit in the size_t
Not quite accurate. C99 merely says: 6.10.4 p3: ... a line number as specified by the digit sequence (interpreted as a decimal integer). The digit sequence shall not specify zero, nor a number greater than 2147483647. 6.10.8 p1: _ _LINE_ _ The presumed line number (within the current source file) of the current source line (an integer constant). So in fact, __LINE__ is guaranteed to fit within a 32-bit signed integer, and you could s/size_t/int/ with no loss in functionality since we don't port to 16-bit 'int' platforms. That said, I'm not too fussed with things; size_t is definitely better than 'long long', so I'm okay even if you don't further relax to 'int'.
type, so use that instead of 'long long' in the logging code
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/util/logging.c | 14 +++++++------- src/util/logging.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-)
Again, testing failed: testutils.c: In function 'virtTestMain': testutils.c:613:32: error: passing argument 1 of 'virLogDefineOutput' from incompatible pointer type [-Werror] In file included from testutils.c:47:0: ../src/util/logging.h:127:12: note: expected 'virLogOutputFunc' but argument is of type 'void (*)(const char *, enum virLogPriority, const char *, long long int, const char *, unsigned int, const char *, const char *, void *)' cc1: all warnings being treated as errors ACK with this squashed in (or the obvious change if you go all the way to int): diff --git i/tests/testutils.c w/tests/testutils.c index 86be3f5..a85f560 100644 --- i/tests/testutils.c +++ w/tests/testutils.c @@ -483,7 +483,7 @@ static void virtTestLogOutput(const char *category ATTRIBUTE_UNUSED, virLogPriority priority ATTRIBUTE_UNUSED, const char *funcname ATTRIBUTE_UNUSED, - long long lineno ATTRIBUTE_UNUSED, + size_t lineno ATTRIBUTE_UNUSED, const char *timestamp, unsigned int flags, const char *rawstr ATTRIBUTE_UNUSED, -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org