summaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
authorDenys Vlasenko2010-09-01 12:01:17 +0200
committerDenys Vlasenko2010-09-01 12:01:17 +0200
commit0004e994934374b5695e004bbcb7b1fd67a170f2 (patch)
tree6cbf7c0042fbd265b34f28111726b0f04c536818 /include/libbb.h
parent9dc04124d5a3f0c9be249287817a964691e187b0 (diff)
downloadbusybox-0004e994934374b5695e004bbcb7b1fd67a170f2.zip
busybox-0004e994934374b5695e004bbcb7b1fd67a170f2.tar.gz
better shared strings trick
text data bss dec hex filename 861980 441 7540 869961 d4649 busybox_old 861914 441 7540 869895 d4607 busybox_unstripped Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'include/libbb.h')
-rw-r--r--include/libbb.h35
1 files changed, 25 insertions, 10 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 6fb0438..4b69c85 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1573,12 +1573,22 @@ void bb_progress_update(bb_progress_t *p, const char *curfile,
off_t totalsize) FAST_FUNC;
extern const char *applet_name;
+
+/* Some older linkers don't perform string merging, we used to have common strings
+ * as global arrays to do it by hand. But:
+ * (1) newer linkers do it themselves,
+ * (2) however, they DONT merge string constants with global arrays,
+ * even if the value is the same (!). Thus global arrays actually
+ * increased size a bit: for example, "/etc/passwd" string from libc
+ * wasn't merged with bb_path_passwd_file[] array!
+ * Therefore now we use #defines.
+ */
/* "BusyBox vN.N.N (timestamp or extra_version)" */
extern const char bb_banner[];
extern const char bb_msg_memory_exhausted[];
extern const char bb_msg_invalid_date[];
-extern const char bb_msg_read_error[];
-extern const char bb_msg_write_error[];
+#define bb_msg_read_error "read error"
+#define bb_msg_write_error "write error"
extern const char bb_msg_unknown[];
extern const char bb_msg_can_not_create_raw_socket[];
extern const char bb_msg_perm_denied_are_you_root[];
@@ -1588,18 +1598,23 @@ extern const char bb_msg_invalid_arg[];
extern const char bb_msg_standard_input[];
extern const char bb_msg_standard_output[];
-extern const char bb_str_default[];
/* NB: (bb_hexdigits_upcase[i] | 0x20) -> lowercase hex digit */
extern const char bb_hexdigits_upcase[];
-extern const char bb_path_mtab_file[];
-extern const char bb_path_passwd_file[];
-extern const char bb_path_shadow_file[];
-extern const char bb_path_gshadow_file[];
-extern const char bb_path_group_file[];
-extern const char bb_path_motd_file[];
extern const char bb_path_wtmp_file[];
-extern const char bb_dev_null[];
+
+/* Busybox mount uses either /proc/mounts or /etc/mtab to
+ * get the list of currently mounted filesystems */
+#define bb_path_mtab_file IF_FEATURE_MTAB_SUPPORT("/etc/mtab")IF_NOT_FEATURE_MTAB_SUPPORT("/proc/mounts")
+
+#define bb_path_passwd_file "/etc/passwd"
+#define bb_path_shadow_file "/etc/shadow"
+#define bb_path_gshadow_file "/etc/gshadow"
+#define bb_path_group_file "/etc/group"
+
+#define bb_path_motd_file "/etc/motd"
+
+#define bb_dev_null "/dev/null"
extern const char bb_busybox_exec_path[];
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here */