You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/11/26 14:15:21 UTC

[qpid-proton] 02/02: PROTON-2140: Remove unused error object from endpoints - Another small but worthwhile gain - endpoint is used extensively.

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 6be92fc56ea68187b9e36946790fe977db57809a
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Tue Nov 26 09:13:13 2019 -0500

    PROTON-2140: Remove unused error object from endpoints
    - Another small but worthwhile gain - endpoint is used extensively.
---
 c/include/proton/connection.h |  3 +++
 c/include/proton/link.h       |  3 +++
 c/include/proton/session.h    |  3 +++
 c/src/core/engine-internal.h  |  1 -
 c/src/core/engine.c           | 17 -----------------
 c/src/core/error.c            |  8 ++++++++
 6 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/c/include/proton/connection.h b/c/include/proton/connection.h
index ae8907b..9814828 100644
--- a/c/include/proton/connection.h
+++ b/c/include/proton/connection.h
@@ -130,6 +130,9 @@ PN_EXTERN void pn_connection_release(pn_connection_t *connection);
  * The pointer returned by this operation is valid until the
  * connection object is freed.
  *
+ * Deprecation notice: note that this will always return an empty
+ * error object
+ *
  * @param[in] connection the connection object
  * @return the connection's error object
  */
diff --git a/c/include/proton/link.h b/c/include/proton/link.h
index 0d45df9..c7e3f5b 100644
--- a/c/include/proton/link.h
+++ b/c/include/proton/link.h
@@ -176,6 +176,9 @@ PN_EXTERN pn_error_t *pn_link_error(pn_link_t *link);
  * The pointer returned by this operation is valid until the link
  * object is freed.
  *
+ * Deprecation notice: note that this will always return an empty
+ * error object
+ *
  * @param[in] link the link object
  * @return the link's local condition object
  */
diff --git a/c/include/proton/session.h b/c/include/proton/session.h
index d9118ac..8cbdb5b 100644
--- a/c/include/proton/session.h
+++ b/c/include/proton/session.h
@@ -118,6 +118,9 @@ PN_EXTERN pn_state_t pn_session_state(pn_session_t *session);
  * The pointer returned by this operation is valid until the
  * session object is freed.
  *
+ * Deprecation notice: note that this will always return an empty
+ * error object
+ *
  * @param[in] session the session object
  * @return the session's error object
  */
diff --git a/c/src/core/engine-internal.h b/c/src/core/engine-internal.h
index b8906eb..0df2d2f 100644
--- a/c/src/core/engine-internal.h
+++ b/c/src/core/engine-internal.h
@@ -44,7 +44,6 @@ struct pn_condition_t {
 struct pn_endpoint_t {
   pn_condition_t condition;
   pn_condition_t remote_condition;
-  pn_error_t *error;
   pn_endpoint_t *endpoint_next;
   pn_endpoint_t *endpoint_prev;
   pn_endpoint_t *transport_next;
diff --git a/c/src/core/engine.c b/c/src/core/engine.c
index 6767b28..f2e3072 100644
--- a/c/src/core/engine.c
+++ b/c/src/core/engine.c
@@ -389,7 +389,6 @@ void pn_endpoint_init(pn_endpoint_t *endpoint, int type, pn_connection_t *conn)
   endpoint->type = (pn_endpoint_type_t) type;
   endpoint->referenced = true;
   endpoint->state = PN_LOCAL_UNINIT | PN_REMOTE_UNINIT;
-  endpoint->error = pn_error();
   pn_condition_init(&endpoint->condition);
   pn_condition_init(&endpoint->remote_condition);
   endpoint->endpoint_next = NULL;
@@ -451,7 +450,6 @@ void pn_ep_decref(pn_endpoint_t *endpoint)
 
 static void pni_endpoint_tini(pn_endpoint_t *endpoint)
 {
-  pn_error_free(endpoint->error);
   pn_condition_tini(&endpoint->remote_condition);
   pn_condition_tini(&endpoint->condition);
 }
@@ -569,11 +567,6 @@ pn_state_t pn_connection_state(pn_connection_t *connection)
   return connection ? connection->endpoint.state : 0;
 }
 
-pn_error_t *pn_connection_error(pn_connection_t *connection)
-{
-  return connection ? connection->endpoint.error : NULL;
-}
-
 const char *pn_connection_get_container(pn_connection_t *connection)
 {
   assert(connection);
@@ -1075,11 +1068,6 @@ pn_state_t pn_session_state(pn_session_t *session)
   return session->endpoint.state;
 }
 
-pn_error_t *pn_session_error(pn_session_t *session)
-{
-  return session->endpoint.error;
-}
-
 static void pni_terminus_init(pn_terminus_t *terminus, pn_terminus_type_t type)
 {
   terminus->type = type;
@@ -1378,11 +1366,6 @@ pn_state_t pn_link_state(pn_link_t *link)
   return link->endpoint.state;
 }
 
-pn_error_t *pn_link_error(pn_link_t *link)
-{
-  return link->endpoint.error;
-}
-
 const char *pn_link_name(pn_link_t *link)
 {
   assert(link);
diff --git a/c/src/core/error.c b/c/src/core/error.c
index 070144a..f64c763 100644
--- a/c/src/core/error.c
+++ b/c/src/core/error.c
@@ -136,3 +136,11 @@ const char *pn_code(int code)
   default: return "<unknown>";
   }
 }
+
+// Deprecated ABI compatibility stubs
+// Make sure that no one is actually trying to change this.
+static const pn_error_t nullerror = {NULL, 0};
+
+pn_error_t *pn_connection_error(pn_connection_t *c) {return (pn_error_t*) &nullerror;}
+pn_error_t *pn_session_error(pn_session_t *c) {return (pn_error_t*) &nullerror;}
+pn_error_t *pn_link_error(pn_link_t *c) {return (pn_error_t*) &nullerror;}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org