diff options
author | markm <markm@FreeBSD.org> | 2002-07-19 13:38:43 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2002-07-19 13:38:43 +0000 |
commit | 32ac7e29651c2543786141de3a016d2256077d8f (patch) | |
tree | 8ff8a1fb45d285ad3b8b8fe9a28e8c34c78a4982 | |
parent | dca07368059ad545512278870e07e4e36a7e95cd (diff) | |
download | FreeBSD-src-32ac7e29651c2543786141de3a016d2256077d8f.zip FreeBSD-src-32ac7e29651c2543786141de3a016d2256077d8f.tar.gz |
"inline" fixing. Replace "inline" with "__inline" to make more BSD
standard (and easier to define away with support in cdefs.h).
Also convert two function-like macros to static inline functions
for lint and the debugger.
-rw-r--r-- | usr.bin/doscmd/cmos.c | 6 | ||||
-rw-r--r-- | usr.bin/doscmd/cwd.c | 12 | ||||
-rw-r--r-- | usr.bin/doscmd/cwd.h | 22 | ||||
-rw-r--r-- | usr.bin/doscmd/dispatch.h | 6 | ||||
-rw-r--r-- | usr.bin/doscmd/dos.h | 4 | ||||
-rw-r--r-- | usr.bin/doscmd/int13.c | 6 | ||||
-rw-r--r-- | usr.bin/doscmd/int1a.c | 2 | ||||
-rw-r--r-- | usr.bin/doscmd/port.c | 30 | ||||
-rw-r--r-- | usr.bin/doscmd/register.h | 4 | ||||
-rw-r--r-- | usr.bin/doscmd/trace.c | 4 |
10 files changed, 52 insertions, 44 deletions
diff --git a/usr.bin/doscmd/cmos.c b/usr.bin/doscmd/cmos.c index d899e96..61534b7 100644 --- a/usr.bin/doscmd/cmos.c +++ b/usr.bin/doscmd/cmos.c @@ -99,20 +99,20 @@ static struct timeval glob_clock; static int cmos_alarm_time = 0; static int cmos_alarm_daytime = 0; -static inline int +static __inline int day_in_mon_year(int mon, int year) { return day_in_year[mon] + (mon > 2 && (year % 4 == 0)); } -static inline int +static __inline int to_BCD (int n) { n &= 0xFF; return n%10 + ((n/10)<<4); } -static inline int +static __inline int from_BCD (int n) { n &= 0xFF; diff --git a/usr.bin/doscmd/cwd.c b/usr.bin/doscmd/cwd.c index 1410238..58b9434 100644 --- a/usr.bin/doscmd/cwd.c +++ b/usr.bin/doscmd/cwd.c @@ -48,9 +48,9 @@ __FBSDID("$FreeBSD$"); #include "cwd.h" /* Local functions */ -static inline int isvalid(unsigned); -static inline int isdot(unsigned); -static inline int isslash(unsigned); +static __inline int isvalid(unsigned); +static __inline int isdot(unsigned); +static __inline int isslash(unsigned); static void to_dos_fcb(u_char *, u_char *); #define D_REDIR 0x0080000 /* XXX - ack */ @@ -404,19 +404,19 @@ u_char cattr[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; -static inline int +static __inline int isvalid(unsigned c) { return (cattr[c & 0xff] == 1); } -static inline int +static __inline int isdot(unsigned c) { return (cattr[c & 0xff] == 3); } -static inline int +static __inline int isslash(unsigned c) { return (cattr[c & 0xff] == 4); diff --git a/usr.bin/doscmd/cwd.h b/usr.bin/doscmd/cwd.h index 16c7474..ac5bbd1 100644 --- a/usr.bin/doscmd/cwd.h +++ b/usr.bin/doscmd/cwd.h @@ -32,67 +32,67 @@ * $FreeBSD$ */ -static inline u_char * +static __inline u_char * ustrcpy(u_char *s1, u_char *s2) { return((u_char *)strcpy((char *)s1, (char *)s2)); } -static inline u_char * +static __inline u_char * ustrcat(u_char *s1, u_char *s2) { return((u_char *)strcat((char *)s1, (char *)s2)); } -static inline u_char * +static __inline u_char * ustrncat(u_char *s1, const u_char *s2, size_t n) { return((u_char *)strncat((char *)s1, (const char *)s2, n)); } -static inline u_char * +static __inline u_char * ustrncpy(u_char *s1, u_char *s2, size_t n) { return((u_char *)strncpy((char *)s1, (char *)s2, n)); } -static inline int +static __inline int ustrcmp(u_char *s1, u_char *s2) { return(strcmp((char *)s1, (char *)s2)); } -static inline int +static __inline int ustrncmp(const u_char *s1, const u_char *s2, size_t n) { return(strncmp((const char *)s1, (const char *)s2, n)); } -static inline int +static __inline int ustrlen(const u_char *s) { return(strlen((const char *)s)); } -static inline u_char * +static __inline u_char * ustrrchr(u_char *s, u_char c) { return((u_char *)strrchr((char *)s, c)); } -static inline u_char * +static __inline u_char * ustrdup(const u_char *s) { return((u_char *)strdup((const char *)s)); } -static inline int +static __inline int ustat(u_char *s, struct stat *sb) { return(stat((char *)s, sb)); } -static inline int +static __inline int uaccess(u_char *s, int mode) { return(access((char *)s, mode)); diff --git a/usr.bin/doscmd/dispatch.h b/usr.bin/doscmd/dispatch.h index b1932af..72df284 100644 --- a/usr.bin/doscmd/dispatch.h +++ b/usr.bin/doscmd/dispatch.h @@ -55,7 +55,7 @@ struct intfunc_table ** must be arranged with all handlers for a given function together, and ** that the handler listed with IFT_NOSUBFUNC should be last. */ -static inline void +static __inline void intfunc_init(struct intfunc_table table[], int idx[]) { int hn; @@ -72,7 +72,7 @@ intfunc_init(struct intfunc_table table[], int idx[]) ** Call this to get an index matching the function/subfunction ** described by (sc), or -1 if none exist */ -static inline int +static __inline int intfunc_find(struct intfunc_table table[], int idx[], int func, int subfunc) { int ent = idx[func]; /* look for handler */ @@ -95,7 +95,7 @@ intfunc_find(struct intfunc_table table[], int idx[], int func, int subfunc) ** Again, handlers with IFT_NOSUBFUNC should be listed after any with ** specific subfunction values. */ -static inline int +static __inline int intfunc_search(struct intfunc_table table[], int func, int subfunc) { int ent; diff --git a/usr.bin/doscmd/dos.h b/usr.bin/doscmd/dos.h index b75963f..64ed492 100644 --- a/usr.bin/doscmd/dos.h +++ b/usr.bin/doscmd/dos.h @@ -356,13 +356,13 @@ struct reloc_entry { ** DOS-related shrapnel */ -static inline int +static __inline int from_dos_attr(int attr) { return((attr & READ_ONLY_FILE) ? 0444 : 0666); } -static inline int +static __inline int to_dos_attr(int mode) { int attr; diff --git a/usr.bin/doscmd/int13.c b/usr.bin/doscmd/int13.c index a52daea..ba9be70 100644 --- a/usr.bin/doscmd/int13.c +++ b/usr.bin/doscmd/int13.c @@ -97,13 +97,13 @@ struct diskinfo { #define hd_status (*(u_char *)0x474) #define fd_status (*(u_char *)0x441) -static inline int +static __inline int disize(struct diskinfo *di) { return(di->sectors * di->cylinders * di->sides); } -static inline int +static __inline int cylsize(struct diskinfo *di) { return(di->sectors * di->sides); @@ -335,7 +335,7 @@ init_hdisk(int drive, int cyl, int head, int tracksize, char *file, char *fake_p return(drive); } -static inline int +static __inline int bps(int size) { switch (size) { diff --git a/usr.bin/doscmd/int1a.c b/usr.bin/doscmd/int1a.c index 0c56968..abd1929 100644 --- a/usr.bin/doscmd/int1a.c +++ b/usr.bin/doscmd/int1a.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include "doscmd.h" -static inline int +static __inline int to_BCD (int n) { n &= 0xFF; diff --git a/usr.bin/doscmd/port.c b/usr.bin/doscmd/port.c index a65b1be..22e995f 100644 --- a/usr.bin/doscmd/port.c +++ b/usr.bin/doscmd/port.c @@ -42,17 +42,25 @@ __FBSDID("$FreeBSD$"); #define MINPORT 0x000 #define MAXPORT_MASK (MAXPORT - 1) -#define in(port) \ -({ \ - register int _inb_result; \ -\ - asm volatile ("xorl %%eax,%%eax; inb %%dx,%%al" : \ - "=a" (_inb_result) : "d" (port)); \ - _inb_result; \ -}) - -#define out(port, data) \ - asm volatile ("outb %%al,%%dx" : : "a" (data), "d" (port)) +static __inline int +in(u_int port) +{ + int _inb_result; + +#ifdef __GNUC__ + __asm __volatile ("xorl %%eax,%%eax; inb %%dx,%%al" : + "=a" (_inb_result) : "d" (port)); +#endif + return _inb_result; +} + +static __inline void +out(u_int port, int data) +{ +#ifdef __GNUC__ + __asm __volatile ("outb %%al,%%dx" : : "a" (data), "d" (port)); +#endif +} FILE *iolog = 0; u_long ioports[MAXPORT/32]; diff --git a/usr.bin/doscmd/register.h b/usr.bin/doscmd/register.h index 6e0752c..6be5309 100644 --- a/usr.bin/doscmd/register.h +++ b/usr.bin/doscmd/register.h @@ -155,14 +155,14 @@ typedef union #define REGISTERS regcontext_t *REGS -inline static void +static __inline void PUSH(u_short x, REGISTERS) { R_SP -= 2; *(u_short *)MAKEPTR(R_SS, R_SP) = (x); } -inline static u_short +static __inline u_short POP(REGISTERS) { u_short x; diff --git a/usr.bin/doscmd/trace.c b/usr.bin/doscmd/trace.c index d99dff6..c710504 100644 --- a/usr.bin/doscmd/trace.c +++ b/usr.bin/doscmd/trace.c @@ -43,7 +43,7 @@ static u_char *iaddr, ibyte; /* locals */ static void printtrace(regcontext_t *REGS, char *buf); -static inline void showstate(long, long, char); +static __inline void showstate(long, long, char); /* * Before exiting to VM86 mode: @@ -183,7 +183,7 @@ tracetrap(regcontext_t *REGS) } } -static inline void +static __inline void showstate(long flags, long flag, char f) { putc((flags & flag) ? f : ' ', debugf); |