Author: faridz
Date: Mon Jul 30 10:56:49 2007
New Revision: 561069

URL: http://svn.apache.org/viewvc?view=rev&rev=561069
Log:
2007-07-30 Farid Zaripov <[EMAIL PROTECTED]>

        * locale.cpp (rw_locales): On error return "C\0" instead of 0.
        [_MSC_VER]: Use _free_dbg() instead of free().

Modified:
    incubator/stdcxx/trunk/tests/src/locale.cpp

Modified: incubator/stdcxx/trunk/tests/src/locale.cpp
URL: 
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/locale.cpp?view=diff&rev=561069&r1=561068&r2=561069
==============================================================================
--- incubator/stdcxx/trunk/tests/src/locale.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/locale.cpp Mon Jul 30 10:56:49 2007
@@ -329,6 +329,7 @@
 _TEST_EXPORT char*
 rw_locales (int loc_cat, const char* grep_exp)
 {
+    static char deflocname [3] = "C\0";
     static char* slocname = 0;
 
     static size_t size       = 0;         // the number of elements in the 
array
@@ -370,7 +371,7 @@
     const char* const fname = rw_tmpnam (0);
 
     if (!fname) {
-        return 0;   // error
+        return deflocname;   // error
     }
 
     // make sure that grep_exp is <= 80 
@@ -385,7 +386,7 @@
         : rw_system ("locale -a > %s", fname);
 
     if (exit_status) {
-        return 0;   // error
+        return deflocname;   // error
     }
 
     // open file containing the list of installed locales
@@ -429,7 +430,12 @@
                     _RWSTD_STATIC_CAST (char*, malloc (total_size));
 
                 memcpy (tmp, slocname, total_size - 5120);
+
+#ifndef _MSC_VER
                 free (slocname);
+#else
+                _free_dbg (slocname, _CLIENT_BLOCK);
+#endif
 
                 slocname = tmp;
                 locname  = slocname + size - strlen (linebuf) - 1;
@@ -477,7 +483,7 @@
 
     remove (fname);
 
-    return slocname;
+    return *slocname ? slocname : deflocname;
 }
 
 /**************************************************************************/


Reply via email to