pass reffile to opendatabase explicitly

This commit is contained in:
anon 2024-11-15 19:16:49 +01:00
parent 29645c1632
commit f3f2d2d134
3 changed files with 6 additions and 5 deletions

View File

@ -143,7 +143,7 @@ void setup_build_filenames(const char * const reffile) {
} }
/* open the database */ /* open the database */
void opendatabase(void) { void opendatabase(const char * const reffile) {
if((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { if((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) {
cannotopen(reffile); cannotopen(reffile);
myexit(1); myexit(1);
@ -151,7 +151,8 @@ void opendatabase(void) {
blocknumber = -1; /* force next seek to read the first block */ blocknumber = -1; /* force next seek to read the first block */
/* open any inverted index */ /* open any inverted index */
if(invertedindex == true && invopen(&invcontrol, invname, invpost, INVAVAIL) == -1) { if (invertedindex == true
&& invopen(&invcontrol, invname, invpost, INVAVAIL) == -1) {
askforreturn(); /* so user sees message */ askforreturn(); /* so user sees message */
invertedindex = false; invertedindex = false;
} }
@ -166,7 +167,7 @@ void rebuild(void) {
npostings = 0; npostings = 0;
} }
build(); build();
opendatabase(); opendatabase(reffile);
/* revert to the initial display */ /* revert to the initial display */
if(refsfound != NULL) { if(refsfound != NULL) {

View File

@ -62,7 +62,7 @@ extern INVCONTROL invcontrol; /* inverted file control structure */
void build(void); void build(void);
void free_newbuildfiles(void); void free_newbuildfiles(void);
void opendatabase(void); void opendatabase(const char * const reffile);
void rebuild(void); void rebuild(void);
void setup_build_filenames(const char * const reffile); void setup_build_filenames(const char * const reffile);
void seek_to_trailer(FILE *f); void seek_to_trailer(FILE *f);

View File

@ -465,7 +465,7 @@ int main(const int argc, const char * const * const argv) {
} }
} }
opendatabase(); opendatabase(reffile);
/* if using the line oriented user interface so cscope can be a /* if using the line oriented user interface so cscope can be a
subprocess to emacs or samuel */ subprocess to emacs or samuel */