[libvirt] [PATCH] __FUNCTION__ is not portable

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

 



# HG changeset patch
# User john.levon@xxxxxxx
# Date 1229399267 28800
# Node ID ee6ccfc062f49f514d7ae8924d5a596b18441fee
# Parent  b105e5a7cd6190e0b952a1587d7e80f39d02e63c
__FUNCTION__ is not portable

__func__ is. Some places aren't covered by the back-compat define (why
is that there?)

Signed-off-by: John Levon <john.levon@xxxxxxx>

diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c
--- a/examples/domain-events/events-c/event-test.c
+++ b/examples/domain-events/events-c/event-test.c
@@ -11,9 +11,9 @@
 #include <libvirt/libvirt.h>
 
 #define DEBUG0(fmt) printf("%s:%d :: " fmt "\n", \
-        __FUNCTION__, __LINE__)
+        __func__, __LINE__)
 #define DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", \
-        __FUNCTION__, __LINE__, __VA_ARGS__)
+        __func__, __LINE__, __VA_ARGS__)
 #define STREQ(a,b) (strcmp((a),(b)) == 0)
 
 #ifndef ATTRIBUTE_UNUSED
@@ -158,7 +158,7 @@ int myDomainEventCallback1 (virConnectPt
                             int detail,
                             void *opaque ATTRIBUTE_UNUSED)
 {
-    printf("%s EVENT: Domain %s(%d) %s %s\n", __FUNCTION__, virDomainGetName(dom),
+    printf("%s EVENT: Domain %s(%d) %s %s\n", __func__, virDomainGetName(dom),
            virDomainGetID(dom), eventToString(event),
            eventDetailToString(event, detail));
     return 0;
@@ -170,7 +170,7 @@ int myDomainEventCallback2 (virConnectPt
                             int detail,
                             void *opaque ATTRIBUTE_UNUSED)
 {
-    printf("%s EVENT: Domain %s(%d) %s %s\n", __FUNCTION__, virDomainGetName(dom),
+    printf("%s EVENT: Domain %s(%d) %s %s\n", __func__, virDomainGetName(dom),
            virDomainGetID(dom), eventToString(event),
            eventDetailToString(event, detail));
     return 0;
@@ -179,7 +179,7 @@ static void myFreeFunc(void *opaque)
 static void myFreeFunc(void *opaque)
 {
     char *str = opaque;
-    printf("%s: Freeing [%s]\n", __FUNCTION__, str);
+    printf("%s: Freeing [%s]\n", __func__, str);
     free(str);
 }
 
diff --git a/python/types.c b/python/types.c
--- a/python/types.c
+++ b/python/types.c
@@ -185,7 +185,7 @@ libvirt_virEventHandleCallbackWrap(virEv
 
     if (node == NULL) {
         Py_INCREF(Py_None);
-        printf("%s: WARNING - Wrapping None\n", __FUNCTION__);
+        printf("%s: WARNING - Wrapping None\n", __func__);
         return (Py_None);
     }
     ret =
@@ -200,7 +200,7 @@ libvirt_virEventTimeoutCallbackWrap(virE
     PyObject *ret;
 
     if (node == NULL) {
-        printf("%s: WARNING - Wrapping None\n", __FUNCTION__);
+        printf("%s: WARNING - Wrapping None\n", __func__);
         Py_INCREF(Py_None);
         return (Py_None);
     }

--
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]