Start the long road to exception readiness.
This commit is contained in:
@@ -61,9 +61,15 @@ SortStarsOnName (STAR_SEARCH_STATE *pSS)
|
||||
}
|
||||
|
||||
|
||||
// Since HMalloc just terminates on failure,
|
||||
// we can use `new` safely from mixed C++ and
|
||||
// C. Either I'll use `std::new_handler` to
|
||||
// do the same thing... or just let exceptions
|
||||
// tear it down by bumping into the `noexcept`
|
||||
// boundaries I'll stick on the `extern "C"`
|
||||
// interfaces.
|
||||
extern "C" bool
|
||||
DoStarSearch (MENU_STATE *pMS)
|
||||
try
|
||||
DoStarSearch (MENU_STATE *pMS) noexcept
|
||||
{
|
||||
TEXTENTRY_STATE tes;
|
||||
bool success;
|
||||
@@ -98,7 +104,3 @@ try
|
||||
|
||||
return success;
|
||||
}
|
||||
catch( const std::bad_alloc & )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,14 @@
|
||||
#include "uqm/menustat.h"
|
||||
#include "uqm/controls.h"
|
||||
|
||||
#ifndef CXX_NOEXCEPT
|
||||
#define CXX_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#undef CXX_NOEXCEPT
|
||||
#define CXX_NOEXCEPT noexcept
|
||||
#endif
|
||||
|
||||
extern STAR_DESC *CurStarDescPtr;
|
||||
@@ -65,7 +71,7 @@ typedef struct starsearch_state
|
||||
int *SortedStars;
|
||||
} STAR_SEARCH_STATE;
|
||||
|
||||
bool DoStarSearch( MENU_STATE * );
|
||||
bool DoStarSearch( MENU_STATE * ) CXX_NOEXCEPT;
|
||||
BOOLEAN OnStarNameChange( TEXTENTRY_STATE * );
|
||||
BOOLEAN OnStarNameFrame ( TEXTENTRY_STATE *pTES );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user