[PATCH 2/9] s/long long/size_t/ for file line numbers in logging code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

The __LINE__ macro value is specified to fit in the size_t
type, so use that instead of 'long long' in the logging code

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/util/logging.c | 14 +++++++-------
 src/util/logging.h |  6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/util/logging.c b/src/util/logging.c
index 4222b92..f47b98f 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -99,7 +99,7 @@ static virLogPriority virLogDefaultPriority = VIR_LOG_DEFAULT;
 static int virLogResetFilters(void);
 static int virLogResetOutputs(void);
 static void virLogOutputToFd(const char *category, virLogPriority priority,
-                             const char *funcname, long long linenr,
+                             const char *funcname, size_t linenr,
                              const char *timestamp,
                              unsigned int flags,
                              const char *rawstr, const char *str,
@@ -605,7 +605,7 @@ cleanup:
 static int
 virLogFormatString(char **msg,
                    const char *funcname,
-                   long long linenr,
+                   size_t linenr,
                    virLogPriority priority,
                    const char *str)
 {
@@ -619,7 +619,7 @@ virLogFormatString(char **msg,
      * to just grep for it to find the right place.
      */
     if ((funcname != NULL)) {
-        ret = virAsprintf(msg, "%d: %s : %s:%lld : %s\n",
+        ret = virAsprintf(msg, "%d: %s : %s:%zu : %s\n",
                           virThreadSelfID(), virLogPriorityString(priority),
                           funcname, linenr, str);
     } else {
@@ -664,7 +664,7 @@ virLogVersionString(const char **rawmsg, char **msg)
  * the message may be stored, sent to output or just discarded
  */
 void virLogMessage(const char *category, virLogPriority priority, const char *funcname,
-                   long long linenr, unsigned int flags, const char *fmt, ...)
+                   size_t linenr, unsigned int flags, const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -686,7 +686,7 @@ void virLogMessage(const char *category, virLogPriority priority, const char *fu
  * the message may be stored, sent to output or just discarded
  */
 void virLogVMessage(const char *category, virLogPriority priority, const char *funcname,
-                    long long linenr, unsigned int flags, const char *fmt,
+                    size_t linenr, unsigned int flags, const char *fmt,
                     va_list vargs)
 {
     static bool logVersionStderr = true;
@@ -813,7 +813,7 @@ static void virLogStackTraceToFd(int fd)
 static void virLogOutputToFd(const char *category ATTRIBUTE_UNUSED,
                              virLogPriority priority ATTRIBUTE_UNUSED,
                              const char *funcname ATTRIBUTE_UNUSED,
-                             long long linenr ATTRIBUTE_UNUSED,
+                             size_t linenr ATTRIBUTE_UNUSED,
                              const char *timestamp,
                              unsigned int flags,
                              const char *rawstr ATTRIBUTE_UNUSED,
@@ -885,7 +885,7 @@ static int virLogPrioritySyslog(virLogPriority priority)
 static void virLogOutputToSyslog(const char *category ATTRIBUTE_UNUSED,
                                  virLogPriority priority,
                                  const char *funcname ATTRIBUTE_UNUSED,
-                                 long long linenr ATTRIBUTE_UNUSED,
+                                 size_t linenr ATTRIBUTE_UNUSED,
                                  const char *timestamp ATTRIBUTE_UNUSED,
                                  unsigned int flags,
                                  const char *rawstr ATTRIBUTE_UNUSED,
diff --git a/src/util/logging.h b/src/util/logging.h
index 88fb785..32d14a8 100644
--- a/src/util/logging.h
+++ b/src/util/logging.h
@@ -97,7 +97,7 @@ typedef enum {
  * Callback function used to output messages
  */
 typedef void (*virLogOutputFunc) (const char *category, virLogPriority priority,
-                                  const char *funcname, long long linenr,
+                                  const char *funcname, size_t linenr,
                                   const char *timestamp,
                                   unsigned int flags,
                                   const char *rawstr, const char *str,
@@ -139,11 +139,11 @@ extern int virLogParseDefaultPriority(const char *priority);
 extern int virLogParseFilters(const char *filters);
 extern int virLogParseOutputs(const char *output);
 extern void virLogMessage(const char *category, virLogPriority priority,
-                          const char *funcname, long long linenr,
+                          const char *funcname, size_t linenr,
                           unsigned int flags,
                           const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(6, 7);
 extern void virLogVMessage(const char *category, virLogPriority priority,
-                           const char *funcname, long long linenr,
+                           const char *funcname, size_t linenr,
                            unsigned int flags,
                            const char *fmt,
                            va_list vargs) ATTRIBUTE_FMT_PRINTF(6, 0);
-- 
1.7.11.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]