Working toward compiler independence: Removed inline funcs

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@15 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-02-20 23:16:24 +00:00
parent 3c0e634aee
commit 4881fed8bf
19 changed files with 31 additions and 108 deletions

View File

@ -149,17 +149,15 @@ include/types.h
include/irq.h include/irq.h
This file needs to define some architecture specific functions (usually This file needs to define some architecture specific functions (usually
inline) and structure. These include: inline if the compiler supports inlining) and structure. These include:
- struct xcptcontext. This structures represents the saved context - struct xcptcontext. This structures represents the saved context
of a thread. of a thread.
- static inline uint32 irqsave(void) -- Used to disable - uint32 irqsave(void) -- Used to disable all interrupts.
all interrupts.
- static inline void irqrestore(uint32 flags) -- Used to - void irqrestore(uint32 flags) -- Used to restore interrupt
restore interrupts enables to the same state as before irqsave enables to the same state as before irqsave was called.
was called.
This file must also define NR_IRQS, the total number of IRQs supported This file must also define NR_IRQS, the total number of IRQs supported
by the board. by the board.

View File

@ -123,7 +123,6 @@ static int up_close(struct file *filep);
static ssize_t up_read(struct file *filep, char *buffer, size_t buflen); static ssize_t up_read(struct file *filep, char *buffer, size_t buflen);
static ssize_t up_write(struct file *filep, const char *buffer, size_t buflen); static ssize_t up_write(struct file *filep, const char *buffer, size_t buflen);
static int up_ioctl(struct file *filep, int cmd, unsigned long arg); static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
static void up_consoleinit(up_dev_t *dev);
static void up_uartsetup(up_dev_t *dev); static void up_uartsetup(up_dev_t *dev);
static void up_delay(int milliseconds); static void up_delay(int milliseconds);
@ -590,7 +589,7 @@ static void up_xmitchars(up_dev_t *dev)
* serial driver. * serial driver.
*/ */
static int up_interrupt(int irq, struct xcptcontext *xcp) static int up_interrupt(int irq, void *context)
{ {
up_dev_t *dev; up_dev_t *dev;
volatile uint32 cause; volatile uint32 cause;

View File

@ -55,23 +55,14 @@
* Definitions * Definitions
************************************************************/ ************************************************************/
#define DUP_ISOPEN(fd, list) \
((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS && \
list->fl_files[fd].f_inode != NULL)
/************************************************************ /************************************************************
* Private Functions * Private Functions
************************************************************/ ************************************************************/
static inline boolean dup_isopen(int fd, struct filelist *list)
{
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS ||
list->fl_files[fd].f_inode == NULL)
{
return FALSE;
}
else
{
return TRUE;
}
}
/************************************************************ /************************************************************
* Global Functions * Global Functions
************************************************************/ ************************************************************/
@ -92,7 +83,7 @@ int dup(int fildes)
/* Verify that fildes is a valid, open file descriptor */ /* Verify that fildes is a valid, open file descriptor */
if (!dup_isopen(fildes, list)) if (!DUP_ISOPEN(fildes, list))
{ {
*get_errno_ptr() = EBADF; *get_errno_ptr() = EBADF;
return ERROR; return ERROR;
@ -131,7 +122,7 @@ int dup2(int fildes1, int fildes2)
/* Verify that fildes is a valid, open file descriptor */ /* Verify that fildes is a valid, open file descriptor */
if (!dup_isopen(fildes1, list)) if (!DUP_ISOPEN(fildes1, list))
{ {
*get_errno_ptr() = EBADF; *get_errno_ptr() = EBADF;
return ERROR; return ERROR;

View File

@ -86,10 +86,7 @@ static void _files_semtake(struct filelist *list)
} }
} }
static inline void _files_semgive(struct filelist *list) #define _files_semgive(list) sem_post(&list->fl_sem)
{
sem_post(&list->fl_sem);
}
/************************************************************ /************************************************************
* Pulblic Functions * Pulblic Functions

View File

@ -53,9 +53,12 @@
#include "fs_internal.h" #include "fs_internal.h"
/************************************************************ /************************************************************
* Private types * Definitions
************************************************************/ ************************************************************/
#define INODE_SEMGIVE() \
sem_post(&tree_sem)
/************************************************************ /************************************************************
* Private Variables * Private Variables
************************************************************/ ************************************************************/
@ -86,10 +89,7 @@ static void _inode_semtake(void)
} }
} }
static inline void _inode_semgive(void) #define _inode_semgive(void) sem_post(&tree_sem)
{
sem_post(&tree_sem);
}
static int _inode_compare(const char *fname, static int _inode_compare(const char *fname,
struct inode *node) struct inode *node)
@ -152,20 +152,20 @@ static int _inode_compare(const char *fname,
} }
} }
static inline int _inode_namelen(const char *name) static int _inode_namelen(const char *name)
{ {
const char *tmp = name; const char *tmp = name;
while(*tmp && *tmp != '/') tmp++; while(*tmp && *tmp != '/') tmp++;
return tmp - name; return tmp - name;
} }
static inline void _inode_namecpy(char *dest, const char *src) static void _inode_namecpy(char *dest, const char *src)
{ {
while(*src && *src != '/') *dest++ = *src++; while(*src && *src != '/') *dest++ = *src++;
*dest='\0'; *dest='\0';
} }
static inline const char *_inode_nextname(const char *name) static const char *_inode_nextname(const char *name)
{ {
while (*name && *name != '/') name++; while (*name && *name != '/') name++;
if (*name) name++; if (*name) name++;

View File

@ -63,10 +63,6 @@ extern struct file files[CONFIG_NFILE_DESCRIPTORS];
#endif #endif
extern struct inode *root_inode; extern struct inode *root_inode;
/************************************************************
* Inline Functions
************************************************************/
/************************************************************ /************************************************************
* Pulblic Function Prototypes * Pulblic Function Prototypes
************************************************************/ ************************************************************/

View File

@ -49,10 +49,6 @@
* Definitions * Definitions
************************************************************/ ************************************************************/
/************************************************************
* Inline functions
************************************************************/
/************************************************************ /************************************************************
* Public Types * Public Types
************************************************************/ ************************************************************/

View File

@ -69,10 +69,6 @@ typedef int (*swint_t)(uint32 code, uint32 parm2, uint32 parm3,
#include <arch/irq.h> #include <arch/irq.h>
/************************************************************
* Inline functions
************************************************************/
/************************************************************ /************************************************************
* Public Variables * Public Variables
************************************************************/ ************************************************************/

View File

@ -99,9 +99,9 @@
/* The first three _iob entries are reserved for standard I/O */ /* The first three _iob entries are reserved for standard I/O */
#define stdin (__stdfile(0)) #define stdin (&sched_getstreams()->sl_streams[0])
#define stdout (__stdfile(1)) #define stdout (&sched_getstreams()->sl_streams[1])
#define stderr (__stdfile(2)) #define stderr (&sched_getstreams()->sl_streams[2])
/* These APIs are not implemented and/or can be synthesized from /* These APIs are not implemented and/or can be synthesized from
* supported APIs. * supported APIs.
@ -194,29 +194,6 @@ typedef void DIR;
* Public Variables * Public Variables
************************************************************/ ************************************************************/
/************************************************************
* Inline Functions
************************************************************/
/* Used to reference stdin, stdout, and stderr */
#ifdef CONFIG_HAVE_INLINE
static inline FILE *__stdfile(int fd)
{
if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS)
{
struct streamlist *streams = sched_getstreams();
if (streams)
{
return &streams->sl_streams[fd];
}
}
return NULL;
}
#else
extern FILE *__stdfile(int fd);
#endif
/************************************************************ /************************************************************
* Public Function Prototypes * Public Function Prototypes
************************************************************/ ************************************************************/

View File

@ -71,10 +71,7 @@ static void _lib_semtake(struct streamlist *list)
} }
} }
static inline void _lib_semgive(struct streamlist *list) #define _lib_semgive(list) sem_post(&list->sl_sem)
{
sem_post(&list->sl_sem);
}
/************************************************************ /************************************************************
* Public Functions * Public Functions

View File

@ -98,10 +98,6 @@ struct lib_rawstream_s
* Public Variables * Public Variables
************************************************************/ ************************************************************/
/************************************************************
* Inline Functions
************************************************************/
/************************************************************ /************************************************************
* Pulblic Function Prototypes * Pulblic Function Prototypes
************************************************************/ ************************************************************/

View File

@ -152,10 +152,6 @@ extern struct mm_allocnode_s *g_heapend;
extern struct mm_freenode_s g_nodelist[MM_NNODES]; extern struct mm_freenode_s g_nodelist[MM_NNODES];
/************************************************************
* Inline Functions
************************************************************/
/************************************************************ /************************************************************
* Pulblic Function Prototypes * Pulblic Function Prototypes
************************************************************/ ************************************************************/

View File

@ -85,10 +85,6 @@ extern volatile uint32 g_system_timer;
extern struct timespec g_basetime; extern struct timespec g_basetime;
extern uint32 g_tickbias; extern uint32 g_tickbias;
/************************************************************
* Public Inline Functions
************************************************************/
/************************************************************ /************************************************************
* Public Function Prototypes * Public Function Prototypes
************************************************************/ ************************************************************/

View File

@ -81,7 +81,7 @@
* *
************************************************************/ ************************************************************/
static inline time_t clock_gregorian2utc(int year, int month, int day) static time_t clock_gregorian2utc(int year, int month, int day)
{ {
int temp; int temp;
@ -95,7 +95,7 @@ static inline time_t clock_gregorian2utc(int year, int month, int day)
} }
#ifdef CONFIG_JULIAN_TIME #ifdef CONFIG_JULIAN_TIME
static inline time_t clock_julian2utc(int year, int month, int day) static time_t clock_julian2utc(int year, int month, int day)
{ {
return 367*year return 367*year
- (7*(year + 5001 + (month-9)/7))/4 - (7*(year + 5001 + (month-9)/7))/4

View File

@ -67,19 +67,15 @@
* Function: mq_desfree * Function: mq_desfree
* *
* Description: * Description:
* Deallocate a message queue descriptor * Deallocate a message queue descriptor but returning it
* to the free liest
* *
* Inputs: * Inputs:
* mqdes - message queue descriptor to free * mqdes - message queue descriptor to free
* *
************************************************************/ ************************************************************/
static inline void mq_desfree(mqd_t mqdes) #define mq_desfree(mqdes) sq_addlast((sq_entry_t*)mqdes, &g_desfree)
{
/* Just put it back on the free list */
sq_addlast((sq_entry_t*)mqdes, &g_desfree);
}
/************************************************************ /************************************************************
* Public Functions * Public Functions

View File

@ -88,7 +88,7 @@
* *
************************************************************/ ************************************************************/
static inline mqd_t mq_desalloc(void) static mqd_t mq_desalloc(void)
{ {
mqd_t mqdes; mqd_t mqdes;

View File

@ -228,10 +228,6 @@ extern pidhash_t g_pidhash[MAX_TASKS_ALLOWED];
extern const tasklist_t g_tasklisttable[NUM_TASK_STATES]; extern const tasklist_t g_tasklisttable[NUM_TASK_STATES];
/************************************************************
* Public Inline Functions
************************************************************/
/************************************************************ /************************************************************
* Public Function Prototypes * Public Function Prototypes
************************************************************/ ************************************************************/

View File

@ -72,7 +72,7 @@
* Private Functions * Private Functions
************************************************************/ ************************************************************/
static inline void sched_process_timeslice(void) static void sched_process_timeslice(void)
{ {
#if CONFIG_RR_INTERVAL > 0 #if CONFIG_RR_INTERVAL > 0
_TCB *rtcb; _TCB *rtcb;

View File

@ -149,10 +149,6 @@ extern sq_queue_t g_sigpendingsignal;
extern sq_queue_t g_sigpendingirqsignal; extern sq_queue_t g_sigpendingirqsignal;
/************************************************************
* Public Inline Functions
************************************************************/
/************************************************************ /************************************************************
* Public Function Prototypes * Public Function Prototypes
************************************************************/ ************************************************************/