[PATCH] Fix warning about undefined behaviour

Jörg Sommer <[email protected]>
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
Hi,

cd /home/joerg/git/slrn/src/objs; gcc -c -Wall -g -O0 -Dunix 
  -DSLRN_SLANG_DIR=\"/usr/share/slrn/slang\" 
  -DSLRN_LIB_DIR=\"/usr/share/slrn\" -DSLRN_CONF_DIR=\"/etc/news/slrn\"
  -DNLS_LOCALEDIR=\"/usr/share/locale\"

/home/joerg/git/slrn/src/interp.c
/home/joerg/git/slrn/src/interp.c: In function 'load_startup_file':
/home/joerg/git/slrn/src/interp.c:1644: warning: comparison with string
  literal results in unspecified behaviour

--- a/src/interp.c
+++ b/src/interp.c
@@ -1641,7 +1641,7 @@ static int load_startup_file (void)
    if (NULL == (dir = getenv (ENV_SLRN_SLANG_DIR)))
      dir = SLRN_SLANG_DIR;
    
-   if ((dir == NULL) || (dir == ""))
+   if ((dir == NULL) || (*dir == '\0'))
      {
        slrn_error (_("The SLRN_SLANG_DIR variable is either NULL or empty"));
        return -1;

Jörg.
-- 
Gott hat den Menschen erschaffen, weil er vom Affen enttäuscht war.
Danach hat er auf weitere Experimente verzichtet.
                                                          (Mark Twain)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.