Skip to content

Commit

Permalink
Clean up minor code warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
tturocy committed Dec 27, 2023
1 parent 4b82371 commit d468897
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/cwlib/book.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ cw_scorebook_iterate(CWScorebook *scorebook,
}

void
cw_scorebook_iterator_cleanup(CWScorebookIterator *iterator)
cw_scorebook_iterator_cleanup(CWScorebookIterator * /*iterator*/)
{
/* For now, no actions need to be taken.
* This is provided now for possible future extensions and
Expand Down
28 changes: 13 additions & 15 deletions src/cwlib/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CWGame *cw_game_create(char *game_id)
{
CWGame *game = (CWGame *) malloc(sizeof(CWGame));

XCOPY(game->game_id, game_id);
XCOPY(game->game_id, game_id)
game->version = NULL;
game->first_info = NULL;
game->last_info = NULL;
Expand Down Expand Up @@ -135,7 +135,7 @@ static void cw_game_cleanup_events(CWGame *game, CWEvent *event)
free(event->auto_runner_id);
}
for (i = 1; i <= 3; i++) {
XFREE(event->presadj[i]);
XFREE(event->presadj[i])
}
while (sub != NULL) {
CWAppearance *next_sub = sub->next;
Expand All @@ -147,13 +147,13 @@ static void cw_game_cleanup_events(CWGame *game, CWEvent *event)
while (comment != NULL) {
CWComment *next_comment = comment->next;
free(comment->text);
XFREE(comment->ejection.person_id);
XFREE(comment->ejection.person_role);
XFREE(comment->ejection.umpire_id);
XFREE(comment->ejection.reason);
XFREE(comment->umpchange.inning);
XFREE(comment->umpchange.position);
XFREE(comment->umpchange.person_id);
XFREE(comment->ejection.person_id)
XFREE(comment->ejection.person_role)
XFREE(comment->ejection.umpire_id)
XFREE(comment->ejection.reason)
XFREE(comment->umpchange.inning)
XFREE(comment->umpchange.position)
XFREE(comment->umpchange.person_id)
free(comment);
comment = next_comment;
}
Expand Down Expand Up @@ -705,14 +705,12 @@ cw_game_read(FILE *file)
fgetpos(file, &filepos);
if (fgets(buf, 1024, file) == NULL) {
if (feof(file)) {
break;
break;
}
else {
if (game) {
cw_game_cleanup(game);
free(game);
}
return NULL;
cw_game_cleanup(game);
free(game);
return NULL;
}
}
if (feof(file)) {
Expand Down
2 changes: 1 addition & 1 deletion src/cwlib/lint.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ cw_game_lint_state(CWGameIterator *gameiter)
int
cw_game_lint(CWGame *game)
{
int ok = 1;
int ok;
CWGameIterator *gameiter = cw_gameiter_create(game);

ok = cw_game_lint_starters(game);
Expand Down
1 change: 0 additions & 1 deletion src/cwlib/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
Expand Down
2 changes: 1 addition & 1 deletion src/cwtools/cwbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ extern void cwbox_print_sportsml(XMLDoc *doc,

void cwbox_process_game(CWGame *game, CWRoster *visitors, CWRoster *home)
{
CWBoxscore *boxscore = 0;
CWBoxscore *boxscore;

if (!cw_game_lint(game)) {
fprintf(stderr, "WARNING: Sanity check fails for game %s, skipping...\n",
Expand Down
6 changes: 3 additions & 3 deletions src/cwtools/cwboxsml.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ cwbox_sml_get_hit_type(CWGameIterator *gameiter)
}

char *
cwbox_print_sml_pitch(XMLNode *action, XMLNode *node, char *pitch)
cwbox_print_sml_pitch(XMLNode * /*action*/, XMLNode *node, char *pitch)
{
char *c = pitch + 1;
XMLNode *contact = NULL;
Expand Down Expand Up @@ -1199,7 +1199,7 @@ static void
cwbox_action_baseball_substitution(XMLNode *parent,
CWGameIterator *gameiter,
CWAppearance *sub,
CWRoster *visitors, CWRoster *home,
CWRoster * /*visitors*/ , CWRoster * /*home*/,
int seq)
{
XMLNode *node = NULL;
Expand Down Expand Up @@ -1282,7 +1282,7 @@ cwbox_action_baseball_substitution(XMLNode *parent,
* Creates <event-actions>, with all PBP actions, as child of parent.
*/
static void
cwbox_actions(XMLNode *parent, CWGame *game, CWBoxscore *boxscore,
cwbox_actions(XMLNode *parent, CWGame *game, CWBoxscore * /*boxscore*/,
CWRoster *visitors, CWRoster *home)
{
XMLNode *actionNode = NULL, *node = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/cwtools/cwcomment.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static field_struct field_data[] = {
};

void
cwcomment_process_game(CWGame *game, CWRoster *visitors, CWRoster *home)
cwcomment_process_game(CWGame *game, CWRoster * /*visitors*/, CWRoster * /*home*/)
{
char *buf;
char output_line[4096];
Expand Down
4 changes: 2 additions & 2 deletions src/cwtools/cwdaily.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ DECLARE_FIELDFUNC(cwdaily_P_TB)
}
else {
stat += pitcher->pitching->h + pitcher->pitching->b2 +
2*pitcher->pitching->b3 + 3*pitcher->pitching->hr;;
2*pitcher->pitching->b3 + 3*pitcher->pitching->hr;
}
}
pitcher = pitcher->prev;
Expand Down Expand Up @@ -694,7 +694,7 @@ void cwdaily_process_game(CWGame *game, CWRoster *visitors, CWRoster *home)
{
char *buf;
char output_line[4096];
int i, j, t, seq, comma = 0;
int i, j, t, seq, comma;
CWGameIterator *gameiter = cw_gameiter_create(game);
CWBoxscore *box = cw_box_create(game);
CWBoxPlayer *player;
Expand Down
4 changes: 2 additions & 2 deletions src/cwtools/cwevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ DECLARE_FIELDFUNC(cwevent_pitches)
/* This bit of code wipes out leading whitespace, which bevent
* does not include in its output */
char *foo = gameiter->event->pitches;
while (foo != '\0' && isspace(*foo)) {
while (foo && isspace(*foo)) {
foo++;
}
return sprintf(buffer, (ascii) ? "\"%s\"" : "%-20s", foo);
Expand Down Expand Up @@ -1805,7 +1805,7 @@ cwevent_process_game(CWGame *game, CWRoster *visitors, CWRoster *home)
}
buf += (*ext_field_data[i].f)(buf, gameiter, visitors, home);
}
};
}

printf("%s", output_line);
printf("\n");
Expand Down
3 changes: 1 addition & 2 deletions src/cwtools/cwgame.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ DECLARE_FIELDFUNC(cwgame_gwrbi)
}

int
cwgame_final_pitcher(char *buffer, CWGame *game, CWBoxscore *box, int team)
cwgame_final_pitcher(char *buffer, CWGame * /*game*/, CWBoxscore *box, int team)
{
CWBoxPitcher *pitcher = box->pitchers[team];
char *player_id = (pitcher && pitcher->prev) ? pitcher->prev->player_id : "";
Expand Down Expand Up @@ -668,7 +668,6 @@ cwgame_starting_position(char *buffer, CWGame *game, int team, int slot)
else {
return sprintf(buffer, "0");
}
return 0;
}

/* Field 84 */
Expand Down
2 changes: 1 addition & 1 deletion src/cwtools/cwsub.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static field_struct field_data[] = {
};

void
cwsub_process_game(CWGame *game, CWRoster *visitors, CWRoster *home)
cwsub_process_game(CWGame *game, CWRoster * /*visitors*/, CWRoster * /*home*/)
{
char *buf;
char output_line[1024];
Expand Down

0 comments on commit d468897

Please sign in to comment.