[beast: 3/6] BSE: use __func__ to print error messages



commit c69802ae2e764d5b5cdb2b40126a1bdb89d159d8
Author: Tim Janik <timj gnu org>
Date:   Thu Sep 24 23:32:57 2015 +0200

    BSE: use __func__ to print error messages

 bse/bsecxxutils.hh     |    2 +-
 bse/bseenginemaster.cc |    2 +-
 bse/bseparasite.proc   |    2 +-
 bse/bsepart.cc         |    2 +-
 bse/bseplugin.cc       |    8 ++++----
 bse/bseprobe.cc        |    2 +-
 bse/bsesequencer.cc    |    4 ++--
 bse/bsesong.cc         |    2 +-
 bse/bsesource.cc       |    4 ++--
 bse/bsetype.cc         |   12 ++++++------
 10 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/bse/bsecxxutils.hh b/bse/bsecxxutils.hh
index 3f21389..b455750 100644
--- a/bse/bsecxxutils.hh
+++ b/bse/bsecxxutils.hh
@@ -72,7 +72,7 @@ struct InvalidArgument2 : Exception {
   InvalidArgument2 (const char *where, const char *item) : Exception (where), item (item) {};
   const char* what() const throw() { return g_intern_strconcat ("invalid argument: ", item, NULL); }
 };
-#define InvalidArgument(WHAT)   InvalidArgument2 (G_STRFUNC, #WHAT)
+#define InvalidArgument(WHAT)   InvalidArgument2 (__func__, #WHAT)
 struct WrongTypeGValue : Exception {
   WrongTypeGValue (const char *where) : Exception (where) {};
   const char* what() const throw() { return "GValue contains wrong type for this kind of use"; }
diff --git a/bse/bseenginemaster.cc b/bse/bseenginemaster.cc
index eb06940..a5327c3 100644
--- a/bse/bseenginemaster.cc
+++ b/bse/bseenginemaster.cc
@@ -1162,7 +1162,7 @@ MasterThread::master_thread()
          if (err >= 0)
            loop.revents_filled = TRUE;
          else if (errno != EINTR)
-           printerr ("%s: poll() error: %s\n", G_STRFUNC, g_strerror (errno));
+           printerr ("%s: poll() error: %s\n", __func__, g_strerror (errno));
          if (loop.revents_filled)
            need_dispatch = _engine_master_check (&loop);
        }
diff --git a/bse/bseparasite.proc b/bse/bseparasite.proc
index 6fe4223..c1371d9 100644
--- a/bse/bseparasite.proc
+++ b/bse/bseparasite.proc
@@ -86,6 +86,6 @@ METHOD (BseItem, add-parasite) {
   path = bse_item_create_parasite_name (item, path);
   if (path)
     bse_item_set_parasite (item, path, rec);
-  printout ("%s: %s: %p\n", G_STRFUNC, path, rec);
+  printerr ("%s: %s: %p\n", __func__, path, rec);
   return Bse::ERROR_NONE;
 }
diff --git a/bse/bsepart.cc b/bse/bsepart.cc
index 89d2776..c66f491 100644
--- a/bse/bsepart.cc
+++ b/bse/bsepart.cc
@@ -1797,7 +1797,7 @@ bse_part_controls_remove (BsePartControls     *self,
         break;
       }
   if (!cev)
-    g_warning ("%s: failed to remove event at tick=%u", G_STRFUNC, tick);
+    g_warning ("%s: failed to remove event at tick=%u", __func__, tick);
   else if (!node->events)
     {
       /* remove node */
diff --git a/bse/bseplugin.cc b/bse/bseplugin.cc
index 9115936..7770011 100644
--- a/bse/bseplugin.cc
+++ b/bse/bseplugin.cc
@@ -72,7 +72,7 @@ bse_plugin_dispose (GObject *object)
   BsePlugin *plugin = BSE_PLUGIN (object);
 
   if (plugin->gmodule || plugin->use_count || plugin->n_types)
-    g_warning ("%s: plugin partially initialized during destruciton", G_STRFUNC);
+    g_warning ("%s: plugin partially initialized during destruciton", __func__);
 
   /* chain parent class handler */
   G_OBJECT_CLASS (g_type_class_peek_parent (BSE_PLUGIN_GET_CLASS (plugin)))->dispose (object);
@@ -84,7 +84,7 @@ bse_plugin_finalize (GObject *object)
   BsePlugin *plugin = BSE_PLUGIN (object);
 
   if (plugin->gmodule || plugin->use_count || plugin->n_types)
-    g_warning ("%s: plugin partially initialized during destruciton", G_STRFUNC);
+    g_warning ("%s: plugin partially initialized during destruciton", __func__);
 
   /* chain parent class handler */
   G_OBJECT_CLASS (g_type_class_peek_parent (BSE_PLUGIN_GET_CLASS (plugin)))->finalize (object);
@@ -202,7 +202,7 @@ bse_exports__add_node (const BseExportIdentity *identity,
                        BseExportNode           *enode)
 {
   if (!startup_plugin)
-    g_error ("%s: plugin startup called without plugin", G_STRFUNC);
+    g_error ("%s: plugin startup called without plugin", __func__);
   if (!enode || enode->next)
     return NULL;
   if (identity->major != BST_MAJOR_VERSION ||
@@ -279,7 +279,7 @@ bse_exports__del_node (BsePlugin               *plugin,
 {
   if (!plugin || !enode)
     {
-      g_warning ("%s: invalid plugin shutdown", G_STRFUNC);
+      g_warning ("%s: invalid plugin shutdown", __func__);
       return;
     }
   BseExportNode *last = NULL, *link;
diff --git a/bse/bseprobe.cc b/bse/bseprobe.cc
index d09cd70..82df386 100644
--- a/bse/bseprobe.cc
+++ b/bse/bseprobe.cc
@@ -246,7 +246,7 @@ public:
             first_stamp = tick_stamp;                   /* record probe stamp */
           }
         else if (tick_stamp != first_stamp + n_computed)
-          probe_xrun = true; // printerr ("%s: gap in probe block: %lld\n", G_STRFUNC, tick_stamp - 
first_stamp - n_computed);
+          probe_xrun = true; // printerr ("%s: gap in probe block: %lld\n", __func__, tick_stamp - 
first_stamp - n_computed);
         /* compute features */
         uint n = block_size - n_computed;
         if (n)
diff --git a/bse/bsesequencer.cc b/bse/bsesequencer.cc
index ffb0187..fc49156 100644
--- a/bse/bsesequencer.cc
+++ b/bse/bsesequencer.cc
@@ -186,7 +186,7 @@ Sequencer::remove_io_watch (BseIOWatch watch_func, void *watch_data)
     }
   BSE_SEQUENCER_UNLOCK();
   if (!removal_success)
-    g_warning ("%s: failed to remove %p(%p)", G_STRFUNC, watch_func, watch_data);
+    g_warning ("%s: failed to remove %p(%p)", __func__, watch_func, watch_data);
 }
 
 bool
@@ -201,7 +201,7 @@ Sequencer::pool_poll_Lm (gint timeout_ms)
   BSE_SEQUENCER_UNLOCK();
   int result = poll ((struct pollfd*) pfds, n_pfds, timeout_ms);
   if (result < 0 && errno != EINTR)
-    printerr ("%s: poll() error: %s\n", G_STRFUNC, g_strerror (errno));
+    printerr ("%s: poll() error: %s\n", __func__, g_strerror (errno));
   BSE_SEQUENCER_LOCK();
   if (result > 0 && pfds[0].revents)
     {
diff --git a/bse/bsesong.cc b/bse/bsesong.cc
index a539b79..19fde7b 100644
--- a/bse/bsesong.cc
+++ b/bse/bsesong.cc
@@ -526,7 +526,7 @@ bse_song_create_summation (BseSong *self)
 {
   GType type = g_type_from_name ("BseSummation");
   if (!g_type_is_a (type, BSE_TYPE_SOURCE))
-    g_error ("%s: failed to resolve %s object type, probably missing or broken plugin installation", 
G_STRFUNC, "BseSummation");
+    g_error ("%s: failed to resolve %s object type, probably missing or broken plugin installation", 
__func__, "BseSummation");
   BseSource *summation = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), type, "uname", 
"Summation", NULL);
   assert (summation != NULL);
   bse_snet_intern_child (BSE_SNET (self), summation);
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index f15310b..412a9b6 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -211,7 +211,7 @@ bse_source_class_add_ijchannel (BseSourceClass *source_class,
   if (bse_source_class_has_channel (source_class, cname))
     {
       g_warning ("%s: attempt to reregister channel \"%s\" with source class `%s'",
-                 G_STRFUNC, cname, G_OBJECT_CLASS_NAME (source_class));
+                 __func__, cname, G_OBJECT_CLASS_NAME (source_class));
       g_free (cname);
       return ~0;
     }
@@ -287,7 +287,7 @@ bse_source_class_add_ochannel (BseSourceClass *source_class,
   if (bse_source_class_has_channel (source_class, cname))
     {
       g_warning ("%s: attempt to reregister channel \"%s\" with source class `%s'",
-                 G_STRFUNC, cname, G_OBJECT_CLASS_NAME (source_class));
+                 __func__, cname, G_OBJECT_CLASS_NAME (source_class));
       g_free (cname);
       return ~0;
     }
diff --git a/bse/bsetype.cc b/bse/bsetype.cc
index 11afb7a..6ff6ede 100644
--- a/bse/bsetype.cc
+++ b/bse/bsetype.cc
@@ -165,7 +165,7 @@ bse_boxed_value_free (GValue *value)
       if (bnode)
         bnode->free (value->data[0].v_pointer);
       else
-        g_critical ("%s: %s due to missing implementation: %s", G_STRFUNC, "leaking boxed structure", 
g_type_name (G_VALUE_TYPE (value)));
+        g_critical ("%s: %s due to missing implementation: %s", __func__, "leaking boxed structure", 
g_type_name (G_VALUE_TYPE (value)));
     }
 }
 
@@ -180,7 +180,7 @@ bse_boxed_value_copy (const GValue *src_value,
       if (bnode)
         dest_value->data[0].v_pointer = bnode->copy (src_value->data[0].v_pointer);
       else
-        g_critical ("%s: %s due to missing implementation: %s", G_STRFUNC, "not copying boxed structure", 
g_type_name (G_VALUE_TYPE (src_value)));
+        g_critical ("%s: %s due to missing implementation: %s", __func__, "not copying boxed structure", 
g_type_name (G_VALUE_TYPE (src_value)));
     }
 }
 
@@ -211,7 +211,7 @@ bse_boxed_collect_value (GValue      *value,
           if (bnode)
             value->data[0].v_pointer = bnode->copy (collect_values[0].v_pointer);
           else
-            g_critical ("%s: %s due to missing implementation: %s", G_STRFUNC, "not copying boxed 
structure", g_type_name (G_VALUE_TYPE (value)));
+            g_critical ("%s: %s due to missing implementation: %s", __func__, "not copying boxed structure", 
g_type_name (G_VALUE_TYPE (value)));
         }
     }
   return NULL;
@@ -236,7 +236,7 @@ bse_boxed_lcopy_value (const GValue *value,
       if (bnode)
         *boxed_p = bnode->copy (value->data[0].v_pointer);
       else
-        g_critical ("%s: %s due to missing implementation: %s", G_STRFUNC, "not copying boxed structure", 
g_type_name (G_VALUE_TYPE (value)));
+        g_critical ("%s: %s due to missing implementation: %s", __func__, "not copying boxed structure", 
g_type_name (G_VALUE_TYPE (value)));
     }
   return NULL;
 }
@@ -249,7 +249,7 @@ bse_boxed_to_record (const GValue *src_value,
   if (bnode)
     bnode->boxed2recseq (src_value, dest_value);
   else
-    g_critical ("%s: %s due to missing implementation: %s", G_STRFUNC, "not converting boxed structure", 
g_type_name (G_VALUE_TYPE (src_value)));
+    g_critical ("%s: %s due to missing implementation: %s", __func__, "not converting boxed structure", 
g_type_name (G_VALUE_TYPE (src_value)));
 }
 
 static void
@@ -260,7 +260,7 @@ bse_boxed_from_record (const GValue *src_value,
   if (bnode)
     bnode->seqrec2boxed (src_value, dest_value);
   else
-    g_critical ("%s: %s due to missing implementation: %s", G_STRFUNC, "not converting boxed structure", 
g_type_name (G_VALUE_TYPE (dest_value)));
+    g_critical ("%s: %s due to missing implementation: %s", __func__, "not converting boxed structure", 
g_type_name (G_VALUE_TYPE (dest_value)));
 }
 
 GType


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