aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-23 14:24:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-23 14:24:44 +0200
commit9d57a8073af171ae76298f746677fc19a14545a2 (patch)
tree643b2b7725bc314d7a8f371f6f2c3ee188651950
parent11c12c47201ee47a4d15044699915f23722e71d3 (diff)
downloadbusybox-w32-9d57a8073af171ae76298f746677fc19a14545a2.tar.gz
busybox-w32-9d57a8073af171ae76298f746677fc19a14545a2.tar.bz2
busybox-w32-9d57a8073af171ae76298f746677fc19a14545a2.zip
libbb.h: tidy it up a bit. no code changes (verified)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/libbb.h30
-rw-r--r--init/halt.c7
2 files changed, 19 insertions, 18 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 33fdca40a..a1744ecc3 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -30,8 +30,8 @@
30#include <sys/mman.h> 30#include <sys/mman.h>
31#include <sys/socket.h> 31#include <sys/socket.h>
32#if defined __FreeBSD__ 32#if defined __FreeBSD__
33#include <netinet/in.h> 33# include <netinet/in.h>
34#include <arpa/inet.h> 34# include <arpa/inet.h>
35#endif 35#endif
36#include <sys/stat.h> 36#include <sys/stat.h>
37#include <sys/time.h> 37#include <sys/time.h>
@@ -45,7 +45,11 @@
45#include <limits.h> 45#include <limits.h>
46#include <sys/param.h> 46#include <sys/param.h>
47#ifndef PATH_MAX 47#ifndef PATH_MAX
48#define PATH_MAX 256 48# define PATH_MAX 256
49#endif
50
51#ifndef BUFSIZ
52# define BUFSIZ 4096
49#endif 53#endif
50 54
51#ifdef HAVE_MNTENT_H 55#ifdef HAVE_MNTENT_H
@@ -64,13 +68,13 @@
64#endif 68#endif
65 69
66#if ENABLE_LOCALE_SUPPORT 70#if ENABLE_LOCALE_SUPPORT
67#include <locale.h> 71# include <locale.h>
68#else 72#else
69#define setlocale(x,y) ((void)0) 73# define setlocale(x,y) ((void)0)
70#endif 74#endif
71 75
72#ifdef DMALLOC 76#ifdef DMALLOC
73#include <dmalloc.h> 77# include <dmalloc.h>
74#endif 78#endif
75 79
76#include <pwd.h> 80#include <pwd.h>
@@ -1478,9 +1482,6 @@ extern const int const_int_0;
1478extern const int const_int_1; 1482extern const int const_int_1;
1479 1483
1480 1484
1481#ifndef BUFSIZ
1482#define BUFSIZ 4096
1483#endif
1484/* Providing hard guarantee on minimum size (think of BUFSIZ == 128) */ 1485/* Providing hard guarantee on minimum size (think of BUFSIZ == 128) */
1485enum { COMMON_BUFSIZE = (BUFSIZ >= 256*sizeof(void*) ? BUFSIZ+1 : 256*sizeof(void*)) }; 1486enum { COMMON_BUFSIZE = (BUFSIZ >= 256*sizeof(void*) ? BUFSIZ+1 : 256*sizeof(void*)) };
1486extern char bb_common_bufsiz1[COMMON_BUFSIZE]; 1487extern char bb_common_bufsiz1[COMMON_BUFSIZE];
@@ -1561,10 +1562,8 @@ extern const char bb_default_login_shell[];
1561#define DEV_CONSOLE "/dev/console" 1562#define DEV_CONSOLE "/dev/console"
1562 1563
1563 1564
1564#ifndef RB_POWER_OFF 1565#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
1565/* Stop system and switch power off if possible. */ 1566
1566#define RB_POWER_OFF 0x4321fedc
1567#endif
1568 1567
1569/* We redefine ctype macros. Unicode-correct handling of char types 1568/* We redefine ctype macros. Unicode-correct handling of char types
1570 * can't be done with such byte-oriented operations anyway, 1569 * can't be done with such byte-oriented operations anyway,
@@ -1603,7 +1602,7 @@ extern const char bb_default_login_shell[];
1603#define isspace(a) ({ unsigned char bb__isspace = (a) - 9; bb__isspace == (' ' - 9) || bb__isspace <= (13 - 9); }) 1602#define isspace(a) ({ unsigned char bb__isspace = (a) - 9; bb__isspace == (' ' - 9) || bb__isspace <= (13 - 9); })
1604 1603
1605// Bigger code: 1604// Bigger code:
1606//#define isalnum(a) ({ unsigned char bb__isalnum = (a) - '0'; bb__isalnum <= 9 || ((bb__isalnum - ('A' - '0')) & 0xdf) <= 25; }) */ 1605//#define isalnum(a) ({ unsigned char bb__isalnum = (a) - '0'; bb__isalnum <= 9 || ((bb__isalnum - ('A' - '0')) & 0xdf) <= 25; })
1607#define isalnum(a) bb_ascii_isalnum(a) 1606#define isalnum(a) bb_ascii_isalnum(a)
1608static ALWAYS_INLINE int bb_ascii_isalnum(unsigned char a) 1607static ALWAYS_INLINE int bb_ascii_isalnum(unsigned char a)
1609{ 1608{
@@ -1645,9 +1644,6 @@ static ALWAYS_INLINE unsigned char bb_ascii_tolower(unsigned char a)
1645} 1644}
1646 1645
1647 1646
1648#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
1649
1650
1651POP_SAVED_FUNCTION_VISIBILITY 1647POP_SAVED_FUNCTION_VISIBILITY
1652 1648
1653#endif 1649#endif
diff --git a/init/halt.c b/init/halt.c
index c88c333e7..16906dfe0 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -40,10 +40,15 @@ static void write_wtmp(void)
40#define RB_HALT_SYSTEM RB_HALT 40#define RB_HALT_SYSTEM RB_HALT
41#endif 41#endif
42 42
43#ifndef RB_POWERDOWN
44/* Stop system and switch power off if possible. */
45# define RB_POWERDOWN 0x4321fedc
46#endif
43#ifndef RB_POWER_OFF 47#ifndef RB_POWER_OFF
44#define RB_POWER_OFF RB_POWERDOWN 48# define RB_POWER_OFF RB_POWERDOWN
45#endif 49#endif
46 50
51
47int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 52int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
48int halt_main(int argc UNUSED_PARAM, char **argv) 53int halt_main(int argc UNUSED_PARAM, char **argv)
49{ 54{