(config_command): Fix previous change again.
[m17n/m17n-lib.git] / src / mtext.c
index e72dfa6..6da7170 100644 (file)
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the m17n library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    02111-1307, USA.  */
 
 /***en
@@ -2023,7 +2023,7 @@ mtext_cat_char (MText *mt, int c)
   nunits = CHAR_UNITS (c, mt->format);
   if ((mt->nbytes + nunits + 1) * unit_bytes > mt->allocated)
     {
-      mt->allocated = (mt->nbytes + nunits + 1) * unit_bytes;
+      mt->allocated = (mt->nbytes + nunits * 16 + 1) * unit_bytes;
       MTABLE_REALLOC (mt->data, mt->allocated, MERROR_MTEXT);
     }
   
@@ -3596,35 +3596,39 @@ mtext_uppercase (MText *mt)
 MText *
 mdebug_dump_mtext (MText *mt, int indent, int fullp)
 {
-  char *prefix = (char *) alloca (indent + 1);
   int i;
-  unsigned char *p;
-
-  memset (prefix, 32, indent);
-  prefix[indent] = 0;
 
-  fprintf (stderr,
-          "(mtext (size %d %d %d) (cache %d %d)",
-          mt->nchars, mt->nbytes, mt->allocated,
-          mt->cache_char_pos, mt->cache_byte_pos);
   if (! fullp)
     {
-      fprintf (stderr, " \"");
+      fprintf (stderr, "\"");
       for (i = 0; i < mt->nchars; i++)
        {
          int c = mtext_ref_char (mt, i);
 
          if (c == '"' || c == '\\')
            fprintf (stderr, "\\%c", c);
-         else if (c >= ' ' && c < 127)
+         else if ((c >= ' ' && c < 127) || c == '\n')
            fprintf (stderr, "%c", c);
          else
            fprintf (stderr, "\\x%02X", c);
        }
       fprintf (stderr, "\"");
+      return mt;
     }
-  else if (mt->nchars > 0)
+
+  fprintf (stderr,
+          "(mtext (size %d %d %d) (cache %d %d)",
+          mt->nchars, mt->nbytes, mt->allocated,
+          mt->cache_char_pos, mt->cache_byte_pos);
+
+  if (mt->nchars > 0)
     {
+      char *prefix = (char *) alloca (indent + 1);
+      unsigned char *p;
+
+      memset (prefix, 32, indent);
+      prefix[indent] = 0;
+
       fprintf (stderr, "\n%s (bytes \"", prefix);
       for (i = 0; i < mt->nbytes; i++)
        fprintf (stderr, "\\x%02x", mt->data[i]);