AP_WindVane: use NEW_NOTHROW for new(std::nothrow)

This commit is contained in:
Andrew Tridgell 2024-05-27 11:24:15 +10:00
parent 76d16e2d78
commit db6bcdb725
1 changed files with 9 additions and 9 deletions

View File

@ -209,23 +209,23 @@ void AP_WindVane::init(const AP_SerialManager& serial_manager)
#if AP_WINDVANE_HOME_ENABLED #if AP_WINDVANE_HOME_ENABLED
case WindVaneType::WINDVANE_HOME_HEADING: case WindVaneType::WINDVANE_HOME_HEADING:
case WindVaneType::WINDVANE_PWM_PIN: case WindVaneType::WINDVANE_PWM_PIN:
_direction_driver = new AP_WindVane_Home(*this); _direction_driver = NEW_NOTHROW AP_WindVane_Home(*this);
break; break;
#endif #endif
#if AP_WINDVANE_ANALOG_ENABLED #if AP_WINDVANE_ANALOG_ENABLED
case WindVaneType::WINDVANE_ANALOG_PIN: case WindVaneType::WINDVANE_ANALOG_PIN:
_direction_driver = new AP_WindVane_Analog(*this); _direction_driver = NEW_NOTHROW AP_WindVane_Analog(*this);
break; break;
#endif #endif
#if AP_WINDVANE_SIM_ENABLED #if AP_WINDVANE_SIM_ENABLED
case WindVaneType::WINDVANE_SITL_TRUE: case WindVaneType::WINDVANE_SITL_TRUE:
case WindVaneType::WINDVANE_SITL_APPARENT: case WindVaneType::WINDVANE_SITL_APPARENT:
_direction_driver = new AP_WindVane_SITL(*this); _direction_driver = NEW_NOTHROW AP_WindVane_SITL(*this);
break; break;
#endif #endif
#if AP_WINDVANE_NMEA_ENABLED #if AP_WINDVANE_NMEA_ENABLED
case WindVaneType::WINDVANE_NMEA: case WindVaneType::WINDVANE_NMEA:
_direction_driver = new AP_WindVane_NMEA(*this); _direction_driver = NEW_NOTHROW AP_WindVane_NMEA(*this);
_direction_driver->init(serial_manager); _direction_driver->init(serial_manager);
break; break;
#endif #endif
@ -237,12 +237,12 @@ void AP_WindVane::init(const AP_SerialManager& serial_manager)
break; break;
#if AP_WINDVANE_AIRSPEED_ENABLED #if AP_WINDVANE_AIRSPEED_ENABLED
case Speed_type::WINDSPEED_AIRSPEED: case Speed_type::WINDSPEED_AIRSPEED:
_speed_driver = new AP_WindVane_Airspeed(*this); _speed_driver = NEW_NOTHROW AP_WindVane_Airspeed(*this);
break; break;
#endif #endif
#if AP_WINDVANE_MODERNDEVICE_ENABLED #if AP_WINDVANE_MODERNDEVICE_ENABLED
case Speed_type::WINDVANE_WIND_SENSOR_REV_P: case Speed_type::WINDVANE_WIND_SENSOR_REV_P:
_speed_driver = new AP_WindVane_ModernDevice(*this); _speed_driver = NEW_NOTHROW AP_WindVane_ModernDevice(*this);
break; break;
#endif #endif
#if AP_WINDVANE_SIM_ENABLED #if AP_WINDVANE_SIM_ENABLED
@ -250,7 +250,7 @@ void AP_WindVane::init(const AP_SerialManager& serial_manager)
case Speed_type::WINDSPEED_SITL_APPARENT: case Speed_type::WINDSPEED_SITL_APPARENT:
// single driver does both speed and direction // single driver does both speed and direction
if (_direction_type != _speed_sensor_type) { if (_direction_type != _speed_sensor_type) {
_speed_driver = new AP_WindVane_SITL(*this); _speed_driver = NEW_NOTHROW AP_WindVane_SITL(*this);
} else { } else {
_speed_driver = _direction_driver; _speed_driver = _direction_driver;
} }
@ -260,7 +260,7 @@ void AP_WindVane::init(const AP_SerialManager& serial_manager)
case Speed_type::WINDSPEED_NMEA: case Speed_type::WINDSPEED_NMEA:
// single driver does both speed and direction // single driver does both speed and direction
if (_direction_type != WindVaneType::WINDVANE_NMEA) { if (_direction_type != WindVaneType::WINDVANE_NMEA) {
_speed_driver = new AP_WindVane_NMEA(*this); _speed_driver = NEW_NOTHROW AP_WindVane_NMEA(*this);
_speed_driver->init(serial_manager); _speed_driver->init(serial_manager);
} else { } else {
_speed_driver = _direction_driver; _speed_driver = _direction_driver;
@ -269,7 +269,7 @@ void AP_WindVane::init(const AP_SerialManager& serial_manager)
#endif // AP_WINDVANE_NMEA_ENABLED #endif // AP_WINDVANE_NMEA_ENABLED
#if AP_WINDVANE_RPM_ENABLED #if AP_WINDVANE_RPM_ENABLED
case Speed_type::WINDSPEED_RPM: case Speed_type::WINDSPEED_RPM:
_speed_driver = new AP_WindVane_RPM(*this); _speed_driver = NEW_NOTHROW AP_WindVane_RPM(*this);
break; break;
#endif #endif
} }