bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] [PATCH] Improve alignment in some structures to save memo


From: Дилян Палаузов
Subject: [Bug-readline] [PATCH] Improve alignment in some structures to save memory space
Date: Mon, 20 Jul 2015 21:12:10 +0000

Reorder some fields, so that the compiler does not insert padding bits, in
order to align the data.  In turn, less memory is needed to store the
structures.

The reordering is based on running the compiler with -Wpadded on 64bit system.
---
 display.c   | 2 +-
 readline.h  | 4 ++--
 rlprivate.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/display.c b/display.c
index 2c2f8ca..31e5af1 100644
--- a/display.c
+++ b/display.c
@@ -83,8 +83,8 @@ struct line_state
     int *lbreaks;
     int lbsize;
 #if defined (HANDLE_MULTIBYTE)
-    int *wrapped_line;
     int wbsize;
+    int *wrapped_line;
 #endif
   };
 
diff --git a/readline.h b/readline.h
index cac13d7..5078f27 100644
--- a/readline.h
+++ b/readline.h
@@ -883,8 +883,8 @@ struct readline_state {
   int point;
   int end;
   int mark;
-  char *buffer;
   int buflen;
+  char *buffer;
   UNDO_LIST *ul;
   char *prompt;
 
@@ -899,9 +899,9 @@ struct readline_state {
   int edmode;
   char *kseq;
   int kseqlen;
+  int pendingin;
   FILE *inf;
   FILE *outf;
-  int pendingin;
   char *macro;
 
   /* signal state */
diff --git a/rlprivate.h b/rlprivate.h
index 96525e7..17df498 100644
--- a/rlprivate.h
+++ b/rlprivate.h
@@ -125,10 +125,10 @@ typedef struct __rl_keyseq_context
   int flags;
   int subseq_arg;
   int subseq_retval;           /* XXX */
+  int okey;
   Keymap dmap;
 
   Keymap oldmap;
-  int okey;
   struct __rl_keyseq_context *ocxt;
   int childval;
 } _rl_keyseq_cxt;
-- 
2.4.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]