Skip to content
Extraits de code Groupes Projets
Valider bf455c8c rédigé par Etienne BRATEAU's avatar Etienne BRATEAU
Parcourir les fichiers

Create a function to clear a page and call it into pagereader

parent 84db139d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -47,4 +47,6 @@ log_page *pageAlloc();
void pageFree(log_page **page);
void pageClear(log_page *page);
#endif
......@@ -221,3 +221,69 @@ void pageFree(log_page **page)
*page = NULL;
}
void pageClear(log_page *page)
{
log_hwrec *hw;
log_vwrec *vw;
log_srec *s;
log_grec *g;
log_lrec *l;
log_brec *b;
hw = page->hwbase;
while (hw != NULL)
{
page->hwbase = hw->next;
stamp(&hw->node->simtype->netstamp);
Free(hw);
hw = page->hwbase;
}
vw = page->vwbase;
while (vw != NULL)
{
page->vwbase = vw->next;
stamp(&vw->node->simtype->netstamp);
Free(vw);
vw = page->vwbase;
}
s = page->sbase;
while (s != NULL)
{
page->sbase = s->next;
Free(s);
s = page->sbase;
}
g = page->gbase;
while (g != NULL)
{
page->gbase = g->next;
stamp(&g->kind->simtype->netstamp);
disposegate(&g);
g = page->gbase;
}
l = page->lbase;
if (l != NULL)
stamp(&gg.labelstamp);
while (l != NULL)
{
page->lbase = l->next;
Free(l);
l = page->lbase;
}
b = page->bbase;
if (b != NULL)
stamp(&gg.boxstamp);
while (b != NULL)
{
page->bbase = b->next;
Free(b);
b = page->bbase;
}
}
......@@ -11,6 +11,7 @@
#include "tool.h"
#include "utils.h"
#include "box.h"
#include "libraryreader.h"
void loadfail(char *msg, struct LOC_loadpage *LINK)
{
......@@ -136,62 +137,8 @@ void loadpage(char *filename_, char *reason_)
ver = -ver;
gg.actx = gg.curpage - 1;
calltools(act_clear);
hw = gg.pages[gg.curpage - 1]->hwbase;
while (hw != NULL)
{
gg.pages[gg.curpage - 1]->hwbase = hw->next;
stamp(&hw->node->simtype->netstamp);
Free(hw);
hw = gg.pages[gg.curpage - 1]->hwbase;
}
vw = gg.pages[gg.curpage - 1]->vwbase;
while (vw != NULL)
{
gg.pages[gg.curpage - 1]->vwbase = vw->next;
stamp(&vw->node->simtype->netstamp);
Free(vw);
vw = gg.pages[gg.curpage - 1]->vwbase;
}
s = gg.pages[gg.curpage - 1]->sbase;
while (s != NULL)
{
gg.pages[gg.curpage - 1]->sbase = s->next;
Free(s);
s = gg.pages[gg.curpage - 1]->sbase;
}
g = gg.pages[gg.curpage - 1]->gbase;
while (g != NULL)
{
gg.pages[gg.curpage - 1]->gbase = g->next;
stamp(&g->kind->simtype->netstamp);
disposegate(&g);
g = gg.pages[gg.curpage - 1]->gbase;
}
l = gg.pages[gg.curpage - 1]->lbase;
if (l != NULL)
stamp(&gg.labelstamp);
while (l != NULL)
{
gg.pages[gg.curpage - 1]->lbase = l->next;
Free(l);
l = gg.pages[gg.curpage - 1]->lbase;
}
b = gg.pages[gg.curpage - 1]->bbase;
if (b != NULL)
stamp(&gg.boxstamp);
while (b != NULL)
{
gg.pages[gg.curpage - 1]->bbase = b->next;
Free(b);
b = gg.pages[gg.curpage - 1]->bbase;
}
pageClear(gg.pages[gg.curpage - 1]);
garbagecoll();
stamp(&gg.loadstamp);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter