From: Bruno Haible Date: Tue, 14 Jan 2003 13:39:29 +0000 (+0000) Subject: Avoid allocating an iconv_t for nothing. X-Git-Tag: v0.12~1168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89534573c3e3330c167d5a5e76edcdf9ea68ffa8;p=thirdparty%2Fgettext.git Avoid allocating an iconv_t for nothing. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 9b27112d5..9264f3781 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2003-01-12 Bruno Haible + + * linebreak.c (mbs_possible_linebreaks): Return immediately if n = 0. + (mbs_width_linebreaks): Likewise. + 2003-01-12 Bruno Haible * mkdtemp.c: Use the simpler macro names HAVE_STDINT_H, diff --git a/lib/linebreak.c b/lib/linebreak.c index 8385ed671..97f97c98d 100644 --- a/lib/linebreak.c +++ b/lib/linebreak.c @@ -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