aboutsummaryrefslogtreecommitdiff
path: root/libbb/compare_string_array.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2021-02-051-4/+10
|\
| * libbb: code shrink and speed up index_in_strings()Ron Yorston2021-02-021-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite index_in_strings() to replace calls to strcmp()/strlen(). With this change searching for valid names in the applet_names array (for example) is 40% faster. The code has to assume the strings aren't sorted, so will always scan the entire array when presented with an invalid name. function old new delta index_in_strings 63 56 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-7) Total: -7 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-07-091-2/+5
|\|
| * compare_string_array: code shrinkMartin Lewis2020-06-291-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code shrink and prevention of possible out of bounds access. function old new delta nth_string 36 26 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10) Total: -10 bytes text data bss dec hex filename 981342 16915 1872 1000129 f42c1 busybox_old 981332 16915 1872 1000119 f42b7 busybox_unstripped Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: add a case-insensitive version of is_suffixed_with()Ron Yorston2018-12-091-0/+28
| |
* | lineedit: improvements to tab completionRon Yorston2018-12-081-0/+13
|/ | | | | | | | | | Since getpwent isn't implemented for WIN32 there's no point in enabling FEATURE_USERNAME_COMPLETION. Use case-insensitive comparisons when matching filenames. The code to exclude non-executables when tab completing executables is WIN32-specific and shouldn't omit directories.
* whitespace and comment format fixes, no code changesDenys Vlasenko2017-10-051-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: another unit test for is_suffixed_withTito Ragusa2015-09-151-0/+1
| | | | | | | Suggested by Bartosz Golaszewski. Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make is_suffixed_with() return pointer inside string, not key.Denys Vlasenko2015-08-251-2/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: add is_suffixed_with() functionBartosz Golaszewski2015-08-251-0/+33
| | | | | Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: add a comment describing the way is_prefixed_with() worksBartosz Golaszewski2015-08-251-0/+5
| | | | | Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: add unit tests for is_prefixed_with()Bartosz Golaszewski2015-08-251-0/+19
| | | | | | | Test corner cases too like looking for an empty prefix etc. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: introduce and use is_prefixed_with()Denys Vlasenko2015-03-121-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta is_prefixed_with - 18 +18 complete_username 78 77 -1 man_main 737 735 -2 fsck_device 429 427 -2 unpack_ar_archive 80 76 -4 strip_unsafe_prefix 105 101 -4 singlemount 1054 1050 -4 rtc_adjtime_is_utc 90 86 -4 resolve_mount_spec 88 84 -4 parse_one_line 1029 1025 -4 parse_conf 1460 1456 -4 may_wakeup 83 79 -4 loadkmap_main 219 215 -4 get_irqs_from_stat 103 99 -4 get_header_cpio 913 909 -4 findfs_main 79 75 -4 fbsplash_main 1230 1226 -4 load_crontab 776 771 -5 expand_vars_to_list 1151 1146 -5 date_main 881 876 -5 skip_dev_pfx 30 24 -6 make_device 2199 2193 -6 complete_cmd_dir_file 773 767 -6 run_applet_and_exit 715 708 -7 uudecode_main 321 313 -8 pwdx_main 197 189 -8 execute 568 560 -8 i2cdetect_main 1186 1176 -10 procps_scan 1242 1230 -12 procps_read_smaps 1017 1005 -12 process_module 746 734 -12 patch_main 1903 1891 -12 nfsmount 3572 3560 -12 stack_machine 126 112 -14 process_timer_stats 449 435 -14 match_fstype 111 97 -14 do_ipaddr 1344 1330 -14 open_list_and_close 359 343 -16 get_header_tar 1795 1779 -16 prepend_new_eth_table 340 323 -17 fsck_main 1811 1794 -17 find_iface_state 56 38 -18 dnsd_main 1321 1303 -18 base_device 179 158 -21 find_keyword 104 82 -22 handle_incoming_and_exit 2785 2762 -23 parse_and_put_prompt 774 746 -28 modinfo 347 317 -30 find_action 204 171 -33 update_passwd 1470 1436 -34 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540) Total: -522 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make index_in_substrings return -1 on ambiguous matchesDenys Vlasenko2010-04-031-3/+20
| | | | | | | function old new delta index_in_substrings 67 93 +26 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko2008-06-271-5/+5
| | | | | | | text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
* libiproute: fix option parsing, so that "ip -o link" works again.Denis Vlasenko2008-05-311-2/+2
| | | | | closes bug 3524
* ps: fix build breakage from vda's recent commitDenis Vlasenko2008-01-071-5/+5
| | | | | *: whitespace fixes
* ifconfig: code shrinkDenis Vlasenko2007-11-041-0/+9
| | | | | | | | | | | adjtimex: code shrink libbb: move nth_string function into libbb hdparm: nth_string was here text data bss dec hex filename 730013 10334 12032 752379 b7afb busybox_old 730093 10134 12032 752259 b7a83 busybox_unstripped
* trylink: produce even more info about final link stageDenis Vlasenko2007-08-121-2/+2
| | | | | | | | | 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
* Replace index_in_[sub]str_array with index_in_[sub]strings,Denis Vlasenko2007-07-241-0/+33
| | | | | | | | | which scans thru "abc\0def\0123\0\0" type strings. Saves 250 bytes. text data bss dec hex filename 781266 1328 11844 794438 c1f46 busybox_old 781010 1328 11844 794182 c1e46 busybox_unstripped
* - fix bug where we did not reject invalid classes like '[[:alpha'Bernhard Reutner-Fischer2007-03-301-6/+5
| | | | | | | - debloat while at it: text data bss dec hex filename 1554 0 19 1573 625 tr.o.oorig 1357 0 16 1373 55d tr.o
* rename: compare_string_array -> index_in_str_arrayDenis Vlasenko2006-11-051-4/+20
| | | | | introduce index_in_substr_array and use it in iproute2
* Standardize on the vi editing directives being on the first line."Robert P. J. Day"2006-07-021-1/+1
|
* - move buffer allocation schemes to libbb.hBernhard Reutner-Fischer2006-04-031-13/+3
| | | | - include the correct headers: applets need busybox.h while lib* need libbb.h
* More extern removal from Robert P. Day.Rob Landley2006-03-291-2/+1
|
* just whitespaceTim Riker2006-01-251-1/+1
|
* change the interface of libbb/compare_string_array (unsigned short to int), ↵"Vladimir N. Oleynik"2005-11-261-4/+4
| | | | usaging for e2fsprogs/fsck
* more use const for interface of libbb/compare_string_array, example usage ↵"Vladimir N. Oleynik"2005-11-261-1/+2
| | | | for e2fsprogs/fsck
* Major coreutils update.Manuel Novoa III2003-03-191-1/+2
|
* Move compare_string_array to libbbGlenn L McGrath2002-12-021-0/+30