replace for loop for hline init with memset in init functions

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@501 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2001-01-23 02:35:04 +00:00
parent 17276e506e
commit 0a06e07831
2 changed files with 7 additions and 14 deletions

View File

@ -21,6 +21,8 @@ General
- Added restoration of totsize after unjustify command.
usage()
- Add arg to -T help (Rocco).
global_init(), handle_sigwinch()
- Messy loops replaced with memset calls (Rocco).
nano 0.9.99pre1 - 01/17/2001
General

19
nano.c
View File

@ -167,8 +167,6 @@ void clear_filename(void)
/* Initialize global variables - no better way for now */
void global_init(void)
{
int i;
current_x = 0;
current_y = 0;
@ -190,11 +188,8 @@ void global_init(void)
die_too_small();
hblank = nmalloc(COLS + 1);
/* Thanks BG for this bit... */
for (i = 0; i <= COLS - 1; i++)
hblank[i] = ' ';
hblank[i] = 0;
memset(hblank, ' ', COLS);
hblank[COLS] = 0;
}
#ifndef DISABLE_HELP
@ -1543,7 +1538,6 @@ void handle_sigwinch(int s)
char *tty = NULL;
int fd = 0;
int result = 0;
int i = 0;
struct winsize win;
tty = ttyname(0);
@ -1566,12 +1560,9 @@ void handle_sigwinch(int s)
if ((fill = COLS - CHARS_FROM_EOL) < MIN_FILL_LENGTH)
die_too_small();
free(hblank);
hblank = nmalloc(COLS + 1);
for (i = 0; i <= COLS - 1; i++)
hblank[i] = ' ';
hblank[i] = 0;
hblank = nrealloc(hblank, COLS + 1);
memset(hblank, ' ', COLS);
hblank[COLS] = 0;
#ifdef HAVE_NCURSES_H
resizeterm(LINES, COLS);