mirror of
https://github.com/tbamud/tbamud.git
synced 2026-01-28 20:06:09 +01:00
Removed dead stores.
This commit is contained in:
parent
5cca63a01c
commit
bf941bc9b2
28 changed files with 85 additions and 139 deletions
28
src/db.c
28
src/db.c
|
|
@ -155,10 +155,9 @@ static int hsort(const void *a, const void *b);
|
|||
char *fread_action(FILE *fl, int nr)
|
||||
{
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
char *buf1;
|
||||
int i;
|
||||
|
||||
buf1 = fgets(buf, MAX_STRING_LENGTH, fl);
|
||||
fgets(buf, MAX_STRING_LENGTH, fl);
|
||||
if (feof(fl)) {
|
||||
log("SYSERR: fread_action: unexpected EOF near action #%d", nr);
|
||||
/* SYSERR_DESC: fread_action() will fail if it discovers an end of file
|
||||
|
|
@ -186,8 +185,8 @@ char *fread_action(FILE *fl, int nr)
|
|||
static void boot_social_messages(void)
|
||||
{
|
||||
FILE *fl;
|
||||
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1, i;
|
||||
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH], *buf;
|
||||
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1;
|
||||
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH];
|
||||
|
||||
if (CONFIG_NEW_SOCIALS == TRUE) {
|
||||
/* open social file */
|
||||
|
|
@ -201,7 +200,7 @@ static void boot_social_messages(void)
|
|||
/* count socials */
|
||||
*next_soc = '\0';
|
||||
while (!feof(fl)) {
|
||||
buf = fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
if (*next_soc == '~') top_of_socialt++;
|
||||
}
|
||||
} else { /* old style */
|
||||
|
|
@ -216,7 +215,7 @@ static void boot_social_messages(void)
|
|||
}
|
||||
/* count socials */
|
||||
while (!feof(fl)) {
|
||||
buf = fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
fgets(next_soc, MAX_STRING_LENGTH, fl);
|
||||
if (*next_soc == '\n' || *next_soc == '\r') top_of_socialt++; /* all socials are followed by a blank line */
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +227,7 @@ static void boot_social_messages(void)
|
|||
|
||||
/* now read 'em */
|
||||
for (;;) {
|
||||
i = fscanf(fl, " %s ", next_soc);
|
||||
fscanf(fl, " %s ", next_soc);
|
||||
if (*next_soc == '$') break;
|
||||
if (CONFIG_NEW_SOCIALS == TRUE) {
|
||||
if (fscanf(fl, " %s %d %d %d %d \n",
|
||||
|
|
@ -795,12 +794,11 @@ static void reset_time(void)
|
|||
{
|
||||
time_t beginning_of_time = 0;
|
||||
FILE *bgtime;
|
||||
int i;
|
||||
|
||||
if ((bgtime = fopen(TIME_FILE, "r")) == NULL)
|
||||
log("No time file '%s' starting from the beginning.", TIME_FILE);
|
||||
else {
|
||||
i = fscanf(bgtime, "%ld\n", (long *)&beginning_of_time);
|
||||
fscanf(bgtime, "%ld\n", (long *)&beginning_of_time);
|
||||
fclose(bgtime);
|
||||
}
|
||||
|
||||
|
|
@ -913,7 +911,7 @@ void index_boot(int mode)
|
|||
{
|
||||
const char *index_filename, *prefix = NULL; /* NULL or egcs 1.1 complains */
|
||||
FILE *db_index, *db_file;
|
||||
int rec_count = 0, size[2], i;
|
||||
int rec_count = 0, size[2];
|
||||
char buf2[PATH_MAX], buf1[MAX_STRING_LENGTH];
|
||||
|
||||
switch (mode) {
|
||||
|
|
@ -958,13 +956,13 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
/* first, count the number of records in the file so we can malloc */
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
while (*buf1 != '$') {
|
||||
snprintf(buf2, sizeof(buf2), "%s%s", prefix, buf1);
|
||||
if (!(db_file = fopen(buf2, "r"))) {
|
||||
log("SYSERR: File '%s' listed in '%s/%s': %s", buf2, prefix,
|
||||
index_filename, strerror(errno));
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
continue;
|
||||
} else {
|
||||
if (mode == DB_BOOT_ZON)
|
||||
|
|
@ -976,7 +974,7 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
fclose(db_file);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
}
|
||||
|
||||
/* Exit if 0 records, unless this is shops */
|
||||
|
|
@ -1030,7 +1028,7 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
rewind(db_index);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
while (*buf1 != '$') {
|
||||
snprintf(buf2, sizeof(buf2), "%s%s", prefix, buf1);
|
||||
if (!(db_file = fopen(buf2, "r"))) {
|
||||
|
|
@ -1057,7 +1055,7 @@ void index_boot(int mode)
|
|||
}
|
||||
|
||||
fclose(db_file);
|
||||
i = fscanf(db_index, "%s\n", buf1);
|
||||
fscanf(db_index, "%s\n", buf1);
|
||||
}
|
||||
fclose(db_index);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue