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 19:06:01 UTC
[qpid-proton] branch master updated: PROTON-2148: Small
improvements to shared library sizes
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
The following commit(s) were added to refs/heads/master by this push:
new 3da78b5 PROTON-2148: Small improvements to shared library sizes
3da78b5 is described below
commit 3da78b5871e22724c0b16c5704ad8493705b3e45
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Tue Nov 26 13:59:38 2019 -0500
PROTON-2148: Small improvements to shared library sizes
---
c/include/proton/types.h | 4 ++--
c/src/core/autodetect.c | 2 +-
c/src/core/error.c | 14 ++++++--------
c/src/core/types.c | 3 +++
c/src/sasl/cyrus_sasl.c | 4 ++--
c/src/sasl/sasl.c | 4 ++--
6 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/c/include/proton/types.h b/c/include/proton/types.h
index 2619b5c..227c98d 100644
--- a/c/include/proton/types.h
+++ b/c/include/proton/types.h
@@ -221,7 +221,7 @@ typedef struct pn_bytes_t {
*/
PN_EXTERN pn_bytes_t pn_bytes(size_t size, const char *start);
-static const pn_bytes_t pn_bytes_null = { 0, NULL };
+PN_EXTERN extern const pn_bytes_t pn_bytes_null;
/**
* A non-const byte buffer.
@@ -240,7 +240,7 @@ typedef struct pn_rwbytes_t {
*/
PN_EXTERN pn_rwbytes_t pn_rwbytes(size_t size, char *start);
-static const pn_rwbytes_t pn_rwbytes_null = { 0, NULL };
+PN_EXTERN extern const pn_rwbytes_t pn_rwbytes_null;
/**
* Holds the state flags for an AMQP endpoint.
diff --git a/c/src/core/autodetect.c b/c/src/core/autodetect.c
index 00f6d98..aa56e6d 100644
--- a/c/src/core/autodetect.c
+++ b/c/src/core/autodetect.c
@@ -122,7 +122,7 @@ pni_protocol_type_t pni_sniff_header(const char *buf, size_t len)
const char* pni_protocol_name(pni_protocol_type_t p)
{
- static const char* names[] = {
+ static const char * const names[] = {
"Insufficient data to determine protocol",
"Unknown protocol",
"SSL/TLS connection",
diff --git a/c/src/core/error.c b/c/src/core/error.c
index 9554f69..5799b00 100644
--- a/c/src/core/error.c
+++ b/c/src/core/error.c
@@ -33,7 +33,6 @@
struct pn_error_t {
char *text;
- pn_error_t *root;
int code;
};
@@ -43,7 +42,6 @@ pn_error_t *pn_error()
if (error != NULL) {
error->code = 0;
error->text = NULL;
- error->root = NULL;
}
return error;
}
@@ -62,7 +60,6 @@ void pn_error_clear(pn_error_t *error)
error->code = 0;
free(error->text);
error->text = NULL;
- error->root = NULL;
}
}
@@ -142,9 +139,10 @@ const char *pn_code(int code)
}
// 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;}
+// Constant to make sure that no one tries to change this.
+static const pn_error_t pn_error_null = {NULL, 0};
+
+pn_error_t *pn_connection_error(pn_connection_t *c) {return (pn_error_t*) &pn_error_null;}
+pn_error_t *pn_session_error(pn_session_t *c) {return (pn_error_t*) &pn_error_null;}
+pn_error_t *pn_link_error(pn_link_t *c) {return (pn_error_t*) &pn_error_null;}
diff --git a/c/src/core/types.c b/c/src/core/types.c
index dbd18d0..0ca2bfc 100644
--- a/c/src/core/types.c
+++ b/c/src/core/types.c
@@ -21,6 +21,9 @@
#include <proton/types.h>
+const pn_bytes_t pn_bytes_null = { 0, NULL };
+const pn_rwbytes_t pn_rwbytes_null = { 0, NULL };
+
pn_bytes_t pn_bytes(size_t size, const char *start)
{
pn_bytes_t bytes = {size, start};
diff --git a/c/src/sasl/cyrus_sasl.c b/c/src/sasl/cyrus_sasl.c
index 27edad7..d98f3a3 100644
--- a/c/src/sasl/cyrus_sasl.c
+++ b/c/src/sasl/cyrus_sasl.c
@@ -92,7 +92,7 @@ const pnx_sasl_implementation * const cyrus_sasl_impl = &sasl_impl;
# define sasl_server_done()
#endif
-static const char *amqp_service = "amqp";
+static const char amqp_service[] = "amqp";
static inline bool pni_check_result(sasl_conn_t *conn, int r, pn_transport_t *logger, const char* condition_name)
{
@@ -165,7 +165,7 @@ static const sasl_callback_t pni_user_callbacks[] = {
// Machinery to initialise the cyrus library only once even in a multithreaded environment
// Relies on pthreads.
-static const char * const default_config_name = "proton-server";
+static const char default_config_name[] = "proton-server";
static char *pni_cyrus_config_dir = NULL;
static char *pni_cyrus_config_name = NULL;
static pthread_mutex_t pni_cyrus_mutex = PTHREAD_MUTEX_INITIALIZER;
diff --git a/c/src/sasl/sasl.c b/c/src/sasl/sasl.c
index c3f94ab..b901e9f 100644
--- a/c/src/sasl/sasl.c
+++ b/c/src/sasl/sasl.c
@@ -38,7 +38,7 @@
static const pnx_sasl_implementation *global_sasl_impl = NULL;
// List of SASL mechansms to exclude by default as they cause user pain
-static const char* pni_excluded_mechs = "GSSAPI GSS-SPNEGO GS2-KRB5 GS2-IAKERB";
+static const char pni_excluded_mechs[] = "GSSAPI GSS-SPNEGO GS2-KRB5 GS2-IAKERB";
//-----------------------------------------------------------------------------
// pnx_sasl: API for SASL implementations to use
@@ -410,7 +410,7 @@ static bool pni_sasl_server_included_mech(const char *included_mech_list, pn_byt
static bool pni_sasl_client_included_mech(const char *included_mech_list, pn_bytes_t s)
{
- if (!included_mech_list && pni_excluded_mechs) return !pni_sasl_included_mech(pni_excluded_mechs, s);
+ if (!included_mech_list) return !pni_sasl_included_mech(pni_excluded_mechs, s);
return pni_sasl_included_mech(included_mech_list, s);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org