https://github.com/antirez/redis/blob/fdb575993f947425920aadc5a321daf22f0198c3/src/sds.c#L95

Comment From: trevor211

No, it's not redundant. If initlen < 1<<5, type is SDS_TYPE_5. But only if initlen is 0 we want to change type to SDS_TYPE_8.

Comment From: oranagra

i think he meant that when initlen is 0, sdsReqType is guaranteed to return SDS_TYPE_5. so maybe it would have been enough to just check initlen, and in that case use SDS_TYPE_8 and don't even bother to call sdsReqType.

But i personally think the way the code is currently written is more straight forward and clear.

Thank you.