mu: don't use __FUNCTION__, use __func__

__FUNCTION__ is deprecated and gives compilation warnings. __func__ is
standardized in c99.
This commit is contained in:
djcb 2015-04-22 21:06:31 +03:00
parent 0ffbb2e5f6
commit 7eb244b3b0
19 changed files with 49 additions and 50 deletions

View File

@ -1,4 +1,4 @@
## Copyright (C) 2008-2014 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
## Copyright (C) 2008-2015 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ AC_SUBST(prefix)
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CC_C99
AC_PROG_INSTALL
AC_HEADER_STDC

View File

@ -106,7 +106,7 @@ mu_guile_init_instance (const char *muhome)
return TRUE;
errexit:
mu_guile_g_error (__FUNCTION__, err);
mu_guile_g_error (__func__, err);
g_clear_error (&err);
return FALSE;
}

View File

@ -245,7 +245,7 @@ on_run_maildir_dir (const char* fullpath, gboolean enter,
data->_user_data);
if (err) {
MU_WRITE_LOG ("%s: %s", __FUNCTION__, err->message);
MU_WRITE_LOG ("%s: %s", __func__, err->message);
g_clear_error(&err);
}
@ -259,13 +259,13 @@ check_path (const char *path)
if (!g_path_is_absolute (path)) {
g_warning ("%s: not an absolute path: %s",
__FUNCTION__, path);
__func__, path);
return FALSE;
}
if (access (path, R_OK) != 0) {
g_warning ("%s: cannot open '%s': %s",
__FUNCTION__, path, strerror (errno));
__func__, path, strerror (errno));
return FALSE;
}

View File

@ -67,7 +67,7 @@ try_close (int fd)
if (close (fd) < 0)
g_printerr ("%s: close() of fd %d failed: %s\n",
__FUNCTION__, fd, strerror(errno));
__func__, fd, strerror(errno));
}
static void
@ -190,7 +190,7 @@ mu_log_init (const char* logfile, MuLogOptions opts)
fd = open (logfile, O_WRONLY|O_CREAT|O_APPEND, 00600);
if (fd < 0) {
g_warning ("%s: open() of '%s' failed: %s", __FUNCTION__,
g_warning ("%s: open() of '%s' failed: %s", __func__,
logfile, strerror(errno));
return FALSE;
}
@ -275,7 +275,7 @@ log_write_fd (GLogLevelFlags level, const gchar *msg)
err:
fprintf (stderr, "%s: failed to write to log: %s\n",
__FUNCTION__, strerror(errno));
__func__, strerror(errno));
}

View File

@ -117,7 +117,7 @@ mu_maildir_mkdir (const char* path, mode_t mode, gboolean noindex, GError **err)
{
g_return_val_if_fail (path, FALSE);
MU_WRITE_LOG ("%s (%s, %o, %s)", __FUNCTION__,
MU_WRITE_LOG ("%s (%s, %o, %s)", __func__,
path, mode, noindex ? "TRUE" : "FALSE");
if (!create_maildir (path, mode, err))
@ -238,7 +238,7 @@ process_file (const char* fullpath, const gchar* mdir,
g_debug ("callback said 'MU_STOP' for %s", fullpath);
else if (result == MU_ERROR)
g_warning ("%s: error in callback (%s)",
__FUNCTION__, fullpath);
__func__, fullpath);
return result;
}
@ -735,7 +735,7 @@ mu_maildir_get_maildir_from_path (const char* path)
if (!g_str_has_suffix (mdir, "cur") &&
!g_str_has_suffix (mdir, "new")) {
g_warning ("%s: not a valid maildir path: %s",
__FUNCTION__, path);
__func__, path);
g_free (mdir);
return NULL;
}

View File

@ -451,7 +451,7 @@ stream_to_string (GMimeStream *stream, size_t buflen)
/* we read everything in one go */
bytes = g_mime_stream_read (stream, buffer, buflen);
if (bytes < 0) {
g_warning ("%s: failed to read from stream", __FUNCTION__);
g_warning ("%s: failed to read from stream", __func__);
g_free (buffer);
return NULL;
}
@ -695,7 +695,7 @@ mu_msg_file_get_str_field (MuMsgFile *self, MuMsgFieldId mfid,
case MU_MSG_FIELD_ID_BODY_HTML: /* use mu_msg_get_body_html */
case MU_MSG_FIELD_ID_EMBEDDED_TEXT:
g_warning ("%s is not retrievable through: %s",
mu_msg_field_name (mfid), __FUNCTION__);
mu_msg_field_name (mfid), __func__);
return NULL;
default: g_return_val_if_reached (NULL);

View File

@ -209,7 +209,7 @@ get_path (MuMsg *self)
/* shouldn't happen */
if (!val)
g_warning ("%s: cannot find path", __FUNCTION__);
g_warning ("%s: cannot find path", __func__);
return free_later_str (self, val);
}

View File

@ -77,7 +77,7 @@ public:
}
MU_WRITE_LOG ("%s: opened %s (batch size: %u) for read-write",
__FUNCTION__, this->path(), (unsigned)batch_size());
__func__, this->path(), (unsigned)batch_size());
}
/* create a read-only MuStore */
@ -97,7 +97,7 @@ public:
g_free (errstr);
throw exc;
}
MU_WRITE_LOG ("%s: opened %s read-only", __FUNCTION__, this->path());
MU_WRITE_LOG ("%s: opened %s read-only", __func__, this->path());
}
void init (const char *path, const char *contacts_path,

View File

@ -108,7 +108,7 @@ mu_store_database_is_locked (const gchar *xpath)
} catch (const Xapian::DatabaseLockError& xer) {
return TRUE;
} catch (const Xapian::Error &xer) {
g_warning ("%s: error: %s", __FUNCTION__,
g_warning ("%s: error: %s", __func__,
xer.get_msg().c_str());
}

View File

@ -888,7 +888,7 @@ mu_str_convert_to_utf8 (const char* buffer, const char *charset)
if (!utf8) {
g_warning ("%s: conversion failed from %s: %s",
__FUNCTION__, charset, err ? err->message : "");
__func__, charset, err ? err->message : "");
}
g_clear_error (&err);

View File

@ -55,12 +55,12 @@ do_wordexp (const char *path)
char *dir;
if (!path) {
/* g_debug ("%s: path is empty", __FUNCTION__); */
/* g_debug ("%s: path is empty", __func__); */
return NULL;
}
if (wordexp (path, &wexp, 0) != 0) {
/* g_debug ("%s: expansion failed for %s", __FUNCTION__, path); */
/* g_debug ("%s: expansion failed for %s", __func__, path); */
return NULL;
}
@ -108,7 +108,7 @@ mu_util_dir_expand (const char *path)
/* now resolve any symlinks, .. etc. */
if (realpath (dir, resolved) == NULL) {
/* g_debug ("%s: could not get realpath for '%s': %s", */
/* __FUNCTION__, dir, strerror(errno)); */
/* __func__, dir, strerror(errno)); */
g_free (dir);
return NULL;
} else

View File

@ -313,7 +313,7 @@ typedef gpointer XapianEnquire;
do { \
if (!(GE)) \
g_warning ("%s:%u: an error occured in %s", \
__FILE__, __LINE__, __FUNCTION__); \
__FILE__, __LINE__, __func__); \
else { \
g_warning ("error %u: %s", (GE)->code, (GE)->message); \
g_error_free ((GE)); \
@ -339,9 +339,9 @@ typedef gpointer XapianEnquire;
#define MU_XAPIAN_CATCH_BLOCK \
catch (const Xapian::Error &xerr) { \
g_critical ("%s: xapian error '%s'", \
__FUNCTION__, xerr.get_msg().c_str()); \
__func__, xerr.get_msg().c_str()); \
} catch (...) { \
g_critical ("%s: caught exception", __FUNCTION__); \
g_critical ("%s: caught exception", __func__); \
}
#define MU_XAPIAN_CATCH_BLOCK_G_ERROR(GE,E) \
@ -349,33 +349,33 @@ typedef gpointer XapianEnquire;
mu_util_g_set_error ((GE), \
MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK, \
"%s: xapian error '%s'", \
__FUNCTION__, xerr.get_msg().c_str()); \
__func__, xerr.get_msg().c_str()); \
} catch (const Xapian::DatabaseCorruptError &xerr) { \
mu_util_g_set_error ((GE), \
MU_ERROR_XAPIAN_CORRUPTION, \
"%s: xapian error '%s'", \
__FUNCTION__, xerr.get_msg().c_str()); \
__func__, xerr.get_msg().c_str()); \
} catch (const Xapian::DatabaseError &xerr) { \
mu_util_g_set_error ((GE),MU_ERROR_XAPIAN, \
"%s: xapian error '%s'", \
__FUNCTION__, xerr.get_msg().c_str()); \
__func__, xerr.get_msg().c_str()); \
} catch (const Xapian::Error &xerr) { \
mu_util_g_set_error ((GE),(E), \
"%s: xapian error '%s'", \
__FUNCTION__, xerr.get_msg().c_str()); \
__func__, xerr.get_msg().c_str()); \
} catch (...) { \
mu_util_g_set_error ((GE),(MU_ERROR_INTERNAL), \
"%s: caught exception", __FUNCTION__); \
"%s: caught exception", __func__); \
}
#define MU_XAPIAN_CATCH_BLOCK_RETURN(R) \
catch (const Xapian::Error &xerr) { \
g_critical ("%s: xapian error '%s'", \
__FUNCTION__, xerr.get_msg().c_str()); \
__func__, xerr.get_msg().c_str()); \
return (R); \
} catch (...) { \
g_critical ("%s: caught exception", __FUNCTION__); \
g_critical ("%s: caught exception", __func__); \
return (R); \
}
@ -383,13 +383,13 @@ typedef gpointer XapianEnquire;
catch (const Xapian::Error &xerr) { \
mu_util_g_set_error ((GE),(E), \
"%s: xapian error '%s'", \
__FUNCTION__, xerr.get_msg().c_str()); \
__func__, xerr.get_msg().c_str()); \
return (R); \
} catch (...) { \
if ((GE)&&!(*(GE))) \
mu_util_g_set_error ((GE), \
(MU_ERROR_INTERNAL), \
"%s: caught exception", __FUNCTION__); \
"%s: caught exception", __func__); \
return (R); \
}

View File

@ -160,7 +160,7 @@ test_mu_flags_custom_from_str (void)
cust = mu_flags_custom_from_str (cases[u].str);
if (g_test_verbose())
g_print ("%s: str:%s; got:%s; expected:%s\n",
__FUNCTION__, cases[u].str, cust, cases[u].expected);
__func__, cases[u].str, cust, cases[u].expected);
g_assert_cmpstr (cust, ==, cases[u].expected);
g_free (cust);
}

View File

@ -227,7 +227,7 @@ dir_cb (const char *fullpath, gboolean enter, WalkData *data)
++data->_dir_left;
if (g_test_verbose())
g_print ("%s: %s: %s (%u)\n", __FUNCTION__, enter ? "entering" : "leaving",
g_print ("%s: %s: %s (%u)\n", __func__, enter ? "entering" : "leaving",
fullpath, enter ? data->_dir_entered : data->_dir_left);
return MU_OK;

View File

@ -134,7 +134,7 @@ print_expr (const char* frm, ...)
rv = write (outfd, "\n", 1);
if (rv == -1) {
g_critical ("%s: write() failed: %s",
__FUNCTION__, strerror(errno));
__func__, strerror(errno));
/* terminate ourselves */
raise (SIGTERM);
}
@ -976,14 +976,12 @@ cmd_find (ServerContext *ctx, GHashTable *args, GError **err)
static MuError
cmd_guile (ServerContext *ctx, GHashTable *args, GError **err)
{
const char *script, *file;
const char *eval;
script = get_string_from_args (args, "script", TRUE, NULL);
file = get_string_from_args (args, "file", TRUE, NULL);
if (!script == !file) {
print_error (MU_ERROR_IN_PARAMETERS,
"guile: must provide one of 'script', 'file'");
eval = get_string_from_args (args, "eval", TRUE, NULL);
if (!eval) {
print_error (MU_ERROR_IN_PARAMETERS, "guile: expected: 'eval'");
return MU_OK;
}

View File

@ -74,7 +74,7 @@ save_file_for_cid (MuMsg *msg, const char* cid)
idx = mu_msg_find_index_for_cid (msg, MU_MSG_OPTION_NONE, cid);
if (idx < 0) {
g_warning ("%s: cannot find %s", __FUNCTION__, cid);
g_warning ("%s: cannot find %s", __func__, cid);
return NULL;
}
@ -90,7 +90,7 @@ save_file_for_cid (MuMsg *msg, const char* cid)
return filepath;
errexit:
g_warning ("%s: failed to save %s: %s", __FUNCTION__,
g_warning ("%s: failed to save %s: %s", __func__,
filepath,
err&&err->message?err->message:"error");
g_clear_error (&err);

View File

@ -253,7 +253,7 @@ each_part (MuMsg *msg, MuMsgPart *part, CBData *cbdata)
pixbuf = mu_widget_util_get_icon_pixbuf_for_content_type (ctype, 16);
if (!pixbuf) {
g_debug ("%s: could not get icon pixbuf for '%s'",
__FUNCTION__, ctype);
__func__, ctype);
pixbuf = mu_widget_util_get_icon_pixbuf_for_content_type
("application/octet-stream", 16);
}

View File

@ -110,7 +110,7 @@ save_file_for_cid (MuMsg *msg, const char* cid)
idx = mu_msg_find_index_for_cid (msg, MU_MSG_OPTION_NONE, cid);
if (idx < 0) {
g_warning ("%s: cannot find %s", __FUNCTION__, cid);
g_warning ("%s: cannot find %s", __func__, cid);
return NULL;
}
@ -124,7 +124,7 @@ save_file_for_cid (MuMsg *msg, const char* cid)
rv = mu_msg_part_save (msg, MU_MSG_OPTION_USE_EXISTING,
filepath, idx, &err);
if (!rv) {
g_warning ("%s: failed to save %s: %s", __FUNCTION__, filepath,
g_warning ("%s: failed to save %s: %s", __func__, filepath,
err&&err->message?err->message:"error");
g_clear_error (&err);
g_free (filepath);
@ -193,7 +193,7 @@ on_resource_request_starting (MuMsgBodyView *self, WebKitWebFrame *frame,
msg = self->_priv->_msg;
uri = webkit_network_request_get_uri (request);
/* g_warning ("%s: %s", __FUNCTION__, uri); */
/* g_warning ("%s: %s", __func__, uri); */
if (g_ascii_strncasecmp (uri, "cid:", 4) == 0) {
gchar *filepath;

View File

@ -382,7 +382,7 @@ add_row (GtkTreeStore * store, MuMsg *msg, GtkTreeIter *treeiter)
/* if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(store), */
/* &myiter, path)) */
/* g_warning ("%s: cannot get iter for %s",
* __FUNCTION__, path); */
* __func__, path); */
/* } */
gtk_tree_store_set (store, treeiter,