Commit Graph

120 Commits

Author SHA1 Message Date
Denis Vlasenko
f882f08627 vi: speed up some string ops 2007-12-23 02:36:51 +00:00
Denis Vlasenko
4baed3a080 vi: reduce amount of memset'ing on each screen refresh 2007-12-22 17:31:29 +00:00
Denis Vlasenko
e3cbfb91d2 vi: introduce FEATURE_VI_8BIT (as vi currently is not Unicode capable,
people may want to disable display of high-bit chars)
ip: build fixlet
2007-12-22 17:00:11 +00:00
Denis Vlasenko
88adfcd178 vi: change MAX_LINELEN meaning: now it is the biggest supported
screen wigth. Introduce MAX_TABSTOP and MAX_INPUT_LEN. Fix redraw
of very long lines and cursor movement past NULs.
2007-12-22 15:40:13 +00:00
Denis Vlasenko
26b6fba9d3 vi: fix a problem with displaying overlong lines 2007-12-21 21:34:37 +00:00
Denis Vlasenko
a96425fe82 vi: don't use common_bufsiz as read buffer, it can be too small
(found by Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>)
2007-12-09 04:13:43 +00:00
Denis Vlasenko
4f95e5aab8 vi: don't wait 50 ms before reading ESC sequences
inetd,syslogd: use safe_read instead of open-coded EINTR handling
syslogd: bail out if you see null read from Unix socket
(should never happen, but if it does, spinning forever
and eating 100% CPU is not a good idea)
2007-10-11 10:10:15 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Bernhard Reutner-Fischer
d24d5c84c2 - ditch 2 bytes 2007-10-01 18:04:42 +00:00
Denis Vlasenko
4daad9004d introduce bb_putchar(). saves ~1800 on uclibc (less on glibc). 2007-09-27 10:20:47 +00:00
Denis Vlasenko
5d61e71c3a introduce safe_poll (fixes a problem in top)
function                                             old     new   delta
safe_poll                                              -      77     +77
svlogd_main                                         1470    1466      -4
zcip_main                                           1530    1524      -6
forkexec                                            1345    1338      -7
decode_format_string                                 795     788      -7
collect_blk                                          474     467      -7
buffer_pread                                         540     532      -8
tftp                                                1182    1172     -10
microcom_main                                        763     749     -14
arpping                                              441     424     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/9 up/down: 77/-80)             Total: -3 bytes
   text    data     bss     dec     hex filename
 770162    1034   10404  781600   bed20 busybox_old
 770158    1034   10404  781596   bed1c busybox_unstripped
2007-09-27 10:09:59 +00:00
Bernhard Reutner-Fischer
73f56bb76d - actually mv microcom.c to miscutils 2007-09-22 21:18:46 +00:00
Denis Vlasenko
87f3b26b3a *: replace select-for-one descriptor with poll, it's smaller.
$ ./.cmk bloatcheck
function                                             old     new   delta
readit                                               406     364     -42
syslogd_main                                        1249    1206     -43
traceroute_main                                     4115    4060     -55
mysleep                                              112      45     -67
arpping                                              579     441    -138
tftp                                                1575    1182    -393
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-738)           Total: -738 bytes
   text    data     bss     dec     hex filename
 770580    1051   10764  782395   bf03b busybox_old
 769820    1051   10764  781635   bed43 busybox_unstripped
2007-09-07 13:43:28 +00:00
Denis Vlasenko
856be770a6 assorted fixes for breakage found by randomconfig 2007-08-17 08:29:48 +00:00
Denis Vlasenko
6a2f7f41cf whitespace fixes, no code changes 2007-08-16 10:35:17 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Denis Vlasenko
b71c668c57 style fix (stray space before ';') 2007-07-21 15:08:09 +00:00
Denis Vlasenko
2f6ae43b9c stray trailing tabs removed 2007-07-19 22:50:47 +00:00
Denis Vlasenko
2414a96faa vi: comment out dead code 2007-07-18 22:03:40 +00:00
Denis Vlasenko
91afdf8096 vi: style fixlet 2007-07-17 23:22:49 +00:00
Denis Vlasenko
a3d15c8be7 fix typo in prev commit :( 2007-07-17 23:19:28 +00:00
Denis Vlasenko
27da707d06 vi: s/argv[0]/applet_name/ 2007-07-17 23:18:26 +00:00
Denis Vlasenko
eaabf0675f vi: multiple fixes by Natanael Copa <natanael.copa@gmail.com>
* the puzzling message on error is replaced with strerror(errno)
  so it should be even more detailed and smaller at the same time.
* merged code in edit_file() and code for ':edit <file>' in colon() into
  new func init_text_buffer(). Was horribly duplicate. Moved most of
  error/sanity checking to file_insert(). Result is that you get a proper
  validation (prevent reading /dev/*) and error messages for ':r <file>' 
* renamed 'cfn' to 'current_filename' for improved readability
* merged smallint vi_readonly and readonly into bitfields into
  readonly_mode to save space.
* added text_size variable to keep track how big the text buffer is.
  This is used to fix a buffer overflow. To reproduce bug:
  ./busybox vi TODO
  :r Makefile
  vi segfaults due to no buffer checking is done at all. som redesign is
  needed here but i added a check in text_hole_make() to aviod the
  segfault at least.
* removed isblnk() and use isblank(3) instead.
* fixed compiler warning by displaying the return code for :!<command>
  This makes things bigger than needed but since the patch reduces the
  overall size... (see below)
* new func next_tabstop(int) merges some duplicate code. There are more
  cuplicode here but i couldnt find a good way to merge them.
* Fix *ANNOYING* placement of cursor on '\t' characters. To reproduce:
    echo -e "\thello" > file1
    ./busybox vi file1
  Try to insert some text at the beginning of line. Text will be inserted
  but cursor is blinking somewhere else. The patch should make busybox vi
  behave more like original vi(m). Costs a few bytes but its worth it
  imho.
* new_text() is moved into init_text_buffer()
* the previously added update_ro_status() was moved info file_insert due
  to duplication removal mentioned above.
function                                             old     new   delta
init_text_buffer                                       -     245    +245
file_insert                                          312     420    +108
next_tabstop                                           -      82     +82
text_hole_make                                       154     171     +17
do_cmd                                              5093    5100      +7
static.cmd_mode_indicator                              -       5      +5
refresh                                             1248    1253      +5
current_filename                                       -       4      +4
yank_delete                                          161     164      +3
what_reg                                              96      99      +3
end_cmd_q                                             78      81      +3
char_insert                                          440     442      +2
readonly_mode                                          -       1      +1
vi_readonly                                            1       -      -1
setops                                               154     153      -1
readonly                                               1       -      -1
vi_setops                                              4       1      -3
string_insert                                        161     158      -3
cfn                                                    4       -      -4
show_status_line                                     532     514     -18
readit                                               519     500     -19
move_to_col                                          161     138     -23
vi_main                                              495     433     -62
isblnk                                                75       -     -75
.rodata                                             4751    4655     -96
edit_file                                            892     787    -105
new_text                                             125       -    -125
update_ro_status                                     131       -    -131
colon                                               3848    3667    -181
------------------------------------------------------------------------------
(add/remove: 5/6 grow/shrink: 8/10 up/down: 485/-848)        Total: -363
bytes
   text    data     bss     dec     hex filename
  34751     873    4260   39884    9bcc busybox_old
  34439     877    4260   39576    9a98 busybox_unstripped
2007-07-17 23:14:07 +00:00
Denis Vlasenko
49a128a156 remove accumulated stray trailing whitespace 2007-07-17 21:42:59 +00:00
Denis Vlasenko
59a1f30450 vi: make status line less confusing when we open non-readable files,
require rood to use w! when saving non-writable files.
Patch by Natanael Copa <natanael.copa@gmail.com>

update_ro_status                                       -      73     +73
edit_file                                            819     822      +3
colon                                               3440    3425     -15
.rodata                                           128090  128058     -32
file_insert                                          288     235     -53
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 76/-100)           Total: -24 bytes
   text    data     bss     dec     hex filename
 673344    2740   13968  690052   a8784 busybox_old
 673320    2740   13968  690028   a876c busybox_unstripped
2007-07-14 22:43:10 +00:00
Denis Vlasenko
80b8b39899 Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>) 2007-06-25 10:55:35 +00:00
Denis Vlasenko
e8a0788b24 moved biggest stack buffers to malloc space, or made their size configurable
(8k of shell line edit buffer is an overkill)

# make ARCH=i386 bloatcheck
function                                             old     new   delta
read_line_input                                     3933    3967     +34
ifaddrlist                                           348     345      -3
do_loadfont                                          208     191     -17
edit_file                                            840     819     -21
.rodata                                           129112  129080     -32
uncompress                                          1305    1268     -37
loadfont_main                                        566     495     -71
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 34/-181)          Total: -147 bytes
2007-06-10 15:08:44 +00:00
Denis Vlasenko
0b3b41b62a vi: move some data to malloc'ed space: ~500 less bss, code
size is smaller too (subject to arch differenced I guess)
2007-05-30 02:01:40 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
cd5c7866e3 vi: remove two globals
awk: some 'lineno' vars were shorts, made them ints (code got smaller)
awk: rename global t to global ttt. still an awful name, but at least
     you can grep for it now.

function                                             old     new   delta
ttt                                                    -      28     +28
mysleep                                              104     120     +16
readit                                               408     418     +10
lineno                                                 2       4      +2
parse_program                                        338     339      +1
evaluate                                            6446    6445      -1
syntax_error                                          25      23      -2
next_token                                           917     915      -2
new_node                                              26      24      -2
tv                                                    16       8      -8
skip_spaces                                           68      53     -15
t                                                     28       -     -28
rfds                                                 128       -    -128
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 4/6 up/down: 57/-186)          Total: -129 bytes
2007-05-17 16:37:22 +00:00
Denis Vlasenko
51742f4bb0 style fixes. No code changes 2007-04-12 00:32:05 +00:00
Denis Vlasenko
ba2fb719b9 Copyright, help text, whitespace cleanups 2007-04-01 09:39:03 +00:00
Denis Vlasenko
219d14d514 random style fixes (extra spaces deleted) 2007-03-24 15:40:16 +00:00
Denis Vlasenko
58875aefe4 assorted fixes uncovered by randomconfig runs 2007-03-22 22:22:10 +00:00
Denis Vlasenko
2a51af2579 vi: fix signed char-induced potential bugs 2007-03-21 22:31:24 +00:00
Denis Vlasenko
afa37cf508 vi: remove Byte typedef and massive amount of casts.
also optimize many strlen() calls.
if (strlen(buf) <= 0) goto vc1 - ??!!
2007-03-21 00:05:35 +00:00
Denis Vlasenko
f9234135f8 vi: support $EXINIT and -c 2007-03-21 00:03:42 +00:00
Denis Vlasenko
baca175912 kill superfluous returns at the end of void functions 2007-03-11 13:43:10 +00:00
Denis Vlasenko
8e858e2700 clean up accumulated whitespace damage 2007-03-07 09:35:43 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
6a5dc5d75a next bunch of fixes for bugs found by randconfig 2006-12-30 18:42:29 +00:00
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
b95636c52f remove casts from xmalloc() 2006-12-19 23:36:04 +00:00
Denis Vlasenko
249fabf1a3 Add option to disable command execution from vi & awk 2006-12-19 00:29:22 +00:00
Denis Vlasenko
d9e15f2068 style cleanup: return(a) -> return a, part 2 2006-11-27 16:49:55 +00:00
Denis Vlasenko
079f8afa0a style cleanup: return(a) -> return a, part 1 2006-11-27 16:49:31 +00:00
Denis Vlasenko
621204bbf6 get_terminal_width_height: do not pass insanely large values 2006-10-27 09:03:24 +00:00
Denis Vlasenko
e1a0d486e4 message string changes, mostly for consistency, also -32 bytes in .rodata 2006-10-20 13:28:22 +00:00
Denis Vlasenko
ea62077b85 add open_read_close() and similar stuff 2006-10-14 02:23:43 +00:00
Denis Vlasenko
9275814a9e lots of silly indent fixes 2006-10-03 19:56:34 +00:00