mirror of
https://github.com/simh/simh.git
synced 2026-01-11 23:52:58 +00:00
SCP: Assure that ASSURE() gets used instead of assert()
This commit is contained in:
parent
2156bf4192
commit
be831daa1d
@ -25,7 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include "display.h" /* XY plot interface */
|
#include "display.h" /* XY plot interface */
|
||||||
#include "ng.h"
|
#include "ng.h"
|
||||||
|
|
||||||
@ -123,7 +122,9 @@ int
|
|||||||
ng_init(void *dev, int debug)
|
ng_init(void *dev, int debug)
|
||||||
{
|
{
|
||||||
/* Don't change this number. */
|
/* Don't change this number. */
|
||||||
assert (DISPLAYS == 8);
|
#if (DISPLAYS != 8)
|
||||||
|
#error "DISPLAYS is not 8"
|
||||||
|
#endif
|
||||||
|
|
||||||
ng_dptr = dev;
|
ng_dptr = dev;
|
||||||
ng_dbit = debug;
|
ng_dbit = debug;
|
||||||
|
|||||||
@ -1093,6 +1093,14 @@ struct MEMFILE {
|
|||||||
snprintf(buf, sizeof (buf), "%s failed", #_Expression); \
|
snprintf(buf, sizeof (buf), "%s failed", #_Expression); \
|
||||||
SIM_SCP_ABORT (buf); \
|
SIM_SCP_ABORT (buf); \
|
||||||
}
|
}
|
||||||
|
#if defined(assert)
|
||||||
|
#error "Don't use assert(). It is advised to use ASSURE(expression) instead"
|
||||||
|
#else
|
||||||
|
#define assert(_Expression) do { \
|
||||||
|
fprintf (stderr, "Don't use assert(). It is advised to use ASSURE(expression) instead.\n"); \
|
||||||
|
abort(); \
|
||||||
|
} while (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SIM_ASYNCH_IO)
|
#if defined(SIM_ASYNCH_IO)
|
||||||
#define AIO_CHECK_EVENT sim_aio_check_event()
|
#define AIO_CHECK_EVENT sim_aio_check_event()
|
||||||
|
|||||||
@ -387,7 +387,10 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nb_options > 0) {
|
if (nb_options > 0) {
|
||||||
assert(nb_options <= ARRAY_SIZE(option_name));
|
if (nb_options > ARRAY_SIZE(option_name)) {
|
||||||
|
fprintf (stderr, "option_name array bounds: %d\n", nb_options);
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
tftp_send_oack(spt, option_name, option_value, nb_options, tp);
|
tftp_send_oack(spt, option_name, option_value, nb_options, tp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user