From 99daecdac917d149f4643e090cb705df135e2ed1 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 2 Mar 2018 13:18:18 +0000 Subject: Minor improvements to build Exclude source files in libbb that aren't used by busybox-w32. This speeds up the build marginally. They can always be reinstated if necessary. Provide fake routines for everything in inode_hash.c so that it can be excluded. inode_hash.c is now unchanged from upstream. Use last_char_is in has_exe_suffix_or_dot. It doesn't save any bytes but it makes the code neater. --- include/libbb.h | 8 ++++++-- include/mingw.h | 1 - libbb/Kbuild.src | 31 +++++++++++++++---------------- libbb/inode_hash.c | 2 -- win32/mingw.c | 3 +-- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index f8e54de54..e816a2726 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1662,11 +1662,15 @@ int bb_xioctl(int fd, unsigned request, void *argp) FAST_FUNC; #define xioctl(fd,request,argp) bb_xioctl(fd,request,argp) #endif -char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC; #if !ENABLE_PLATFORM_MINGW32 +char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC; void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST_FUNC; -#endif void reset_ino_dev_hashtable(void) FAST_FUNC; +#else +#define add_to_ino_dev_hashtable(s, n) (void)0 +#define is_in_ino_dev_hashtable(s) NULL +#define reset_ino_dev_hashtable() +#endif #ifdef __GLIBC__ /* At least glibc has horrendously large inline for this, so wrap it */ unsigned long long bb_makedev(unsigned major, unsigned minor) FAST_FUNC; diff --git a/include/mingw.h b/include/mingw.h index 1bb2032cd..09903d582 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -435,7 +435,6 @@ const char * next_path_sep(const char *path); #define is_absolute_path(path) ((path)[0] == '/' || (path)[0] == '\\' || has_dos_drive_prefix(path)) #define find_mount_point(n, s) find_mount_point(n) -#define add_to_ino_dev_hashtable(s, n) (void)0 /* * helpers diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index 4b838ab7a..9323a8968 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src @@ -13,12 +13,10 @@ INSERT lib-y += appletlib.o lib-y += ask_confirmation.o lib-y += bb_bswap_64.o -lib-y += bb_do_delay.o lib-y += bb_pwd.o lib-y += bb_qsort.o #lib-y += bb_strtod.o lib-y += bb_strtonum.o -lib-y += change_identity.o lib-y += chomp.o lib-y += compare_string_array.o lib-y += concat_path_file.o @@ -27,23 +25,18 @@ lib-y += copy_file.o lib-y += copyfd.o lib-y += crc32.o lib-y += default_error_retval.o -lib-y += device_open.o lib-y += dump.o lib-y += executable.o lib-y += fclose_nonstdin.o lib-y += fflush_stdout_and_exit.o lib-y += fgets_str.o lib-y += find_pid_by_name.o -lib-y += find_root_device.o lib-y += full_write.o lib-y += get_last_path_component.o lib-y += get_line_from_file.o lib-y += getopt32.o -lib-y += get_volsize.o lib-y += herror_msg.o lib-y += human_readable.o -lib-y += inet_common.o -lib-y += inode_hash.o lib-y += isdirectory.o lib-y += last_char_is.o lib-y += lineedit.o lineedit_ptr_hack.o @@ -56,16 +49,12 @@ lib-y += messages.o lib-y += mode_string.o lib-y += parse_mode.o lib-y += perror_msg.o -lib-y += perror_nomsg.o lib-y += perror_nomsg_and_die.o -lib-y += pidfile.o lib-y += platform.o lib-y += printable.o lib-y += printable_string.o -lib-y += print_flags.o lib-y += process_escape_sequence.o lib-y += procps.o -lib-y += progress.o lib-y += ptr_to_globals.o lib-y += read.o lib-y += read_printf.o @@ -78,12 +67,9 @@ lib-y += safe_strncpy.o lib-y += safe_write.o lib-y += securetty.o lib-y += setup_environment.o -lib-y += simplify_path.o lib-y += single_argv.o lib-y += skip_whitespace.o -lib-y += speed_table.o lib-y += str_tolower.o -lib-y += strrstr.o lib-y += sysconf.o lib-y += time.o lib-y += trim.o @@ -91,10 +77,8 @@ lib-y += u_signal_names.o lib-y += uuencode.o lib-y += verror_msg.o lib-y += vfork_daemon_rexec.o -lib-y += warn_ignoring_args.o lib-y += wfopen.o lib-y += wfopen_input.o -lib-y += write.o lib-y += xatonum.o lib-y += xconnect.o lib-y += xfuncs.o @@ -105,15 +89,30 @@ lib-y += xreadlink.o lib-y += xrealloc_vector.o lib-$(CONFIG_PLATFORM_POSIX) += bb_askpass.o +lib-$(CONFIG_PLATFORM_POSIX) += bb_do_delay.o +lib-$(CONFIG_PLATFORM_POSIX) += change_identity.o +lib-$(CONFIG_PLATFORM_POSIX) += device_open.o +lib-$(CONFIG_PLATFORM_POSIX) += find_root_device.o lib-$(CONFIG_PLATFORM_POSIX) += get_console.o lib-$(CONFIG_PLATFORM_POSIX) += getpty.o +lib-$(CONFIG_PLATFORM_POSIX) += get_volsize.o lib-$(CONFIG_PLATFORM_POSIX) += inet_common.o +lib-$(CONFIG_PLATFORM_POSIX) += inode_hash.o lib-$(CONFIG_PLATFORM_POSIX) += kernel_version.o lib-$(CONFIG_PLATFORM_POSIX) += login.o lib-$(CONFIG_PLATFORM_POSIX) += makedev.o +lib-$(CONFIG_PLATFORM_POSIX) += perror_nomsg.o +lib-$(CONFIG_PLATFORM_POSIX) += pidfile.o +lib-$(CONFIG_PLATFORM_POSIX) += print_flags.o +lib-$(CONFIG_PLATFORM_POSIX) += progress.o lib-$(CONFIG_PLATFORM_POSIX) += read_key.o lib-$(CONFIG_PLATFORM_POSIX) += signals.o +lib-$(CONFIG_PLATFORM_POSIX) += simplify_path.o +lib-$(CONFIG_PLATFORM_POSIX) += speed_table.o +lib-$(CONFIG_PLATFORM_POSIX) += strrstr.o lib-$(CONFIG_PLATFORM_POSIX) += udp_io.o +lib-$(CONFIG_PLATFORM_POSIX) += warn_ignoring_args.o +lib-$(CONFIG_PLATFORM_POSIX) += write.o lib-$(CONFIG_PLATFORM_POSIX) += xgethostbyname.o lib-$(CONFIG_PLATFORM_LINUX) += match_fstype.o diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c index 770d1a286..4142813e3 100644 --- a/libbb/inode_hash.c +++ b/libbb/inode_hash.c @@ -55,7 +55,6 @@ char* FAST_FUNC is_in_ino_dev_hashtable(const struct stat *statbuf) return NULL; } -#if !ENABLE_PLATFORM_MINGW32 /* Add statbuf to statbuf hash table */ void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) { @@ -77,7 +76,6 @@ void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char * bucket->next = ino_dev_hashtable[i]; ino_dev_hashtable[i] = bucket; } -#endif #if ENABLE_DU || ENABLE_FEATURE_CLEAN_UP /* Clear statbuf hash table */ diff --git a/win32/mingw.c b/win32/mingw.c index a58cb7b01..bedf14784 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -1090,8 +1090,7 @@ int has_exe_suffix(const char *name) int has_exe_suffix_or_dot(const char *name) { - int len = strlen(name); - return (len > 0 && name[len-1] == '.') || has_win_suffix(name, 0); + return last_char_is(name, '.') || has_win_suffix(name, 0); } /* check if path can be made into an executable by adding a suffix; -- cgit v1.2.3-55-g6feb