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