From aa2832dff99095dbf2067775726f9cc970a732cd Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Mon, 4 Feb 2002 18:09:42 +0000 Subject: [PATCH] * util.c [!HAVE_TRUNCATE] (truncate): Close fd if my_ftruncate fails. * util.c [HAVE_CHARSET] (is_printable): Eliminate printable. * setup.c [HAVE_CHARSET] (load_setup): Don't use init_printable_table(). * charset.c (printable): Removed. (init_printable_table): Removed. --- src/ChangeLog | 13 +++++++++++++ src/charsets.c | 16 ---------------- src/charsets.h | 1 - src/setup.c | 1 - src/util.c | 13 +++++-------- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5c1a931d0..1e5fc87ff 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2002-02-04 Andrew V. Samoilov + + * util.c [!HAVE_TRUNCATE] (truncate): Close fd if my_ftruncate + fails. + + * util.c [HAVE_CHARSET] (is_printable): Eliminate printable. + * setup.c [HAVE_CHARSET] (load_setup): Don't use + init_printable_table. + + * charsets.h: Don't declare init_printable_table (). + * charset.c (printable): Removed. + (init_printable_table): Removed. + 2002-01-30 Andrew V. Samoilov * file.c (recursive_erase): Use mc_closedir() if mc_lstat() diff --git a/src/charsets.c b/src/charsets.c index 72a3d1181..b188d6846 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -15,7 +15,6 @@ struct codepage_desc *codepages; uchar conv_displ[256]; uchar conv_input[256]; -uchar printable[256]; int load_codepages_list(void) { @@ -143,21 +142,6 @@ char errbuf[255]; */ #define CP_ASCII 0 -char* init_printable_table( int cpdisplay ) -{ - int i; - - /* Fill printable characters table */ - for (i=0; i<=127; ++i) - printable[i] = (i > 31 && i != 127); - - for (i=128; i<=255; ++i) { - printable[i] = 1; - } - - return NULL; -} - char* init_translation_table( int cpsource, int cpdisplay ) { int i; diff --git a/src/charsets.h b/src/charsets.h index 1bc0ca473..b16265160 100644 --- a/src/charsets.h +++ b/src/charsets.h @@ -25,7 +25,6 @@ char *get_codepage_id( int n ); int get_codepage_index( const char *id ); int load_codepages_list(void); void free_codepages_list(void); -char* init_printable_table( int cpdisplay ); char* init_translation_table( int cpsource, int cpdisplay ); void convert_to_display( char *str ); void convert_from_input( char *str ); diff --git a/src/setup.c b/src/setup.c index 2499b7aca..a89eff2f8 100644 --- a/src/setup.c +++ b/src/setup.c @@ -573,7 +573,6 @@ load_setup (void) display_codepage = get_codepage_index( cpname ); } - init_printable_table( display_codepage ); init_translation_table( source_codepage, display_codepage ); #endif /* HAVE_CHARSET */ } diff --git a/src/util.c b/src/util.c index 1c5c3fae4..631a07532 100644 --- a/src/util.c +++ b/src/util.c @@ -78,13 +78,10 @@ int is_printable (int c) c &= 0xff; #ifdef HAVE_CHARSET - if (display_codepage < 0) { - if (xterm_flag) - return xterm_printable[c]; - else - return (c > 31 && c != 127 && c != 155); - } else - return printable[ c ]; + if (xterm_flag) + return xterm_printable[c]; + else + return (c > 31 && c != 127 && c != 155); #else if (eight_bit_clean){ if (full_eight_bits){ @@ -1258,9 +1255,9 @@ int truncate (const char *path, long size) if (fd < 0) return fd; res = my_ftruncate (fd, size); + close (fd); if (res < 0) return res; - close (fd); return 0; }