diff mbox

[04/14] qerror: drop qerror_report_internal()

Message ID 1343249431-9245-5-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino July 25, 2012, 8:50 p.m. UTC
It's not needed anymore and conflicts with future error improvements.

Also drops related error information, that is, the file where the error
ocurred, the line number and function. This has never been fully used.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qerror.c | 20 +++-----------------
 qerror.h |  8 +-------
 2 files changed, 4 insertions(+), 24 deletions(-)

Comments

Markus Armbruster July 26, 2012, 12:35 p.m. UTC | #1
Luiz Capitulino <lcapitulino@redhat.com> writes:

> It's not needed anymore and conflicts with future error improvements.
>
> Also drops related error information, that is, the file where the error
> ocurred, the line number and function. This has never been fully used.

Suggest "Subject: qerror: drop file, linenr, func", because that's the
interesting part.  qerror_report_internal() is merely detail.
diff mbox

Patch

diff --git a/qerror.c b/qerror.c
index 74b3659..8138186 100644
--- a/qerror.c
+++ b/qerror.c
@@ -105,27 +105,14 @@  static QDict *build_error_no_arg(const char *fmt)
 /**
  * qerror_from_info(): Create a new QError from error information
  *
- * The information consists of:
- *
- * - file   the file name of where the error occurred
- * - linenr the line number of where the error occurred
- * - func   the function name of where the error occurred
- * - fmt    JSON printf-like dictionary, there must exist keys 'class' and
- *          'data'
- * - va     va_list of all arguments specified by fmt
- *
  * Return strong reference.
  */
-static QError *qerror_from_info(const char *file, int linenr, const char *func,
-                                const char *fmt, va_list *va)
+static QError *qerror_from_info(const char *fmt, va_list *va)
 {
     QError *qerr;
 
     qerr = qerror_new();
     loc_save(&qerr->loc);
-    qerr->linenr = linenr;
-    qerr->file = file;
-    qerr->func = func;
 
     qerr->error = error_object_from_fmt(fmt, va);
     if (!qerr->error) {
@@ -259,14 +246,13 @@  static void qerror_print(QError *qerror)
     QDECREF(qstring);
 }
 
-void qerror_report_internal(const char *file, int linenr, const char *func,
-                            const char *fmt, ...)
+void qerror_report(const char *fmt, ...)
 {
     va_list va;
     QError *qerror;
 
     va_start(va, fmt);
-    qerror = qerror_from_info(file, linenr, func, fmt, &va);
+    qerror = qerror_from_info(fmt, &va);
     va_end(va);
 
     if (monitor_cur_is_qmp()) {
diff --git a/qerror.h b/qerror.h
index 4955310..929017c 100644
--- a/qerror.h
+++ b/qerror.h
@@ -28,19 +28,13 @@  typedef struct QError {
     QObject_HEAD;
     QDict *error;
     Location loc;
-    int linenr;
-    const char *file;
-    const char *func;
     const QErrorStringTable *entry;
 } QError;
 
 QString *qerror_human(const QError *qerror);
-void qerror_report_internal(const char *file, int linenr, const char *func,
-                            const char *fmt, ...) GCC_FMT_ATTR(4, 5);
+void qerror_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
 void qerror_report_err(Error *err);
 void assert_no_error(Error *err);
 QString *qerror_format(const char *fmt, QDict *error);
-#define qerror_report(fmt, ...) \
-    qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
 
 #endif /* QERROR_H */