modify PN_CLASSDEF macro to provide accessor for the pn_class_t
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0e155e29 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0e155e29 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0e155e29 Branch: refs/heads/cjansen-cpp-client Commit: 0e155e292ffbb2e3b6c054e47cad29ff3fc2aef5 Parents: 1fe0aa2 Author: Rafael Schloming <[email protected]> Authored: Tue May 12 10:56:39 2015 -0400 Committer: Rafael Schloming <[email protected]> Committed: Tue May 12 10:56:39 2015 -0400 ---------------------------------------------------------------------- proton-c/include/proton/object.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0e155e29/proton-c/include/proton/object.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/object.h b/proton-c/include/proton/object.h index 48d2872..83c3cba 100644 --- a/proton-c/include/proton/object.h +++ b/proton-c/include/proton/object.h @@ -101,7 +101,7 @@ static int PREFIX ## _inspect_cast(void *object, pn_string_t *str) { \ } \ } \ \ -PREFIX ## _t *PREFIX ## _new(void) { \ +const pn_class_t *PREFIX ## __class(void) { \ static const pn_class_t clazz = { \ #PREFIX, \ CID_ ## PREFIX, \ @@ -117,7 +117,12 @@ PREFIX ## _t *PREFIX ## _new(void) { \ PREFIX ## _compare_cast, \ PREFIX ## _inspect_cast \ }; \ - return (PREFIX ## _t *) pn_class_new(&clazz, sizeof(PREFIX ## _t)); \ + return &clazz; \ +} \ + \ +PREFIX ## _t *PREFIX ## _new(void) { \ + return (PREFIX ## _t *) pn_class_new(PREFIX ## __class(), \ + sizeof(PREFIX ## _t)); \ } #define PN_CLASS(PREFIX) { \ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
