From c556d30f49862af7279391bf732b9d4e9ecd0e17 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 27 Dec 2004 01:13:58 +0000 Subject: [PATCH] more robust "Delete Empty Views" --- Parser/Gmsh.tab.cpp | 6 +++--- Parser/Gmsh.y | 6 +++--- Parser/Gmsh.yy.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 27b9b5e4ef..cc41aa32de 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -195,7 +195,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.217 2004-12-27 00:59:15 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.218 2004-12-27 01:13:56 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -7017,8 +7017,8 @@ case 284: #line 2388 "Gmsh.y" { if(!strcmp(yyvsp[-2].c, "Empty") && !strcmp(yyvsp[-1].c, "Views")){ - for(int i = 0; i < List_Nbr(CTX.post.list); i++){ - Post_View *v = *(Post_View **)List_Pointer_Test(CTX.post.list, i); + for(int i = List_Nbr(CTX.post.list) - 1; i >= 0; i--){ + Post_View *v = *(Post_View **) List_Pointer(CTX.post.list, i); if(v->empty()) RemoveViewByIndex(i); } diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index e70c9a82e2..160a6255ba 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,5 +1,5 @@ %{ -// $Id: Gmsh.y,v 1.189 2004-12-27 00:47:03 geuzaine Exp $ +// $Id: Gmsh.y,v 1.190 2004-12-27 01:13:57 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -2387,8 +2387,8 @@ Delete : | tDelete tSTRING tSTRING tEND { if(!strcmp($2, "Empty") && !strcmp($3, "Views")){ - for(int i = 0; i < List_Nbr(CTX.post.list); i++){ - Post_View *v = *(Post_View **)List_Pointer_Test(CTX.post.list, i); + for(int i = List_Nbr(CTX.post.list) - 1; i >= 0; i--){ + Post_View *v = *(Post_View **) List_Pointer(CTX.post.list, i); if(v->empty()) RemoveViewByIndex(i); } diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index a58b4ea1d7..4ca2719040 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.216 2004-12-27 00:59:15 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.217 2004-12-27 01:13:58 geuzaine Exp $ */ #define FLEX_SCANNER @@ -1033,7 +1033,7 @@ char *yytext; #line 1 "Gmsh.l" #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.216 2004-12-27 00:59:15 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.217 2004-12-27 01:13:58 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // -- GitLab