From: mquinson Date: Mon, 7 May 2007 13:51:26 +0000 (+0000) Subject: Stupid me. One day, I'll be able to compute array indices right X-Git-Tag: v3.3~1868 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2374d723fbe340cdb633b35e5c4fb613ed0fe80f?ds=sidebyside Stupid me. One day, I'll be able to compute array indices right git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3492 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/xbt/xbt_str.c b/src/xbt/xbt_str.c index ab09f43f9f..9b4f244fa4 100644 --- a/src/xbt/xbt_str.c +++ b/src/xbt/xbt_str.c @@ -371,20 +371,20 @@ static void diff_build_diff(xbt_dynar_t res, diff_build_diff(res,C,da,db,i-1,j-1); topush = bprintf(" %s",xbt_dynar_get_as(da,i,char*)); xbt_dynar_push(res, &topush); - } else if (j>=0 && + } else if (j>0 && (i<=0 || xbt_matrix_get_as(C,i,j-1,int) >= xbt_matrix_get_as(C,i-1,j,int))) { diff_build_diff(res,C,da,db,i,j-1); topush = bprintf("+ %s",xbt_dynar_get_as(db,j,char*)); xbt_dynar_push(res,&topush); - } else if (i>=0 && - (j<0 || xbt_matrix_get_as(C,i,j-1,int) < xbt_matrix_get_as(C,i-1,j,int))) { + } else if (i>0 && + (j<=0 || xbt_matrix_get_as(C,i,j-1,int) < xbt_matrix_get_as(C,i-1,j,int))) { diff_build_diff(res,C,da,db,i-1,j); topush = bprintf("- %s",xbt_dynar_get_as(da,i,char*)); xbt_dynar_push(res,&topush); - } else if (i<0 && j<0) { + } else if (i<=0 && j<=0) { return; } else { - THROW_IMPOSSIBLE; + THROW2(arg_error,0,"Invalid values: i=%d, j=%d",i,j); } }