Commit 1f104f80 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

fix a comment in nano.h and a minor memory leak in display_string()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3271 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 6 additions and 3 deletions
+6 -3
...@@ -35,6 +35,8 @@ CVS code - ...@@ -35,6 +35,8 @@ CVS code -
fixes a potential display problem when a search moves the fixes a potential display problem when a search moves the
cursor offscreen and onto a different page. (DLR, found by cursor offscreen and onto a different page. (DLR, found by
Mike Frysinger) Mike Frysinger)
display_string()
- Fix minor memory leak. (DLR)
- doc/nano.1: - doc/nano.1:
- Better display the default values for quotestr. (DLR) - Better display the default values for quotestr. (DLR)
- doc/nanorc.5: - doc/nanorc.5:
......
...@@ -590,7 +590,7 @@ typedef struct rcoption { ...@@ -590,7 +590,7 @@ typedef struct rcoption {
* counting the blank lines at their ends. */ * counting the blank lines at their ends. */
#define MAX_SEARCH_HISTORY 100 #define MAX_SEARCH_HISTORY 100
/* The maximum number of bytes we read from a file at one time. */ /* The maximum number of bytes we read into a buffer at one time. */
#define MAX_BUF_SIZE 128 #define MAX_BUF_SIZE 128
#endif /* !NANO_H */ #endif /* !NANO_H */
...@@ -1791,8 +1791,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool ...@@ -1791,8 +1791,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
/* The string we return. */ /* The string we return. */
size_t index; size_t index;
/* Current position in converted. */ /* Current position in converted. */
char *buf_mb;
char *buf_mb = charalloc(mb_cur_max());
int buf_mb_len; int buf_mb_len;
/* If dollars is TRUE, make room for the "$" at the end of the /* If dollars is TRUE, make room for the "$" at the end of the
...@@ -1803,6 +1802,8 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool ...@@ -1803,6 +1802,8 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
if (len == 0) if (len == 0)
return mallocstrcpy(NULL, ""); return mallocstrcpy(NULL, "");
buf_mb = charalloc(mb_cur_max());
start_index = actual_x(buf, start_col); start_index = actual_x(buf, start_col);
column = strnlenpt(buf, start_index); column = strnlenpt(buf, start_index);
......
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