+2007-03-19 Paolo Borelli <pborelli@katamail.com>
+
+ * glib/gutf8.c (fast_validate_len): remove unneeded checks.
+
2007-03-18 Matthias Clasen <mclasen@redhat.com>
* glib/gregex.c: Cosmetic fixes
gunichar min = 0;
const gchar *p;
- for (p = str; (max_len < 0 || (p - str) < max_len) && *p; p++)
+ g_assert (max_len >= 0);
+
+ for (p = str; ((p - str) < max_len) && *p; p++)
{
if (*(guchar *)p < 128)
/* done */;
last = p;
if ((*(guchar *)p & 0xe0) == 0xc0) /* 110xxxxx */
{
- if (G_UNLIKELY (max_len >= 0 && max_len - (p - str) < 2))
+ if (G_UNLIKELY (max_len - (p - str) < 2))
goto error;
if (G_UNLIKELY ((*(guchar *)p & 0x1e) == 0))
{
if ((*(guchar *)p & 0xf0) == 0xe0) /* 1110xxxx */
{
- if (G_UNLIKELY (max_len >= 0 && max_len - (p - str) < 3))
+ if (G_UNLIKELY (max_len - (p - str) < 3))
goto error;
min = (1 << 11);
}
else if ((*(guchar *)p & 0xf8) == 0xf0) /* 11110xxx */
{
- if (G_UNLIKELY (max_len >= 0 && max_len - (p - str) < 4))
+ if (G_UNLIKELY (max_len - (p - str) < 4))
goto error;
min = (1 << 16);
return TRUE;
}
-
/**
* g_unichar_validate:
* @ch: a Unicode character