apps need to be able to pass in malloc, calloc, etc. functions to use. For example, 389 needs nunc-stans to use slapi_ch_malloc, etc.
Sorry - I forgot that the dirsrv signatures for slapi_ch_malloc etc. were non-standard. I think it would be better, more portable, more interoperable if nunc-stans used the standard signatures e.g. {{{ void malloc(size_t size); void free(void ptr); void calloc(size_t nmemb, size_t size); void realloc(void ptr, size_t size); }}} Then dirsrv would need to provide functions using these signatures, and cast parameters and return values to size_t and char .
New patches attached...
{{{ os_malloc(size_t size) 82 { 83 return malloc(size); }}} Please use 4 spaces for indentation in nunc-stans.
{{{ 1255 static char 1256 nunc_stans_malloc(size_t size) 1257 { 1258 return slapi_ch_malloc((unsigned long)size); 1259 } }}} These functions should use the exact same signatures as nunc-stans (and system malloc, etc.) - so something like this: {{{ static void * nunc_stans_malloc(size_t size) { return (void )slapi_ch_malloc((unsigned long)size); }
static void nunc_stans_calloc(size_t count, size_t size) { return (void )slapi_ch_calloc((unsigned long)count, (unsigned long)size); } }}} etc.
Replying to [comment:5 rmeggins]:
Whoops.
{{{ 1255 static char 1256 nunc_stans_malloc(size_t size) 1257 { 1258 return slapi_ch_malloc((unsigned long)size); 1259 } }}} These functions should use the exact same signatures as nunc-stans (and system malloc, etc.) - so something like this: {{{ static void * nunc_stans_malloc(size_t size) { return (void )slapi_ch_malloc((unsigned long)size); } static void nunc_stans_calloc(size_t count, size_t size) { return (void )slapi_ch_calloc((unsigned long)count, (unsigned long)size); } }}} etc.
My C book states that "char ", not "void " is used for the alloc functions. But the linux man page says otherwise. I'll change it...
nunc-stans patch - revision 0001-Ticket-48039-Allow-for-pluggable-malloc-calloc-etc.patch
Not sure what book you have.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf - 7.20.3 Memory management functions
DS patch - revision 0001-Ticket-48039-nunc-stans-malloc-should-be-pluggable.patch
Replying to [comment:7 rmeggins]:
Not sure what book you have. http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf - 7.20.3 Memory management functions
I have "C: A reference manual" 5th edition. It states its C99 compliant, etc. I just bought it not that long ago, err.
Anyway, new patches are attached...
To git+ssh://git.engineering.redhat.com/srv/git/users/mareynol/ds.git 050299e..5ab764a nunc-stans -> nunc-stans commit 5ab764ab17aa0edf214477b0da7123ba5d923b5e
To git+ssh://git.engineering.redhat.com/srv/git/users/mareynol/nunc-stans.git 5499cd4..c89dcbf mreynolds -> mreynolds commit c89dcbf94104d2ce92cc86ecee809a89b22dd508
nunc-stans part is now https://fedorahosted.org/nunc-stans/ticket/5
Metadata Update from @mreynolds: - Issue assigned to mreynolds - Issue set to the milestone: 1.3.4 backlog
389-ds-base is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in 389-ds-base's github repository.
This issue has been cloned to Github and is available here: - https://github.com/389ds/389-ds-base/issues/1370
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.
Metadata Update from @spichugi: - Issue close_status updated to: wontfix (was: Fixed)
Login to comment on this ticket.