Removed dead stores.

This commit is contained in:
wyld-sw 2018-07-15 10:29:57 -04:00
parent 5cca63a01c
commit bf941bc9b2
28 changed files with 85 additions and 139 deletions

View file

@ -1877,7 +1877,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
static void mod_llog_entry(struct last_entry *llast,int type) {
FILE *fp;
struct last_entry mlast;
int size, recs, tmp, i, j;
int size, recs, tmp;
if(!(fp=fopen(LAST_FILE,"r+"))) {
log("Error opening last_file for reading and writing.");
@ -1893,7 +1893,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
* do (like searching for the last shutdown/etc..) */
for(tmp=recs; tmp > 0; tmp--) {
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
i = fread(&mlast,sizeof(struct last_entry),1,fp);
fread(&mlast,sizeof(struct last_entry),1,fp);
/* Another one to keep that stepback. */
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
@ -1908,7 +1908,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
}
mlast.close_time=time(0);
/*write it, and we're done!*/
j = fwrite(&mlast,sizeof(struct last_entry),1,fp);
fwrite(&mlast,sizeof(struct last_entry),1,fp);
fclose(fp);
return;
}
@ -1923,7 +1923,6 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
void add_llog_entry(struct char_data *ch, int type) {
FILE *fp;
struct last_entry *llast;
int i;
/* so if a char enteres a name, but bad password, otherwise loses link before
* he gets a pref assinged, we won't record it */
@ -1950,7 +1949,7 @@ void add_llog_entry(struct char_data *ch, int type) {
free(llast);
return;
}
i = fwrite(llast,sizeof(struct last_entry),1,fp);
fwrite(llast,sizeof(struct last_entry),1,fp);
fclose(fp);
} else {
/* We've found a login - update it */
@ -1962,7 +1961,7 @@ void add_llog_entry(struct char_data *ch, int type) {
void clean_llog_entries(void) {
FILE *ofp, *nfp;
struct last_entry mlast;
int recs, i, j;
int recs;
if(!(ofp=fopen(LAST_FILE,"r")))
return; /* no file, no gripe */
@ -1987,8 +1986,8 @@ void clean_llog_entries(void) {
/* copy the rest */
while (!feof(ofp)) {
i = fread(&mlast,sizeof(struct last_entry),1,ofp);
j = fwrite(&mlast,sizeof(struct last_entry),1,nfp);
fread(&mlast,sizeof(struct last_entry),1,ofp);
fwrite(&mlast,sizeof(struct last_entry),1,nfp);
}
fclose(ofp);
fclose(nfp);
@ -2002,7 +2001,6 @@ static void list_llog_entries(struct char_data *ch)
{
FILE *fp;
struct last_entry llast;
int i;
char timestr[25];
if(!(fp=fopen(LAST_FILE,"r"))) {
@ -2010,14 +2008,14 @@ static void list_llog_entries(struct char_data *ch)
send_to_char(ch, "Error! - no last log");
}
send_to_char(ch, "Last log\r\n");
i = fread(&llast, sizeof(struct last_entry), 1, fp);
fread(&llast, sizeof(struct last_entry), 1, fp);
strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M:%S", localtime(&llast.time));
while(!feof(fp)) {
send_to_char(ch, "%10s\t%d\t%s\t%s\r\n", llast.username, llast.punique,
last_array[llast.close_type], timestr);
i = fread(&llast, sizeof(struct last_entry), 1, fp);
fread(&llast, sizeof(struct last_entry), 1, fp);
}
}
@ -2039,7 +2037,7 @@ ACMD(do_last)
time_t delta;
struct char_data *vict = NULL;
struct char_data *temp;
int recs, i, num = 0;
int recs, num = 0;
FILE *fp;
struct last_entry mlast;
@ -2097,7 +2095,7 @@ ACMD(do_last)
send_to_char(ch, "Last log\r\n");
while(num > 0 && recs > 0) {
fseek(fp,-1* ((long)sizeof(struct last_entry)),SEEK_CUR);
i = fread(&mlast,sizeof(struct last_entry),1,fp);
fread(&mlast,sizeof(struct last_entry),1,fp);
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
if(!*name ||(*name && !str_cmp(name, mlast.username))) {
strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M", localtime(&mlast.time));
@ -2180,7 +2178,6 @@ ACMD(do_wiznet)
buf2[MAX_INPUT_LENGTH + MAX_NAME_LENGTH + 32];
struct descriptor_data *d;
char emote = FALSE;
char any = FALSE;
int level = LVL_IMMORT;
skip_spaces(&argument);
@ -2207,7 +2204,7 @@ ACMD(do_wiznet)
case '@':
send_to_char(ch, "God channel status:\r\n");
for (any = 0, d = descriptor_list; d; d = d->next) {
for (d = descriptor_list; d; d = d->next) {
if (STATE(d) != CON_PLAYING || GET_LEVEL(d->character) < LVL_IMMORT)
continue;
if (!CAN_SEE(ch, d->character))
@ -2422,7 +2419,7 @@ static size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int l
zone_table[zone].age, zone_table[zone].lifespan,
zone_table[zone].reset_mode ? ((zone_table[zone].reset_mode == 1) ? "Reset when no players are in zone" : "Normal reset") : "Never reset",
zone_table[zone].bot, zone_table[zone].top);
i = j = k = l = m = n = o = 0;
j = k = l = m = n = o = 0;
for (i = 0; i < top_of_world; i++)
if (world[i].number >= zone_table[zone].bot && world[i].number <= zone_table[zone].top)
@ -3666,7 +3663,7 @@ ACMD (do_zcheck)
"- Neither SENTINEL nor STAY_ZONE bits set.\r\n");
if (MOB_FLAGGED(mob, MOB_SPEC) && (found = 1))
len += snprintf(buf + len, sizeof(buf) - len,
snprintf(buf + len, sizeof(buf) - len,
"- SPEC flag needs to be removed.\r\n");
/* Additional mob checks.*/
@ -3804,7 +3801,7 @@ ACMD (do_zcheck)
ext2 = ext;
if (ext2 && (found = 1))
len += snprintf(buf + len, sizeof(buf) - len,
snprintf(buf + len, sizeof(buf) - len,
"- has unformatted extra description\r\n");
/* Additional object checks. */
if (found) {
@ -4153,7 +4150,6 @@ ACMD(do_copyover)
FILE *fp;
struct descriptor_data *d, *d_next;
char buf [100], buf2[100];
int i;
fp = fopen (COPYOVER_FILE, "w");
if (!fp) {
@ -4199,7 +4195,7 @@ ACMD(do_copyover)
sprintf (buf2, "-C%d", mother_desc);
/* Ugh, seems it is expected we are 1 step above lib - this may be dangerous! */
i = chdir ("..");
chdir ("..");
/* Close reserve and other always-open files and release other resources */
execl (EXE_FILE, "circle", buf2, buf, (char *) NULL);
@ -4229,17 +4225,15 @@ ACMD(do_peace)
ACMD(do_zpurge)
{
int vroom, room, vzone = 0, zone = 0;
int vroom, room, zone = 0;
char arg[MAX_INPUT_LENGTH];
int purge_all = FALSE;
one_argument(argument, arg);
if (*arg == '.' || !*arg) {
zone = world[IN_ROOM(ch)].zone;
vzone = zone_table[zone].number;
}
else if (is_number(arg)) {
vzone = atoi(arg);
zone = real_zone(vzone);
zone = real_zone(atoi(arg));
if (zone == NOWHERE || zone > top_of_zone_table) {
send_to_char(ch, "That zone doesn't exist!\r\n");
return;
@ -4291,7 +4285,7 @@ ACMD(do_file)
int req_file_lines = 0; /* Number of total lines in file to be read. */
int lines_read = 0; /* Counts total number of lines read from the file. */
int req_lines = 0; /* Number of lines requested to be displayed. */
int i, j; /* Generic loop counters. */
int i; /* Generic loop counter. */
int l; /* Marks choice of file in fields array. */
char field[MAX_INPUT_LENGTH]; /* Holds users choice of file to be read. */
char value[MAX_INPUT_LENGTH]; /* Holds # lines to be read, if requested. */
@ -4335,7 +4329,7 @@ ACMD(do_file)
/* Display usage if no argument. */
if (!*argument) {
send_to_char(ch, "USAGE: file <filename> <num lines>\r\n\r\nFile options:\r\n");
for (j = 0, i = 0; fields[i].level; i++)
for (i = 0; fields[i].level; i++)
if (fields[i].level <= GET_LEVEL(ch))
send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file);
return;