待辦事項 #44856

player_distance_to_player() clang analyzer div by zero warning

啟用日期: 2022-06-18 17:11 最後更新: 2022-06-24 07:14

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
修正
檔案:
2

細節

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
  • 負責人 Update from (無) to cazfi
  • 處理結果 Update from to Accepted
2022-06-24 07:14 Updated by: cazfi
  • 狀態 Update from 開啟 to 關閉
  • 處理結果 Update from Accepted to 修正

編輯

Please login to add comment to this ticket » 登入