]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Avoid allocating an iconv_t for nothing.
authorBruno Haible <bruno@clisp.org>
Tue, 14 Jan 2003 13:39:29 +0000 (13:39 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:08:56 +0000 (12:08 +0200)
lib/ChangeLog
lib/linebreak.c

index 9b27112d5f811b1a5e147e789d3934676e02473b..9264f37815e141777a8b693ec812dd5b0b3a8924 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-12  Bruno Haible  <bruno@clisp.org>
+
+       * linebreak.c (mbs_possible_linebreaks): Return immediately if n = 0.
+       (mbs_width_linebreaks): Likewise.
+
 2003-01-12  Bruno Haible  <bruno@clisp.org>
 
        * mkdtemp.c: Use the simpler macro names HAVE_STDINT_H,
index 8385ed6713aa6fbde8c545aaa18b920ee40bda6c..97f97c98d0159a75141c7085e1703c8751864687 100644 (file)
@@ -1495,6 +1495,8 @@ void
 mbs_possible_linebreaks (const char *s, size_t n, const char *encoding,
                          char *p)
 {
+  if (n == 0)
+    return;
   if (is_utf8_encoding (encoding))
     u8_possible_linebreaks ((const unsigned char *) s, n, encoding, p);
   else
@@ -1588,6 +1590,8 @@ mbs_width_linebreaks (const char *s, size_t n,
                       const char *o, const char *encoding,
                       char *p)
 {
+  if (n == 0)
+    return start_column;
   if (is_utf8_encoding (encoding))
     return u8_width_linebreaks ((const unsigned char *) s, n, width, start_column, at_end_columns, o, encoding, p);
   else