aboutsummaryrefslogtreecommitdiff
path: root/libbb/xfuncs.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
commitdefc1ea34074e7882724c460260d307cdf981a70 (patch)
treefca9b9a5fe243f9c0c76b84824ea2ff92ea8e589 /libbb/xfuncs.c
parent26bc57d8b26425f23f4be974cce7bf35c95c9a1a (diff)
downloadbusybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.gz
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.bz2
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.zip
*: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r--libbb/xfuncs.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index fe3c647d0..8ef305ba0 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -25,17 +25,17 @@
25#include "libbb.h" 25#include "libbb.h"
26 26
27/* Turn on nonblocking I/O on a fd */ 27/* Turn on nonblocking I/O on a fd */
28int ndelay_on(int fd) 28int FAST_FUNC ndelay_on(int fd)
29{ 29{
30 return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) | O_NONBLOCK); 30 return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) | O_NONBLOCK);
31} 31}
32 32
33int ndelay_off(int fd) 33int FAST_FUNC ndelay_off(int fd)
34{ 34{
35 return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) & ~O_NONBLOCK); 35 return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) & ~O_NONBLOCK);
36} 36}
37 37
38int close_on_exec_on(int fd) 38int FAST_FUNC close_on_exec_on(int fd)
39{ 39{
40 return fcntl(fd, F_SETFD, FD_CLOEXEC); 40 return fcntl(fd, F_SETFD, FD_CLOEXEC);
41} 41}
@@ -43,7 +43,7 @@ int close_on_exec_on(int fd)
43/* Convert unsigned long long value into compact 4-char 43/* Convert unsigned long long value into compact 4-char
44 * representation. Examples: "1234", "1.2k", " 27M", "123T" 44 * representation. Examples: "1234", "1.2k", " 27M", "123T"
45 * String is not terminated (buf[4] is untouched) */ 45 * String is not terminated (buf[4] is untouched) */
46void smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale) 46void FAST_FUNC smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale)
47{ 47{
48 const char *fmt; 48 const char *fmt;
49 char c; 49 char c;
@@ -91,7 +91,7 @@ void smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale)
91 91
92/* Convert unsigned long long value into compact 5-char representation. 92/* Convert unsigned long long value into compact 5-char representation.
93 * String is not terminated (buf[5] is untouched) */ 93 * String is not terminated (buf[5] is untouched) */
94void smart_ulltoa5(unsigned long long ul, char buf[6], const char *scale) 94void FAST_FUNC smart_ulltoa5(unsigned long long ul, char buf[6], const char *scale)
95{ 95{
96 const char *fmt; 96 const char *fmt;
97 char c; 97 char c;
@@ -149,7 +149,7 @@ void smart_ulltoa5(unsigned long long ul, char buf[6], const char *scale)
149// A truncated result contains the first few digits of the result ala strncpy. 149// A truncated result contains the first few digits of the result ala strncpy.
150// Returns a pointer past last generated digit, does _not_ store NUL. 150// Returns a pointer past last generated digit, does _not_ store NUL.
151void BUG_sizeof_unsigned_not_4(void); 151void BUG_sizeof_unsigned_not_4(void);
152char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) 152char* FAST_FUNC utoa_to_buf(unsigned n, char *buf, unsigned buflen)
153{ 153{
154 unsigned i, out, res; 154 unsigned i, out, res;
155 if (sizeof(unsigned) != 4) 155 if (sizeof(unsigned) != 4)
@@ -170,7 +170,7 @@ char *utoa_to_buf(unsigned n, char *buf, unsigned buflen)
170} 170}
171 171
172/* Convert signed integer to ascii, like utoa_to_buf() */ 172/* Convert signed integer to ascii, like utoa_to_buf() */
173char *itoa_to_buf(int n, char *buf, unsigned buflen) 173char* FAST_FUNC itoa_to_buf(int n, char *buf, unsigned buflen)
174{ 174{
175 if (buflen && n < 0) { 175 if (buflen && n < 0) {
176 n = -n; 176 n = -n;
@@ -190,7 +190,7 @@ char *itoa_to_buf(int n, char *buf, unsigned buflen)
190static char local_buf[sizeof(int) * 3]; 190static char local_buf[sizeof(int) * 3];
191 191
192// Convert unsigned integer to ascii using a static buffer (returned). 192// Convert unsigned integer to ascii using a static buffer (returned).
193char *utoa(unsigned n) 193char* FAST_FUNC utoa(unsigned n)
194{ 194{
195 *(utoa_to_buf(n, local_buf, sizeof(local_buf))) = '\0'; 195 *(utoa_to_buf(n, local_buf, sizeof(local_buf))) = '\0';
196 196
@@ -198,7 +198,7 @@ char *utoa(unsigned n)
198} 198}
199 199
200/* Convert signed integer to ascii using a static buffer (returned). */ 200/* Convert signed integer to ascii using a static buffer (returned). */
201char *itoa(int n) 201char* FAST_FUNC itoa(int n)
202{ 202{
203 *(itoa_to_buf(n, local_buf, sizeof(local_buf))) = '\0'; 203 *(itoa_to_buf(n, local_buf, sizeof(local_buf))) = '\0';
204 204
@@ -206,7 +206,7 @@ char *itoa(int n)
206} 206}
207 207
208/* Emit a string of hex representation of bytes */ 208/* Emit a string of hex representation of bytes */
209char *bin2hex(char *p, const char *cp, int count) 209char* FAST_FUNC bin2hex(char *p, const char *cp, int count)
210{ 210{
211 while (count) { 211 while (count) {
212 unsigned char c = *cp++; 212 unsigned char c = *cp++;
@@ -220,7 +220,7 @@ char *bin2hex(char *p, const char *cp, int count)
220 220
221/* Return how long the file at fd is, if there's any way to determine it. */ 221/* Return how long the file at fd is, if there's any way to determine it. */
222#ifdef UNUSED 222#ifdef UNUSED
223off_t fdlength(int fd) 223off_t FAST_FUNC fdlength(int fd)
224{ 224{
225 off_t bottom = 0, top = 0, pos; 225 off_t bottom = 0, top = 0, pos;
226 long size; 226 long size;
@@ -262,7 +262,7 @@ off_t fdlength(int fd)
262 262
263/* It is perfectly ok to pass in a NULL for either width or for 263/* It is perfectly ok to pass in a NULL for either width or for
264 * height, in which case that value will not be set. */ 264 * height, in which case that value will not be set. */
265int get_terminal_width_height(int fd, unsigned *width, unsigned *height) 265int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *height)
266{ 266{
267 struct winsize win = { 0, 0, 0, 0 }; 267 struct winsize win = { 0, 0, 0, 0 };
268 int ret = ioctl(fd, TIOCGWINSZ, &win); 268 int ret = ioctl(fd, TIOCGWINSZ, &win);