From f3f2d2d134da23c5862a1ce7fce770f1ce5f6acf Mon Sep 17 00:00:00 2001 From: anon Date: Fri, 15 Nov 2024 19:16:49 +0100 Subject: [PATCH] pass reffile to opendatabase explicitly --- source/build.c | 7 ++++--- source/build.h | 2 +- source/main.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/build.c b/source/build.c index b9b29d7..c7bf968 100644 --- a/source/build.c +++ b/source/build.c @@ -143,7 +143,7 @@ void setup_build_filenames(const char * const reffile) { } /* open the database */ -void opendatabase(void) { +void opendatabase(const char * const reffile) { if((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { cannotopen(reffile); myexit(1); @@ -151,7 +151,8 @@ void opendatabase(void) { blocknumber = -1; /* force next seek to read the first block */ /* 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 */ invertedindex = false; } @@ -166,7 +167,7 @@ void rebuild(void) { npostings = 0; } build(); - opendatabase(); + opendatabase(reffile); /* revert to the initial display */ if(refsfound != NULL) { diff --git a/source/build.h b/source/build.h index f3a44fe..db6e4db 100644 --- a/source/build.h +++ b/source/build.h @@ -62,7 +62,7 @@ extern INVCONTROL invcontrol; /* inverted file control structure */ void build(void); void free_newbuildfiles(void); -void opendatabase(void); +void opendatabase(const char * const reffile); void rebuild(void); void setup_build_filenames(const char * const reffile); void seek_to_trailer(FILE *f); diff --git a/source/main.c b/source/main.c index dfc7ac0..b9bc48b 100644 --- a/source/main.c +++ b/source/main.c @@ -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 subprocess to emacs or samuel */