Commit 3db0dc3d authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

add macro charset(), a wrapper that calls memset(), and use it in

resize_variables()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2627 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 6 additions and 4 deletions
+6 -4
...@@ -119,8 +119,7 @@ CVS code - ...@@ -119,8 +119,7 @@ CVS code -
- If the current filestruct's been partitioned, unpartition it - If the current filestruct's been partitioned, unpartition it
before saving the associated file. (DLR) before saving the associated file. (DLR)
resize_variables() resize_variables()
- Use sizeof(char) in the memset() that initializes hblank - Use charset() instead of memset() to initialize hblank. (DLR)
instead of assuming that the size of a char is 1. (DLR)
copy_filestruct() copy_filestruct()
- Rename variable prev to copy to avoid confusion. (DLR) - Rename variable prev to copy to avoid confusion. (DLR)
print1opt_full() print1opt_full()
...@@ -142,6 +141,8 @@ CVS code - ...@@ -142,6 +141,8 @@ CVS code -
disable_extended_input() disable_extended_input()
- Disable extended output processing as well as extended input - Disable extended output processing as well as extended input
processing, and rename to disable_extended_io(). (DLR) processing, and rename to disable_extended_io(). (DLR)
- nano.h:
- Add macro charset(), a wrapper that calls memset(). (DLR)
- rcfile.c: - rcfile.c:
color_to_int() color_to_int()
- Since colorname's being NULL is handled elsewhere now, assert - Since colorname's being NULL is handled elsewhere now, assert
......
...@@ -212,7 +212,7 @@ void resize_variables(void) ...@@ -212,7 +212,7 @@ void resize_variables(void)
#endif #endif
hblank = charealloc(hblank, COLS + 1); hblank = charealloc(hblank, COLS + 1);
memset(hblank, ' ', COLS * sizeof(char)); charset(hblank, ' ', COLS);
hblank[COLS] = '\0'; hblank[COLS] = '\0';
} }
......
...@@ -45,11 +45,12 @@ ...@@ -45,11 +45,12 @@
#define ISSET(bit) ((flags & bit) != 0) #define ISSET(bit) ((flags & bit) != 0)
#define TOGGLE(bit) flags ^= bit #define TOGGLE(bit) flags ^= bit
/* Macros for character allocation. */ /* Macros for character allocation, etc. */
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char)) #define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char)) #define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char)) #define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
#define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char)) #define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char))
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
/* Other macros. */ /* Other macros. */
#ifdef BROKEN_REGEXEC #ifdef BROKEN_REGEXEC
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment