Don't check alloca, it's like checking the stack exists.
SVN revision: 49991
This commit is contained in:
parent
0227f22ad7
commit
daa5685bd3
|
@ -40,33 +40,20 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
byte_len = strlen(text); /* we need the actual number of bytes, not number of chars */
|
byte_len = strlen(text); /* we need the actual number of bytes, not number of chars */
|
||||||
|
|
||||||
unicode_in = (FriBidiChar *)alloca(sizeof(FriBidiChar) * (len + 1));
|
unicode_in = (FriBidiChar *)alloca(sizeof(FriBidiChar) * (len + 1));
|
||||||
/* FIXME: Alloca never fails */
|
|
||||||
if (!unicode_in)
|
|
||||||
{
|
|
||||||
len = -1;
|
|
||||||
goto error1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FBDLOCK();
|
FBDLOCK();
|
||||||
len = fribidi_utf8_to_unicode(text, byte_len, unicode_in);
|
len = fribidi_utf8_to_unicode(text, byte_len, unicode_in);
|
||||||
FBDUNLOCK();
|
FBDUNLOCK();
|
||||||
unicode_in[len] = 0;
|
unicode_in[len] = 0;
|
||||||
|
|
||||||
unicode_out = (FriBidiChar *)alloca(sizeof(FriBidiChar) * (len + 1));
|
unicode_out = (FriBidiChar *)alloca(sizeof(FriBidiChar) * (len + 1));
|
||||||
/* FIXME: Alloca never fails */
|
|
||||||
if (!unicode_out)
|
|
||||||
{
|
|
||||||
len = -1;
|
|
||||||
goto error2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (embedding_level_list)
|
if (embedding_level_list)
|
||||||
{
|
{
|
||||||
*embedding_level_list = (EvasIntlLevel *)malloc(sizeof(EvasIntlLevel) * len);
|
*embedding_level_list = (EvasIntlLevel *)malloc(sizeof(EvasIntlLevel) * len);
|
||||||
if (!*embedding_level_list)
|
if (!*embedding_level_list)
|
||||||
{
|
{
|
||||||
len = -1;
|
len = -1;
|
||||||
goto error3;
|
goto error1;
|
||||||
}
|
}
|
||||||
tmp_level_list = *embedding_level_list;
|
tmp_level_list = *embedding_level_list;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +64,7 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
if (!*position_L_to_V_list)
|
if (!*position_L_to_V_list)
|
||||||
{
|
{
|
||||||
len = -1;
|
len = -1;
|
||||||
goto error4;
|
goto error2;
|
||||||
}
|
}
|
||||||
tmp_L_to_V_list = *position_L_to_V_list;
|
tmp_L_to_V_list = *position_L_to_V_list;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +75,7 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
if (!*position_V_to_L_list)
|
if (!*position_V_to_L_list)
|
||||||
{
|
{
|
||||||
len = -1;
|
len = -1;
|
||||||
goto error5;
|
goto error2;
|
||||||
}
|
}
|
||||||
tmp_V_to_L_list = *position_V_to_L_list;
|
tmp_V_to_L_list = *position_V_to_L_list;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +86,7 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
{
|
{
|
||||||
LKU(fribidi_lock);
|
LKU(fribidi_lock);
|
||||||
len = -2;
|
len = -2;
|
||||||
goto error5;
|
goto error2;
|
||||||
}
|
}
|
||||||
LKU(fribidi_lock);
|
LKU(fribidi_lock);
|
||||||
|
|
||||||
|
@ -107,7 +94,7 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
if (!text_out)
|
if (!text_out)
|
||||||
{
|
{
|
||||||
len = -1;
|
len = -1;
|
||||||
goto error6;
|
goto error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
fribidi_unicode_to_utf8(unicode_out, len, text_out);
|
fribidi_unicode_to_utf8(unicode_out, len, text_out);
|
||||||
|
@ -117,20 +104,14 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
return text_out;
|
return text_out;
|
||||||
|
|
||||||
/* ERROR HANDLING */
|
/* ERROR HANDLING */
|
||||||
error6:
|
error1:
|
||||||
free(unicode_out);
|
|
||||||
error5:
|
|
||||||
free(*position_V_to_L_list);
|
free(*position_V_to_L_list);
|
||||||
*position_V_to_L_list = NULL;
|
*position_V_to_L_list = NULL;
|
||||||
error4:
|
error2:
|
||||||
free(*position_L_to_V_list);
|
free(*position_L_to_V_list);
|
||||||
*position_L_to_V_list = NULL;
|
*position_L_to_V_list = NULL;
|
||||||
error3:
|
|
||||||
free(*embedding_level_list);
|
free(*embedding_level_list);
|
||||||
*embedding_level_list = NULL;
|
*embedding_level_list = NULL;
|
||||||
error2:
|
|
||||||
free(unicode_in);
|
|
||||||
error1:
|
|
||||||
|
|
||||||
*ret_len = len;
|
*ret_len = len;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue