openocd: header fix
* If included by cpp-file, this will cause trouble. So it gets restricted to use in c only. * Prevent usage of "new" as variable name * No redifinition of true and false, if included by C++ * Definition of bool fixed Change-Id: Ic5403bd576afd9d2900a8ecfbcfdc50561ba0633
This commit is contained in:
@ -126,10 +126,12 @@ int str_to_buf(const char *str, unsigned len,
|
|||||||
char *buf_to_str(const void *buf, unsigned size, unsigned radix);
|
char *buf_to_str(const void *buf, unsigned size, unsigned radix);
|
||||||
|
|
||||||
/* read a uint32_t from a buffer in target memory endianness */
|
/* read a uint32_t from a buffer in target memory endianness */
|
||||||
|
#ifndef __cplusplus
|
||||||
static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le)
|
static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le)
|
||||||
{
|
{
|
||||||
return le ? le_to_h_u32(p) : be_to_h_u32(p);
|
return le ? le_to_h_u32(p) : be_to_h_u32(p);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void bit_copy(uint8_t *dst, unsigned dst_offset, const uint8_t *src,
|
static inline void bit_copy(uint8_t *dst, unsigned dst_offset, const uint8_t *src,
|
||||||
unsigned src_offset, unsigned bit_count)
|
unsigned src_offset, unsigned bit_count)
|
||||||
|
|||||||
@ -47,17 +47,17 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
|
|||||||
* the prev/next entries already!
|
* the prev/next entries already!
|
||||||
*/
|
*/
|
||||||
#ifndef CONFIG_DEBUG_LIST
|
#ifndef CONFIG_DEBUG_LIST
|
||||||
static inline void __list_add(struct list_head *new,
|
static inline void __list_add(struct list_head *n,
|
||||||
struct list_head *prev,
|
struct list_head *prev,
|
||||||
struct list_head *next)
|
struct list_head *next)
|
||||||
{
|
{
|
||||||
next->prev = new;
|
next->prev = n;
|
||||||
new->next = next;
|
n->next = next;
|
||||||
new->prev = prev;
|
n->prev = prev;
|
||||||
prev->next = new;
|
prev->next = n;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
extern void __list_add(struct list_head *new,
|
extern void __list_add(struct list_head *n,
|
||||||
struct list_head *prev,
|
struct list_head *prev,
|
||||||
struct list_head *next);
|
struct list_head *next);
|
||||||
#endif
|
#endif
|
||||||
@ -70,9 +70,9 @@ extern void __list_add(struct list_head *new,
|
|||||||
* Insert a new entry after the specified head.
|
* Insert a new entry after the specified head.
|
||||||
* This is good for implementing stacks.
|
* This is good for implementing stacks.
|
||||||
*/
|
*/
|
||||||
static inline void list_add(struct list_head *new, struct list_head *head)
|
static inline void list_add(struct list_head *n, struct list_head *head)
|
||||||
{
|
{
|
||||||
__list_add(new, head, head->next);
|
__list_add(n, head, head->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +84,9 @@ static inline void list_add(struct list_head *new, struct list_head *head)
|
|||||||
* Insert a new entry before the specified head.
|
* Insert a new entry before the specified head.
|
||||||
* This is useful for implementing queues.
|
* This is useful for implementing queues.
|
||||||
*/
|
*/
|
||||||
static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
static inline void list_add_tail(struct list_head *n, struct list_head *head)
|
||||||
{
|
{
|
||||||
__list_add(new, head->prev, head);
|
__list_add(n, head->prev, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -133,18 +133,18 @@ extern void list_del(struct list_head *entry);
|
|||||||
* If @old was empty, it will be overwritten.
|
* If @old was empty, it will be overwritten.
|
||||||
*/
|
*/
|
||||||
static inline void list_replace(struct list_head *old,
|
static inline void list_replace(struct list_head *old,
|
||||||
struct list_head *new)
|
struct list_head *n)
|
||||||
{
|
{
|
||||||
new->next = old->next;
|
n->next = old->next;
|
||||||
new->next->prev = new;
|
n->next->prev = n;
|
||||||
new->prev = old->prev;
|
n->prev = old->prev;
|
||||||
new->prev->next = new;
|
n->prev->next = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_replace_init(struct list_head *old,
|
static inline void list_replace_init(struct list_head *old,
|
||||||
struct list_head *new)
|
struct list_head *n)
|
||||||
{
|
{
|
||||||
list_replace(old, new);
|
list_replace(old, n);
|
||||||
INIT_LIST_HEAD(old);
|
INIT_LIST_HEAD(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,11 +666,11 @@ static inline void hlist_add_fake(struct hlist_node *n)
|
|||||||
* reference of the first entry if it exists.
|
* reference of the first entry if it exists.
|
||||||
*/
|
*/
|
||||||
static inline void hlist_move_list(struct hlist_head *old,
|
static inline void hlist_move_list(struct hlist_head *old,
|
||||||
struct hlist_head *new)
|
struct hlist_head *n)
|
||||||
{
|
{
|
||||||
new->first = old->first;
|
n->first = old->first;
|
||||||
if (new->first)
|
if (n->first)
|
||||||
new->first->pprev = &new->first;
|
n->first->pprev = &n->first;
|
||||||
old->first = NULL;
|
old->first = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -83,9 +83,11 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
#ifndef true
|
#ifndef true
|
||||||
#define true 1
|
#define true 1
|
||||||
#define false 0
|
#define false 0
|
||||||
#endif
|
#endif
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif /* SYSTEM_H */
|
#endif /* SYSTEM_H */
|
||||||
|
|||||||
@ -43,15 +43,15 @@
|
|||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
|
||||||
#define false 0
|
#define false 0
|
||||||
#define true 1
|
#define true 1
|
||||||
|
|
||||||
typedef int _Bool;
|
//typedef int _Bool;
|
||||||
#else
|
#else
|
||||||
typedef bool _Bool;
|
typedef bool _Bool ;
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
#endif /* HAVE__BOOL */
|
#endif /* HAVE__BOOL */
|
||||||
|
|
||||||
#define bool _Bool
|
#define bool int
|
||||||
|
|
||||||
#endif /* HAVE_STDBOOL_H */
|
#endif /* HAVE_STDBOOL_H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user