Skip to content

Commit

Permalink
Using blackbox-functionality to check whther type was already loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderdreyer committed Dec 11, 2012
1 parent 6abdbc6 commit 622a480
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Singular/countedref.cc
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,9 @@ BOOLEAN countedref_deserialize(blackbox **b, void **d, si_link f)

void countedref_reference_load()
{
static bool loaded = false;
if (loaded) return;
int tok;
if (blackboxIsCmd("reference", tok) == ROOT_DECL)
return;

blackbox *bbx = (blackbox*)omAlloc0(sizeof(blackbox));
bbx->blackbox_CheckAssign = countedref_CheckAssign;
Expand All @@ -740,13 +741,13 @@ void countedref_reference_load()
bbx->blackbox_deserialize = countedref_deserialize;
bbx->data = omAlloc0(newstruct_desc_size());
setBlackboxStuff(bbx, "reference");
loaded = true;
}

void countedref_shared_load()
{
static bool loaded = false;
if (loaded) return;
int tok;
if (blackboxIsCmd("shared", tok) == ROOT_DECL)
return;

blackbox *bbxshared = (blackbox*)omAlloc0(sizeof(blackbox));
bbxshared->blackbox_String = countedref_String;
Expand All @@ -765,6 +766,4 @@ void countedref_shared_load()
bbxshared->blackbox_Init = countedref_InitShared;
bbxshared->data = omAlloc0(newstruct_desc_size());
setBlackboxStuff(bbxshared, "shared");

loaded = true;
}

0 comments on commit 622a480

Please sign in to comment.