New API function (GC_objdup)

Ivan Maidanski <ivmai-JGs/[email protected]>
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <[email protected]>
 Hi Bruce,

The idea looks good to me. Does anyone have an idea how to have the requested functionality w/o adding a new function to GC?
Anyway, please provide a link to your commit on github (it would simplify contribution process).

Thank you

Wed,  4 Dec 2013, 10:40 +13:00 from Bruce Hoult <[email protected]>:
>Hi Ivan,
>
>..., for something I'm doing at the moment I feel a need for a function similar to GC_realloc(), except it doesn't free the old object (and doesn't change the size).
>
>I'm calling it GC_objdup(), to parallel GC_strdup() and GC_strndup().
>
>This can be easily implemented by the user by GC_size(); GC_malloc(); memcpy() except that I want the new object to be the same kind (normal/atomic etc) as the original. There doesn't seem to be a public API to get the object kind. GC_realloc() does the right thing in this regard.
>
>It's *possible* to get the effect I want from GC_realloc() by building the gc with IGNORE_FREE defined. Unfortunately this also changes the behaviour of free() if REDIRECT_FREE is defined, although this doesn't matter to me.
>
>How would you feel about adding GC_objdup() to the API if I submitted a patch for it?
>
>Bruce
>
>

_______________________________________________
Gc mailing list
Gc-V9/[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.