src/nhl_scores.c
// Returns true iff 'team' is participating in 'game'
Returns true iff 'team' is participating in 'game'
Returns true iff ' team ' is participating in ' game '
bool is_team_in_game(json_t *game, char *team) {
  char *away_city = new_lowercase_nospace(
    json_string_value(json_object_get(game, AWAY_CITY))
  );
  const char *away_name = json_string_value(
    json_object_get(game, AWAY_NAME)
  );
  char *home_city = new_lowercase_nospace(
    json_string_value(json_object_get(game, HOME_CITY))
  );
  const char *home_name = json_string_value(
    json_object_get(game, HOME_NAME)
  );
  bool res = streq(away_city, team) || streq(away_name, team)
          || streq(home_city, team) || streq(home_name, team);
  free(away_city);
  free(home_city);
  return res;
}
bool is_team_in_game ( json_t * game , char * team ) { char * away_city = new_lowercase_nospace ( json_string_value ( json_object_get ( game , AWAY_CITY ) ) ) ; const char * away_name = json_string_value ( json_object_get ( game , AWAY_NAME ) ) ; char * home_city = new_lowercase_nospace ( json_string_value ( json_object_get ( game , HOME_CITY ) ) ) ; const char * home_name = json_string_value ( json_object_get ( game , HOME_NAME ) ) ; bool res = streq ( away_city , team ) || streq ( away_name , team ) || streq ( home_city , team ) || streq ( home_name , team ) ; free ( away_city ) ; free ( home_city ) ; return res ; }
Returns true iff 'team' is participating in 'game'
Returns true iff ' team ' is participating in ' game '