You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/03/14 13:34:38 UTC

svn commit: r637079 - /stdcxx/trunk/util/gencat.cpp

Author: faridz
Date: Fri Mar 14 05:34:35 2008
New Revision: 637079

URL: http://svn.apache.org/viewvc?rev=637079&view=rev
Log:
2008-03-14 Farid Zaripov <fa...@epam.com>

	STDCXX-752
	* util/gencat.cpp: Asserted precondition to silence HP aCC
	warning #20200-D: Potential null pointer dereference.

Modified:
    stdcxx/trunk/util/gencat.cpp

Modified: stdcxx/trunk/util/gencat.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/util/gencat.cpp?rev=637079&r1=637078&r2=637079&view=diff
==============================================================================
--- stdcxx/trunk/util/gencat.cpp (original)
+++ stdcxx/trunk/util/gencat.cpp Fri Mar 14 05:34:35 2008
@@ -28,6 +28,7 @@
 #include <cstdio>    // for printf()
 #include <cstring>   // for strcmp(), strrchr()
 #include <cstddef>   // for size_t
+#include <cassert>   // for assert()
 
 #include <string>
 
@@ -63,11 +64,16 @@
 
 int main (int argc, char *argv[])
 {
-    const char* exe_name = std::strrchr (argv [0], SLASH);
-    if (exe_name)
-        ++exe_name;
-    else
-        exe_name = argv [0];
+    const char* exe_name = "gencat";
+
+    if (argv [0]) {
+        if (const char* slash = std::strrchr (argv [0], SLASH))
+            exe_name = slash + 1;
+        else
+            exe_name = argv [0];
+    }
+
+    assert (exe_name);
 
     if (1 == argc) {
         std::printf (usage_text, exe_name);