Compare commits

...

3 Commits

Author SHA1 Message Date
a146863098 make git hold unused code 2023-09-25 23:16:02 +02:00
e785359af3 warning clean up 2023-09-25 23:15:52 +02:00
1f18533629 turn on warnings 2023-09-25 23:15:12 +02:00
6 changed files with 7 additions and 145 deletions

View File

@ -4,7 +4,7 @@ LIBS:=ncurses readline history
CC:=gcc
CFLAGS:=-Wall -Wextra -Wpedantic
CFLAGS +=$(if $(DEBUG),-O0 -ggdb,-O3 -flto=auto -fomit-frame-pointer)
CFLAGS +=$(if $(DEBUG),-O0 -ggdb -Wall -Wpedantic,-O3 -flto=auto -fomit-frame-pointer)
CFLAGS +=$(if $(SAN),-fsanitize=${SAN})
CPPFLAGS:=-I config/ -I ${CHDRD} ${shell pkg-config --cflags ${LIBS}}
LDLIBS=${shell pkg-config --libs ${LIBS}}

View File

@ -418,7 +418,7 @@ void makefilelist(void) {
if((s = inviewpath(newpath)) != NULL) {
addsrcfile(s);
} else {
fprintf(stderr, PROGRAM_NAME, ": cannot find file %s\n", newpath);
fprintf(stderr, PROGRAM_NAME ": cannot find file %s\n", newpath);
errorsfound = true;
}
}
@ -494,7 +494,7 @@ static void scan_dir(const char *adir, bool recurse_dir) {
/* see if this is a source file */
static bool issrcfile(char *path) {
struct stat statstruct;
char *file = basename(path);
const char *file = basename(path);
char *s = strrchr(file, '.');
bool looks_like_source = false;

View File

@ -102,7 +102,7 @@ static int myexecvp(char *a, char **args) {
char msg[MSGLEN + 1];
/* modify argv[0] to reference the last component of its path name */
args[0] = basename(args[0]);
args[0] = (char *)basename(args[0]);
/* execute the program or shell script */
execvp(a, args); /* returns only on failure */

View File

@ -356,6 +356,7 @@ static int global_input(const int c) {
break;
case EOF:
myexit(0);
break;
default:
return 0;
}
@ -368,7 +369,7 @@ int change_input(const int c) {
switch(c) {
case '*': /* invert page */
for(int i = 0; i < (nextline-1); i++) {
for(unsigned i = 0; i < (nextline-1); i++) {
change[topref + i] = !change[topref + i];
}
window_change |= CH_RESULT;

View File

@ -943,9 +943,6 @@ POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg) {
}
newitem = item2;
}
#if 0 /* this write is only need by commented-out code later */
set1p = item;
#endif
newsetp = newitem;
}
file = invcntl->postfile;
@ -994,103 +991,6 @@ POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg) {
}
item = newitem;
break; /* end of bool_OR */
#if 0
case AND:
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
if (set1p->lineoffset < posting.lineoffset) {
set1p++;
set1c++;
}
else if (set1p->lineoffset > posting.lineoffset) {
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
else if (set1p->type < posting.type) {
*set1p++;
set1c++;
}
else if (set1p->type > posting.type) {
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
else { /* identical postings */
*newsetp++ = *set1p++;
newsetc++;
set1c++;
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
}
break; /* end of AND */
case falseT:
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
if (set1p->lineoffset < posting.lineoffset) {
*newsetp++ = *set1p++;
newsetc++;
set1c++;
}
else if (set1p->lineoffset > posting.lineoffset) {
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
else if (set1p->type < posting.type) {
*newsetp++ = *set1p++;
newsetc++;
set1c++;
}
else if (set1p->type > posting.type) {
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
else { /* identical postings */
set1c++;
set1p++;
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
}
newsetc += numitems - set1c;
while (set1c++ < numitems) {
*newsetp++ = *set1p++;
}
break; /* end of falseT */
case REVERSEfalseT: /* core falseT incoming set */
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
if (set1p->lineoffset < posting.lineoffset) {
set1p++;
set1c++;
}
else if (set1p->lineoffset > posting.lineoffset) {
*newsetp++ = posting;
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
else if (set1p->type < posting.type) {
set1p++;
set1c++;
}
else if (set1p->type > posting.type) {
*newsetp++ = posting;
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
else { /* identical postings */
set1c++;
set1p++;
fread(&posting, (int) sizeof(posting), 1, file);
set2c++;
}
}
while (set2c++ < *num) {
*newsetp++ = posting;
newsetc++;
fread(&posting, (int) sizeof(posting), 1, file);
}
item = newitem;
break; /* end of REVERSEfalseT */
#endif
}
numitems = newsetc;
*num = newsetc;
@ -1098,50 +998,12 @@ POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg) {
return ((POSTING *)item);
}
#if 0
POSTING *
boolsave(int clear) /* flag about whether to clear core */
{
int i;
POSTING *ptr;
POSTING *oldstuff, *newstuff;
if (numitems == 0) {
if (clear)
boolclear();
return(NULL);
}
/* if clear then give them what we have and use boolready to realloc */
if (clear) {
ptr = item;
/* free up the space we didn't give them */
if (item == item1)
item1 = NULL;
else
item2 = NULL;
boolready();
return(ptr);
}
i = (enditem - item) * sizeof(*ptr) + 100;
if ((ptr = malloc(i)) == NULL) {
invcannotalloc(i);
return(ptr);
}
/* move present set into place */
oldstuff = item;
newstuff = ptr;
while (oldstuff < enditem)
*newstuff++ = *oldstuff++;
return(ptr);
}
#endif
static void invcannotalloc(unsigned n) {
fprintf(stderr, PROGRAM_NAME ": cannot allocate %u bytes\n", n);
}
static void invcannotopen(char *file) {
fprintf(stderr, PROGRAM_NAME "%s: cannot open file %s\n", file);
fprintf(stderr, PROGRAM_NAME ": cannot open file %s\n", file);
}
static void invcannotwrite(char *file) {

View File

@ -24,7 +24,6 @@ static struct PARTIAL_LINE {
static inline void previous_history_proxy(void);
static inline void next_history_proxy(void);
static inline int rebuild_reference(void);
bool interpret(int c) {