From: behdad Date: Thu, 15 Mar 2007 18:09:25 +0000 (+0000) Subject: Skip explicits-list reinsertion if list is empty. X-Git-Tag: FRIBIDI_0_19_1~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a25b4e31a1e0560c82086a5216cd7b064a9ca0c;p=fribidi Skip explicits-list reinsertion if list is empty. --- diff --git a/lib/fribidi-bidi.c b/lib/fribidi-bidi.c index 66a85ee..77c2351 100644 --- a/lib/fribidi-bidi.c +++ b/lib/fribidi-bidi.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-bidi.c - bidirectional algorithm * - * $Id: fribidi-bidi.c,v 1.20 2006-01-31 03:23:13 behdad Exp $ + * $Id: fribidi-bidi.c,v 1.21 2007-03-15 18:09:25 behdad Exp $ * $Author: behdad $ - * $Date: 2006-01-31 03:23:13 $ - * $Revision: 1.20 $ + * $Date: 2007-03-15 18:09:25 $ + * $Revision: 1.21 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.c,v $ * * Authors: @@ -720,20 +720,24 @@ fribidi_get_par_embedding_levels ( /* Reinsert the explicit codes & BN's that are already removed, from the explicits_list to main_run_list. */ DBG ("reinserting explicit codes"); - { - register FriBidiRun *p; - register fribidi_boolean stat = - shadow_run_list (main_run_list, explicits_list, true); - explicits_list = NULL; - if UNLIKELY - (!stat) goto out; - - p = main_run_list->next; - if (p != main_run_list && p->level == FRIBIDI_SENTINEL) - p->level = base_level; - for_run_list (p, main_run_list) if (p->level == FRIBIDI_SENTINEL) - p->level = p->prev->level; - } + if UNLIKELY + (explicits_list->next != explicits_list) + { + register FriBidiRun *p; + register fribidi_boolean stat = + shadow_run_list (main_run_list, explicits_list, true); + explicits_list = NULL; + if UNLIKELY + (!stat) goto out; + + /* Set level of inserted explicit chars to that of their previous + * char, such that they do not affect reordering. */ + p = main_run_list->next; + if (p != main_run_list && p->level == FRIBIDI_SENTINEL) + p->level = base_level; + for_run_list (p, main_run_list) if (p->level == FRIBIDI_SENTINEL) + p->level = p->prev->level; + } # if DEBUG if UNLIKELY