Use NULL for pointers.
strrchr(3) will return NULL if the character does not appears in the string. MFC after: 2 weeks.
This commit is contained in:
parent
d2d25bb0ca
commit
76c4083741
@ -451,7 +451,7 @@ generate_guard(const char *pathname)
|
|||||||
char *guard, *tmp, *stopat;
|
char *guard, *tmp, *stopat;
|
||||||
|
|
||||||
filename = strrchr(pathname, '/'); /* find last component */
|
filename = strrchr(pathname, '/'); /* find last component */
|
||||||
filename = ((filename == 0) ? pathname : filename+1);
|
filename = ((filename == NULL) ? pathname : filename+1);
|
||||||
guard = xstrdup(filename);
|
guard = xstrdup(filename);
|
||||||
stopat = strrchr(guard, '.');
|
stopat = strrchr(guard, '.');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user