aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-22 00:08:27 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-22 00:08:27 +0000
commit5d89fbaa2e00a8a26e530306d76b78bf91d12ec8 (patch)
tree44d54f6dfbd0f6270fb0b1aba0195bc53db8bef4 /libbb/lineedit.c
parent9137341851f3ab89f5c6a54a6baff68f0f4a5e17 (diff)
downloadbusybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.gz
busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.bz2
busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.zip
*: remove remaining instances of ".data" hack
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 4ba61c143..6de66ba83 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -74,7 +74,7 @@ static const char null_str[] ALIGN1 = "";
74#endif 74#endif
75 75
76/* We try to minimize both static and stack usage. */ 76/* We try to minimize both static and stack usage. */
77struct statics { 77struct lineedit_statics {
78 line_input_t *state; 78 line_input_t *state;
79 79
80 volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */ 80 volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */
@@ -120,11 +120,10 @@ struct statics {
120#endif 120#endif
121}; 121};
122 122
123/* Make it reside in writable memory, yet make compiler understand 123/* See lineedit_ptr_hack.c */
124 * that it is not going to change. */ 124extern struct lineedit_statics *const lineedit_ptr_to_statics;
125static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
126 125
127#define S (*ptr_to_statics) 126#define S (*lineedit_ptr_to_statics)
128#define state (S.state ) 127#define state (S.state )
129#define cmdedit_termw (S.cmdedit_termw ) 128#define cmdedit_termw (S.cmdedit_termw )
130#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler) 129#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler)
@@ -145,7 +144,7 @@ static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
145#define delbuf (S.delbuf ) 144#define delbuf (S.delbuf )
146 145
147#define INIT_S() do { \ 146#define INIT_S() do { \
148 (*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \ 147 (*(struct lineedit_statics**)&lineedit_ptr_to_statics) = xzalloc(sizeof(S)); \
149 barrier(); \ 148 barrier(); \
150 cmdedit_termw = 80; \ 149 cmdedit_termw = 80; \
151 USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \ 150 USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \
@@ -163,7 +162,7 @@ static void deinit_S(void)
163 if (home_pwd_buf != null_str) 162 if (home_pwd_buf != null_str)
164 free(home_pwd_buf); 163 free(home_pwd_buf);
165#endif 164#endif
166 free(ptr_to_statics); 165 free(lineedit_ptr_to_statics);
167} 166}
168#define DEINIT_S() deinit_S() 167#define DEINIT_S() deinit_S()
169 168