Change some asserts flagging runtime errors to fatal_asserts (Anders Kaseorg)
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "terminaloverlay.h"
|
#include "terminaloverlay.h"
|
||||||
#include "locale_utils.h"
|
#include "locale_utils.h"
|
||||||
|
#include "fatal_assert.h"
|
||||||
|
|
||||||
const int ITERATIONS = 100000;
|
const int ITERATIONS = 100000;
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ int main( void )
|
|||||||
|
|
||||||
/* Adopt native locale */
|
/* Adopt native locale */
|
||||||
set_native_locale();
|
set_native_locale();
|
||||||
assert( is_utf8_locale() );
|
fatal_assert( is_utf8_locale() );
|
||||||
|
|
||||||
for ( int i = 0; i < ITERATIONS; i++ ) {
|
for ( int i = 0; i < ITERATIONS; i++ ) {
|
||||||
/* type a character */
|
/* type a character */
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "swrite.h"
|
#include "swrite.h"
|
||||||
#include "locale_utils.h"
|
#include "locale_utils.h"
|
||||||
|
#include "fatal_assert.h"
|
||||||
|
|
||||||
const size_t buf_size = 1024;
|
const size_t buf_size = 1024;
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ int main( int argc __attribute__((unused)),
|
|||||||
struct termios saved_termios, raw_termios, child_termios;
|
struct termios saved_termios, raw_termios, child_termios;
|
||||||
|
|
||||||
set_native_locale();
|
set_native_locale();
|
||||||
assert( is_utf8_locale() );
|
fatal_assert( is_utf8_locale() );
|
||||||
|
|
||||||
if ( tcgetattr( STDIN_FILENO, &saved_termios ) < 0 ) {
|
if ( tcgetattr( STDIN_FILENO, &saved_termios ) < 0 ) {
|
||||||
perror( "tcgetattr" );
|
perror( "tcgetattr" );
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ int main( void )
|
|||||||
struct termios saved_termios, raw_termios, child_termios;
|
struct termios saved_termios, raw_termios, child_termios;
|
||||||
|
|
||||||
set_native_locale();
|
set_native_locale();
|
||||||
assert( is_utf8_locale() );
|
fatal_assert( is_utf8_locale() );
|
||||||
|
|
||||||
if ( tcgetattr( STDIN_FILENO, &saved_termios ) < 0 ) {
|
if ( tcgetattr( STDIN_FILENO, &saved_termios ) < 0 ) {
|
||||||
perror( "tcgetattr" );
|
perror( "tcgetattr" );
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ int main( int argc, char *argv[] )
|
|||||||
i != locale_vars.end();
|
i != locale_vars.end();
|
||||||
i++ ) {
|
i++ ) {
|
||||||
char *env_string = strdup( i->c_str() );
|
char *env_string = strdup( i->c_str() );
|
||||||
assert( env_string );
|
fatal_assert( env_string );
|
||||||
if ( 0 != putenv( env_string ) ) {
|
if ( 0 != putenv( env_string ) ) {
|
||||||
perror( "putenv" );
|
perror( "putenv" );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user