sds icon indicating copy to clipboard operation
sds copied to clipboard

sdscat & sdscatsds in-place?

Open drkameleon opened this issue 6 years ago • 1 comments

As I've read in the reference and source when you pass an sds string to these two functions, you always have to assign the pointer back.

Is there any workaround to make these functions work in-place? That is: pass them an sds and have it modified? (without changing the object's pointer)

drkameleon avatar Jan 08 '20 16:01 drkameleon

I think you could make your own functions that take an sds pointer and assign to it with the original function, like

void sdscat_in_place(sds * sp, char * s){ *sp = sdscat(*sp,s); }

Otherwise I don't think there is any way for the original, which expects a copy of an address, to change the address of the original, which provided the copy.

MCRusher avatar Mar 20 '20 23:03 MCRusher