simple edits

This commit is contained in:
anon
2024-11-12 21:21:24 +01:00
parent b65804d64e
commit ea8166963b
2 changed files with 17 additions and 22 deletions

View File

@ -54,7 +54,7 @@
digits = 1; \
while(n >= BASE) { \
++digits; \
i = n; \
int i = n; \
n /= BASE; \
*--s = i - n * BASE + '!'; \
} \
@ -181,7 +181,6 @@ void crossref(char *srcfile) {
}
/* save the symbol in the list */
static void savesymbol(int token, int num) {
/* make sure there is room for the symbol */
if(symbols == msymbols) {
@ -198,7 +197,6 @@ static void savesymbol(int token, int num) {
}
/* output the file name */
void putfilename(char *srcfile) {
/* check for file system out of space */
/* note: dbputc is not used to avoid lint complaint */
@ -343,15 +341,14 @@ void putcrossref(void) {
/* HBB 20000421: new function, for avoiding memory leaks */
/* free the cross reference symbol table */
void freecrossref() {
if(symbol) free(symbol);
if (symbol) { free(symbol); }
symbol = NULL;
symbols = 0;
}
/* output the inverted index posting */
void putposting(char *term, int type) {
long i, n;
long n;
char *s;
int digits; /* digits output */
long offset; /* function/macro database offset */
@ -388,7 +385,7 @@ void putposting(char *term, int type) {
in ascending line offset order to order the references as they
appear withing a source file */
ltobase(lineoffset);
for(i = PRECISION - digits; i > 0; --i) {
for (long i = PRECISION - digits; i > 0; --i) {
(void)putc('!', postings);
}
do {
@ -414,10 +411,8 @@ void putposting(char *term, int type) {
}
/* put the string into the new database */
void writestring(char *s) {
unsigned char c;
int i;
if(compress == false) {
/* Save some I/O overhead by using puts() instead of putc(): */
@ -425,7 +420,7 @@ void writestring(char *s) {
return;
}
/* compress digraphs */
for(i = 0; (c = s[i]) != '\0'; ++i) {
for(int i = 0; (c = s[i]) != '\0'; ++i) {
if(/* dicode1[c] && dicode2[(unsigned char) s[i + 1]] */
IS_A_DICODE(c, s[i + 1])) {
/* c = (0200 - 2) + dicode1[c] + dicode2[(unsigned char) s[i + 1]]; */
@ -437,13 +432,12 @@ void writestring(char *s) {
}
/* print a warning message with the file name and line number */
void warning(char *text) {
(void)fprintf(stderr,
PROGRAM_NAME ": \"%s\", line %d: warning: %s\n",
filename,
myylineno,
text);
text
);
errorsfound = true;
}

View File

@ -323,7 +323,8 @@ int main(int argc, char **argv) {
* the home directory
*/
snprintf(path, sizeof(path), "%s/%s", home, reffile);
if(isuptodate == false || access(path, READ) == 0) {
if (preserve_database == false
|| access(path, READ) == 0) {
reffile = strdup(path);
snprintf(path, sizeof(path), "%s/%s", home, invname);
invname = strdup(path);