str==NULL tells you whether the pointer is NULL.
str[0]=='\0' tells you if the string is of zero-length.
In that code, the test:
if ((str == NULL) || (str[0] == '\0'))
is used to catch the case where it is either NULL or has zero-length.
Note that short-circuiting plays a key role here: The point of the test is to make sure that str is a valid c-string with length at least 1.
- The second test
str[0] == '\0'will only work ifstris not NULL. - Therefore, the first test
str == NULLis needed to break out early whenstris NULL.