aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-09-06 12:53:14 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-09-06 12:53:14 +0200
commita407cf74cc43c3cc26168e259cee469a4787a76c (patch)
tree2306029e1ea7b957825b55e3728d23c886da58dd /libbb
parentd6ae4fb446daedfe3073d67be655942e9fa7eb18 (diff)
downloadbusybox-w32-a407cf74cc43c3cc26168e259cee469a4787a76c.tar.gz
busybox-w32-a407cf74cc43c3cc26168e259cee469a4787a76c.tar.bz2
busybox-w32-a407cf74cc43c3cc26168e259cee469a4787a76c.zip
Make smart_ulltoa return pointer to end (allows for code shink in callers)
function old new delta smart_ulltoa5 405 408 +3 smart_ulltoa4 273 276 +3 list_table 1113 1114 +1 scale 36 34 -2 put_lu 55 53 -2 ulltoa6_and_space 19 14 -5 powertop_main 1470 1461 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/human_readable.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libbb/human_readable.c b/libbb/human_readable.c
index 8b22b0cb5..0b2eb777e 100644
--- a/libbb/human_readable.c
+++ b/libbb/human_readable.c
@@ -94,7 +94,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val,
94 94
95/* Convert unsigned long long value into compact 5-char representation. 95/* Convert unsigned long long value into compact 5-char representation.
96 * String is not terminated (buf[5] is untouched) */ 96 * String is not terminated (buf[5] is untouched) */
97void FAST_FUNC smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale) 97char* FAST_FUNC smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale)
98{ 98{
99 const char *fmt; 99 const char *fmt;
100 char c; 100 char c;
@@ -145,12 +145,13 @@ void FAST_FUNC smart_ulltoa5(unsigned long long ul, char buf[5], const char *sca
145 buf[3] = "0123456789"[v]; 145 buf[3] = "0123456789"[v];
146 buf[4] = scale[idx]; /* typically scale = " kmgt..." */ 146 buf[4] = scale[idx]; /* typically scale = " kmgt..." */
147 } 147 }
148 return buf + 5;
148} 149}
149 150
150/* Convert unsigned long long value into compact 4-char 151/* Convert unsigned long long value into compact 4-char
151 * representation. Examples: "1234", "1.2k", " 27M", "123T" 152 * representation. Examples: "1234", "1.2k", " 27M", "123T"
152 * String is not terminated (buf[4] is untouched) */ 153 * String is not terminated (buf[4] is untouched) */
153void FAST_FUNC smart_ulltoa4(unsigned long long ul, char buf[4], const char *scale) 154char* FAST_FUNC smart_ulltoa4(unsigned long long ul, char buf[4], const char *scale)
154{ 155{
155 const char *fmt; 156 const char *fmt;
156 char c; 157 char c;
@@ -194,4 +195,5 @@ void FAST_FUNC smart_ulltoa4(unsigned long long ul, char buf[4], const char *sca
194 buf[2] = "0123456789"[v]; 195 buf[2] = "0123456789"[v];
195 buf[3] = scale[idx]; /* typically scale = " kmgt..." */ 196 buf[3] = scale[idx]; /* typically scale = " kmgt..." */
196 } 197 }
198 return buf + 4;
197} 199}