On 11/15/10 18:26, Vincas Miliƫnas wrote:
The way I see this is that the code above handles the case when lhs string is in the local buffer and 
rhs is allocated. The exchange requires copying (lhs->data->buf into rhs->data->buf and 
rhs->data->ptr into lhs->data->ptr), since setting one's ptr to other's buf would be 
illegal. Also, the ptr and buf are in an union construct and overlap, therefore only one can be stored 
at a time.
You can copy whole union without knowing what field is used. This way you can implement it with only one else statement.

+    if (this == str)
+    {
Please try to follow coding style used in modified file (no space after if, new block bracket in the same line).


Reply via email to