diff --git a/cint/cint7/inc/Api.h b/cint/cint7/inc/Api.h index 52c22c2231c5cd997dab535a8a792069739c1a6a..517c3c159b7d3a3ffdda7b6853dc14ad4bf48d37 100644 --- a/cint/cint7/inc/Api.h +++ b/cint/cint7/inc/Api.h @@ -234,7 +234,7 @@ struct G__dictposition G__Deffuncmacro* deffuncmacro; // macro table position G__Definedtemplateclass* definedtemplateclass; // class template table position G__Definetemplatefunc* definedtemplatefunc; // function template table position - char* ptype; // struct,union,enum,class + int nactives; // number of 'active' classes }; // diff --git a/cint/cint7/src/common.h b/cint/cint7/src/common.h index b4bf637a9047ba42623a65142892d8ac519f7d62..80602884b28e67039b99db830dbea6699b605b18 100644 --- a/cint/cint7/src/common.h +++ b/cint/cint7/src/common.h @@ -839,6 +839,7 @@ struct G__filetable { int ispermanentsl; std::list<G__DLLINIT>* initsl; struct G__dictposition *hasonlyfunc; + int definedStruct; /* number of struct/class/namespace defined in this file */ char hdrprop; #ifndef G__OLDIMPLEMENTATION1649 char *str; @@ -1192,6 +1193,7 @@ struct G__tagtable { char istrace[G__MAXSTRUCT]; char isbreak[G__MAXSTRUCT]; int alltag; + int nactives; // List of active (i.e. non disable, non autoload entries). #ifdef G__FRIEND struct G__friendtag *friendtag[G__MAXSTRUCT]; diff --git a/cint/cint7/src/init.cxx b/cint/cint7/src/init.cxx index 113ebfc69358f6a9f51d48ec43b5e507a457796d..c55ea66ca15b99d69e8528b9e2e9aa7dd944d444 100644 --- a/cint/cint7/src/init.cxx +++ b/cint/cint7/src/init.cxx @@ -1374,7 +1374,6 @@ extern "C" int G__main(int argc, char** argv) char* dllid = 0; G__dictposition stubbegin; char* icom = 0; - stubbegin.ptype = (char*) G__PVOID; // // Setting STDIOs. May need to modify in init.c, end.c, scrupto.c, pause.c. // @@ -1987,7 +1986,6 @@ extern "C" int G__main(int argc, char** argv) continue; } else if (strcmp(sourcefile, "+STUB") == 0) { - stubbegin.ptype = (char*)G__PVOID; G__store_dictposition(&stubbegin); continue; } diff --git a/cint/cint7/src/loadfile.cxx b/cint/cint7/src/loadfile.cxx index 399912d21888abebda5e7df33824312f4754c5c6..514ffa0fbcd777bd55297f5bfb584e94b26f6ebb 100644 --- a/cint/cint7/src/loadfile.cxx +++ b/cint/cint7/src/loadfile.cxx @@ -931,19 +931,18 @@ static int G__isbinaryfile(char* filename) //______________________________________________________________________________ static void G__checkIfOnlyFunction(int fentry) { - int tagflag = 0; G__dictposition* dictpos = G__srcfile[fentry].dictpos; - if (dictpos->tagnum == G__struct.alltag) { - tagflag = 1; - if (dictpos->ptype && (dictpos->ptype != (char*) G__PVOID)) { - for (int i = 0; i < G__struct.alltag; ++i) { - if (dictpos->ptype[i] != G__struct.type[i]) { - tagflag = 0; - break; - } - } - } + + // Sum the number of G__struct slot used by any of the file + // we enclosed: + int nSubdefined = 0; + for(int filecur = fentry+1; filecur < G__nfile; ++filecur) { + nSubdefined += G__srcfile[filecur].definedStruct; } + G__srcfile[fentry].definedStruct = G__struct.nactives - dictpos->nactives - nSubdefined; + + int tagflag = ( G__srcfile[fentry].definedStruct == 0 ); + int varflag = 1; ::Reflex::Scope var = ::Reflex::Scope::GlobalScope(); if (dictpos->var == var && dictpos->ig15 == var.DataMemberSize()) { @@ -984,7 +983,6 @@ static void G__checkIfOnlyFunction(int fentry) (definedtemplatefunc == dictpos->definedtemplatefunc) ) { G__srcfile[fentry].hasonlyfunc = (G__dictposition*) malloc(sizeof(G__dictposition)); - G__srcfile[fentry].hasonlyfunc->ptype = (char*) G__PVOID; G__store_dictposition(G__srcfile[fentry].hasonlyfunc); } } @@ -1054,7 +1052,6 @@ int Cint::Internal::G__loadfile_tmpfile(FILE* fp) sprintf(G__ifile.name, "(tmp%d)", fentry); G__hash(G__ifile.name, hash, temp); G__srcfile[fentry].dictpos = (G__dictposition*) malloc(sizeof(G__dictposition)); - G__srcfile[fentry].dictpos->ptype = 0; G__store_dictposition(G__srcfile[fentry].dictpos); G__srcfile[fentry].hdrprop = hdrprop; store_security = G__security; @@ -2124,7 +2121,6 @@ extern "C" int G__loadfile(const char* filenamein) // so update G__ifile to point to fentry: G__ifile.filenum = fentry; G__srcfile[fentry].dictpos = (G__dictposition*) malloc(sizeof(G__dictposition)); - G__srcfile[fentry].dictpos->ptype = 0; G__store_dictposition(G__srcfile[fentry].dictpos); if (null_entry == -1) { ++G__nfile; @@ -2421,7 +2417,6 @@ int G__setfilecontext(const char* filename, G__input_file* ifile) fentry = G__nfile; } G__srcfile[fentry].dictpos = (G__dictposition*) malloc(sizeof(G__dictposition)); - G__srcfile[fentry].dictpos->ptype = 0; G__store_dictposition(G__srcfile[fentry].dictpos); if (null_entry == -1) { ++G__nfile; @@ -3104,7 +3099,6 @@ int Cint::Internal::G__register_sharedlib(const char *libname) G__srcfile[fentry].dictpos = (struct G__dictposition*)malloc(sizeof(struct G__dictposition)); - G__srcfile[fentry].dictpos->ptype = (char*)NULL; G__store_dictposition(G__srcfile[fentry].dictpos); G__srcfile[fentry].hdrprop = G__NONCINTHDR; diff --git a/cint/cint7/src/pause.cxx b/cint/cint7/src/pause.cxx index 89345b274e758507579d314afbad5bbc9e0c4fbd..bdef23ec7b827de4862f6458cf67ffb9c757999f 100644 --- a/cint/cint7/src/pause.cxx +++ b/cint/cint7/src/pause.cxx @@ -316,7 +316,6 @@ static void G__init_undo() undoindex = 0; for (i = 0;i < G__MAXUNDO;i++) { undodictpos[i].var =::Reflex::Scope(); - undodictpos[i].ptype = (char*)NULL; } } @@ -341,10 +340,6 @@ static void G__cancel_undo_position() { G__decrement_undo_index(&undoindex); undodictpos[undoindex].var =::Reflex::Scope(); - if (undodictpos[undoindex].ptype && undodictpos[undoindex].ptype != (char*)G__PVOID) { - free((void*)undodictpos[undoindex].ptype); - undodictpos[undoindex].ptype = 0; - } } //______________________________________________________________________________ @@ -441,10 +436,7 @@ static struct G__input_file errorifile; //______________________________________________________________________________ void Cint::Internal::G__clear_errordictpos() { - if (0 != errordictpos.ptype && (char*)G__PVOID != errordictpos.ptype) { - free((void*)errordictpos.ptype); - errordictpos.ptype = 0; - } + // Used to free the data member ptype from the global variable errordictpos. } //______________________________________________________________________________ diff --git a/cint/cint7/src/scrupto.cxx b/cint/cint7/src/scrupto.cxx index f753b670efbec4b7bb96b3ef6f02f15981bf921b..96e05650132270a9e77ba1bebb12f16db48b467a 100644 --- a/cint/cint7/src/scrupto.cxx +++ b/cint/cint7/src/scrupto.cxx @@ -130,6 +130,7 @@ static void G__close_inputfiles_upto(G__dictposition* pos) G__struct.alltag = itag + 1; // to only free itag G__free_struct_upto(itag); G__struct.alltag = alltag; + --G__struct.nactives; G__struct.name[itag] = name; G__struct.libname[itag] = libname; G__struct.type[itag] = 'a'; @@ -649,27 +650,6 @@ static int G__scratch_upto_work(G__dictposition* dictpos, int doall) // -- } else { - // -- -#ifndef G__OLDIMPLEMENTATION2190 - { - int nfile = G__nfile; - while (nfile > dictpos->nfile) { - struct G__dictposition* dictposx = G__srcfile[nfile].dictpos; - if (dictposx && dictposx->ptype && (dictposx->ptype != (char*) G__PVOID)) { - free((void*) dictposx->ptype); - dictposx->ptype = 0; - } - --nfile; - } - } -#endif // G__OLDIMPLEMENTATION2190 - if (dictpos->ptype && (dictpos->ptype != (char*) G__PVOID)) { - for (int i = 0; i < G__struct.alltag; ++i) { - G__struct.type[i] = dictpos->ptype[i]; - } - free((void*) dictpos->ptype); - dictpos->ptype = 0; - } // Close input files. G__close_inputfiles_upto(dictpos); G__tagdefining = ::Reflex::Scope(); @@ -969,16 +949,7 @@ extern "C" void G__store_dictposition(G__dictposition* dictpos) while (dictpos->definedtemplatefunc->next) { dictpos->definedtemplatefunc = dictpos->definedtemplatefunc->next; } - if (dictpos->ptype && (dictpos->ptype != (char*) G__PVOID)) { - free((void*) dictpos->ptype); - dictpos->ptype = 0; - } - if (!dictpos->ptype) { - dictpos->ptype = (char*) malloc(G__struct.alltag + 1); - for (int i = 0; i < G__struct.alltag; ++i) { - dictpos->ptype[i] = G__struct.type[i]; - } - } + dictpos->nactives = G__struct.nactives; G__UnlockCriticalSection(); } @@ -993,13 +964,6 @@ extern "C" int G__close_inputfiles() } #endif // G__DUMPFILE for (iarg = 0; iarg < G__nfile; ++iarg) { - if (G__srcfile[iarg].dictpos) { - if (G__srcfile[iarg].dictpos->ptype && (G__srcfile[iarg].dictpos->ptype != (char*) G__PVOID)) { - free((void*)G__srcfile[iarg].dictpos->ptype); - } - free((void*) G__srcfile[iarg].dictpos); - G__srcfile[iarg].dictpos = 0; - } if (G__srcfile[iarg].hasonlyfunc) { free((void*) G__srcfile[iarg].hasonlyfunc); G__srcfile[iarg].hasonlyfunc = 0; diff --git a/cint/cint7/src/struct.cxx b/cint/cint7/src/struct.cxx index 63e3412876b948c5e578dc4e613432dd456d81f6..e4752544b14d150c99a19d868eb775a5dfa0abf5 100644 --- a/cint/cint7/src/struct.cxx +++ b/cint/cint7/src/struct.cxx @@ -2191,6 +2191,7 @@ extern "C" int G__search_tagname(const char* tagname, int type) G__create_bytecode_arena(); } i = G__struct.alltag; + ++G__struct.nactives; if (i == G__MAXSTRUCT) { G__fprinterr(G__serr, "Limitation: Number of struct/union tag exceed %d FILE:%s LINE:%d\nFatal error, exit program. Increase G__MAXSTRUCT in G__ci.h and recompile %s\n", G__MAXSTRUCT, G__ifile.name, G__ifile.line_number, G__nam); G__eof = 1; @@ -2388,6 +2389,7 @@ extern "C" int G__search_tagname(const char* tagname, int type) } else if (!G__struct.type[i] || (G__struct.type[i] == 'a')) { G__struct.type[i] = type; + ++G__struct.nactives; } #ifndef G__OLDIMPLEMENTATION1823 if (buf != temp) {