On Tue, 5 Jul 2011 15:40:14 +0200 sundararaj reel sundararaj.reel@googlemail.com wrote:
strcmp() returns 0 if both are parameters NULL, but segfaults if one of the parameters is NULL.
I think that's officially undefined behaviour. The easiest workaround (in the absence of something like glib which provides NULL-safe versions of some str functions) is to use strcmp(s1 ? s1 : "", s2 ? s2 : "") but only if it doesn't matter that NULL compares equal to "".