This operation is to connect "bar" to the newly reallocated space "FOO", where ZSTR_VAL returns char*, ZSTR_LEN returns int .
Pointers can be understood as memory addresses. The pointer at the head of the existing space is ZSTR_VAL(foobar). Adding the length of space FOO backwards is the memory address at the end of FOOspace. Start from here. Memory copy, assign the value of bar (that is, ZSTR_VAL(bar)), and the length is ZSTR_LEN(bar).
This operation is to connect
"bar"
to the newly reallocated space"FOO"
,where
ZSTR_VAL
returnschar*
,ZSTR_LEN
returnsint
.Pointers can be understood as memory addresses. The pointer at the head of the existing space is
ZSTR_VAL(foobar)
. Adding the length of spaceFOO
backwards is the memory address at the end ofFOO
space. Start from here. Memory copy, assign the value ofbar
(that is,ZSTR_VAL(bar)
), and the length isZSTR_LEN(bar)
.