Ticket #44856

player_distance_to_player() clang analyzer div by zero warning

Date d'ouverture: 2022-06-18 17:11 Dernière mise à jour: 2022-06-24 07:14

Rapporteur:
Propriétaire:
Type:
État:
Atteints
Composant:
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Fixed
Fichier:
2

Détails

Clang analyzer giver div by zero warning about player_distance_to_player() line "return MAX(dists / cities, 1);"

There's no bug in there. It's just that the compiler cannot know that "city_list_size(pplayer->cities) == 0" check earlier makes sure that city_list_iterate() makes at least one iteration. Anyway, we should silence the warning, and doing that even speeds up the function.

Ticket History (3/5 Histories)

2022-06-18 17:11 Updated by: cazfi
  • New Ticket "player_distance_to_player() clang analyzer div by zero warning" created
2022-06-18 17:17 Updated by: cazfi
  • Propriétaire Update from (Aucun) to cazfi
  • Résolution Update from Aucun to Accepted
2022-06-24 07:14 Updated by: cazfi
  • État Update from Ouvert to Atteints
  • Résolution Update from Accepted to Fixed

Modifier

Please login to add comment to this ticket » Connexion