Start the long road to exception readiness.

This commit is contained in:
2024-04-24 21:58:14 -04:00
parent 5380bef097
commit bbecfcfd47
2 changed files with 15 additions and 7 deletions
+8 -6
View File
@@ -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;
}
+7 -1
View File
@@ -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 );