PROTON-2140: Remove unused error object from endpoints
- Another small but worthwhile gain - endpoint is used extensively.
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 @@
* 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 @@
* 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 @@
* 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_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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;}