aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-22 14:32:16 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-22 14:32:16 -0800
commitfa00fe882f719351fdf7a4c4100baf4f3eab4d61 (patch)
tree8ea97ceb12328399fbb48bc8769f050376c4703a
parent25f0141df133f3522c6d23ddd96ae341813b9638 (diff)
downloaduemacs-master.tar.gz
Stop using 'short' for line and allocation sizesHEADmaster
Yes, yes, it probably made sense 30 years ago as a way to save a tiny amount of memory, but especially when interspersed in structures that have pointers (aligned to 64 bits these days), it's not even saving memory today. And it makes us fail in nasty ways when looking at files with long lines. So just make them 'int'. And if you have a line that is longer than 2GB, you only have yourself to blame. I no longer care. In case anybody care, the "test-case" for this was a lovely UDDF file with a binary divecomputer dump encoded as an XML element. Resulting in a lovely 41kB single line. Not what poor micro-emacs was designed for, I'm afraid. I really should just learn another editor, rather than continue to polish this turd. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--estruct.h12
-rw-r--r--line.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/estruct.h b/estruct.h
index 1a7a683..3c382ce 100644
--- a/estruct.h
+++ b/estruct.h
@@ -412,9 +412,9 @@ struct window {
struct buffer *w_bufp; /* Buffer displayed in window */
struct line *w_linep; /* Top line in the window */
struct line *w_dotp; /* Line containing "." */
- short w_doto; /* Byte offset for "." */
struct line *w_markp; /* Line containing "mark" */
- short w_marko; /* Byte offset for "mark" */
+ int w_doto; /* Byte offset for "." */
+ int w_marko; /* Byte offset for "mark" */
char w_toprow; /* Origin 0 top row of window */
char w_ntrows; /* # of rows of text in window */
char w_force; /* If NZ, forcing row. */
@@ -452,14 +452,14 @@ struct window {
struct buffer {
struct buffer *b_bufp; /* Link to next struct buffer */
struct line *b_dotp; /* Link to "." struct line structure */
- short b_doto; /* Offset of "." in above struct line */
struct line *b_markp; /* The same as the above two, */
- short b_marko; /* but for the "mark" */
struct line *b_linep; /* Link to the header struct line */
+ int b_doto; /* Offset of "." in above struct line */
+ int b_marko; /* but for the "mark" */
+ int b_mode; /* editor mode of this buffer */
char b_active; /* window activated flag */
char b_nwnd; /* Count of windows on buffer */
char b_flag; /* Flags */
- int b_mode; /* editor mode of this buffer */
char b_fname[NFILEN]; /* File name */
char b_bname[NBUFN]; /* Buffer name */
#if CRYPT
@@ -490,7 +490,7 @@ struct buffer {
*/
struct region {
struct line *r_linep; /* Origin struct line address. */
- short r_offset; /* Origin struct line offset. */
+ int r_offset; /* Origin struct line offset. */
long r_size; /* Length in characters. */
};
diff --git a/line.h b/line.h
index 9eaad61..7b07a3b 100644
--- a/line.h
+++ b/line.h
@@ -14,8 +14,8 @@
struct line {
struct line *l_fp; /* Link to the next line */
struct line *l_bp; /* Link to the previous line */
- short l_size; /* Allocated size */
- short l_used; /* Used size */
+ int l_size; /* Allocated size */
+ int l_used; /* Used size */
char l_text[1]; /* A bunch of characters. */
};