You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Justin Ross (JIRA)" <ji...@apache.org> on 2016/11/04 14:14:58 UTC

[jira] [Updated] (PROTON-726) Macros to wrap malloc(), realloc(), free()

     [ https://issues.apache.org/jira/browse/PROTON-726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Ross updated PROTON-726:
-------------------------------
    Fix Version/s: Future

> Macros to wrap malloc(), realloc(), free()
> ------------------------------------------
>
>                 Key: PROTON-726
>                 URL: https://issues.apache.org/jira/browse/PROTON-726
>             Project: Qpid Proton
>          Issue Type: Wish
>          Components: proton-c
>    Affects Versions: 0.8
>            Reporter: German Shepherd (PrE)
>            Priority: Trivial
>             Fix For: Future
>
>
> As we are porting ProtonC across various platforms, we take the trunk code and use it in a specific project. I would like to be able to take any newer version from SVN and use it, without the need to modify it each every time, to suit the target system specifics.
> Therefore, I would like to kindly ask for an official support of macros to replace the memory allocation functions.
> Create a single global header file (or reuse some existing one, like the  platform.h), and add a three new macros to it.
> Having macros in place of general malloc(), realloc() and free() calls, will allow to keep the ported version easily update-able when new ProtonC version comes out (there won't be no need to manually go through all the files and replacing the calls with other calls).
> For Linux (or Windows), the macros will directly link to the default functions.
> For other OS(es), the developer will be able to just rewrite three lines of code and be all set.
> Example:
> {{pn_buffer_t *buf = (pn_buffer_t *)malloc(sizeof(pn_buffer_t));}}
> will get replaced with something like this
> {{pn_buffer_t *buf = (pn_buffer_t *)MALLOC_MACRO(sizeof(pn_buffer_t));}}
> where (for Linux) it will be:
> {{#define MALLOC_MACRO malloc}}
> or for other OS it might then be:
> {{#define MALLOC_MACRO customMalloc}}
> Of course, I do not care about the naming of the macros, or the actual code style. 
> I will leave all this on the official developers, I just ask to get such a functionality in.
> This change should have no impact on functionality, code size or speed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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