Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c++: s/restrict/__restrict/ #2042

Merged
merged 1 commit into from
Nov 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions core/include/ringbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ typedef struct ringbuffer {
* @param[in] buffer Buffer to use by rb.
* @param[in] bufsize `sizeof (buffer)`
*/
static inline void ringbuffer_init(ringbuffer_t *restrict rb, char *buffer, unsigned bufsize)
static inline void ringbuffer_init(ringbuffer_t *__restrict rb, char *buffer, unsigned bufsize)
{
rb->buf = buffer;
rb->size = bufsize;
Expand All @@ -66,7 +66,7 @@ static inline void ringbuffer_init(ringbuffer_t *restrict rb, char *buffer, unsi
* @returns The element that was dropped, iff the buffer was full.
* -1 iff the buffer was not full.
*/
int ringbuffer_add_one(ringbuffer_t *restrict rb, char c);
int ringbuffer_add_one(ringbuffer_t *__restrict rb, char c);

/**
* @brief Add a number of elements to the ringbuffer.
Expand All @@ -78,14 +78,14 @@ int ringbuffer_add_one(ringbuffer_t *restrict rb, char c);
* @param[in] n Maximum number of elements to add.
* @returns Number of elements actually added. 0 if rb is full.
*/
unsigned ringbuffer_add(ringbuffer_t *restrict rb, const char *buf, unsigned n);
unsigned ringbuffer_add(ringbuffer_t *__restrict rb, const char *buf, unsigned n);

/**
* @brief Peek and remove oldest element from the ringbuffer.
* @param[in,out] rb Ringbuffer to operate on.
* @returns The oldest element that was added, or `-1` if rb is empty.
*/
int ringbuffer_get_one(ringbuffer_t *restrict rb);
int ringbuffer_get_one(ringbuffer_t *__restrict rb);

/**
* @brief Read and remove a number of elements from the ringbuffer.
Expand All @@ -94,22 +94,22 @@ int ringbuffer_get_one(ringbuffer_t *restrict rb);
* @param[in] n Read at most n elements.
* @returns Number of elements actually read.
*/
unsigned ringbuffer_get(ringbuffer_t *restrict rb, char *buf, unsigned n);
unsigned ringbuffer_get(ringbuffer_t *__restrict rb, char *buf, unsigned n);

/**
* @brief Remove a number of elements from the ringbuffer.
* @param[in,out] rb Ringbuffer to operate on.
* @param[in] n Read at most n elements.
* @returns Number of elements actually removed.
*/
unsigned ringbuffer_remove(ringbuffer_t *restrict rb, unsigned n);
unsigned ringbuffer_remove(ringbuffer_t *__restrict rb, unsigned n);

/**
* @brief Test if the ringbuffer is empty.
* @param[in,out] rb Ringbuffer to operate on.
* @returns 0 iff not empty
*/
static inline int ringbuffer_empty(const ringbuffer_t *restrict rb)
static inline int ringbuffer_empty(const ringbuffer_t *__restrict rb)
{
return rb->avail == 0;
}
Expand All @@ -119,7 +119,7 @@ static inline int ringbuffer_empty(const ringbuffer_t *restrict rb)
* @param[in,out] rb Ringbuffer to operate on.
* @returns 0 iff not full
*/
static inline int ringbuffer_full(const ringbuffer_t *restrict rb)
static inline int ringbuffer_full(const ringbuffer_t *__restrict rb)
{
return rb->avail == rb->size;
}
Expand All @@ -129,7 +129,7 @@ static inline int ringbuffer_full(const ringbuffer_t *restrict rb)
* @param[in,out] rb Ringbuffer to query.
* @returns number of available bytes
*/
static inline unsigned int ringbuffer_get_free(const ringbuffer_t *restrict rb)
static inline unsigned int ringbuffer_get_free(const ringbuffer_t *__restrict rb)
{
return rb->size - rb->avail;
}
Expand All @@ -139,7 +139,7 @@ static inline unsigned int ringbuffer_get_free(const ringbuffer_t *restrict rb)
* @param[in] rb Ringbuffer to operate on.
* @returns Same as ringbuffer_get_one()
*/
int ringbuffer_peek_one(const ringbuffer_t *restrict rb);
int ringbuffer_peek_one(const ringbuffer_t *__restrict rb);

/**
* @brief Read, but don't remove, the a number of element of the buffer.
Expand All @@ -148,7 +148,7 @@ int ringbuffer_peek_one(const ringbuffer_t *restrict rb);
* @param[in] n Read at most n elements.
* @returns Same as ringbuffer_get()
*/
unsigned ringbuffer_peek(const ringbuffer_t *restrict rb, char *buf, unsigned n);
unsigned ringbuffer_peek(const ringbuffer_t *__restrict rb, char *buf, unsigned n);

#ifdef __cplusplus
}
Expand Down
12 changes: 6 additions & 6 deletions sys/posix/pnet/include/sys/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ struct __attribute__((packed)) sockaddr_storage {
* file descriptor of the accepted socket. Otherwise, -1 shall be
* returned and errno set to indicate the error.
*/
int accept(int socket, struct sockaddr *restrict address,
socklen_t *restrict address_len);
int accept(int socket, struct sockaddr *__restrict address,
socklen_t *__restrict address_len);

/**
* @brief Bind a name to a socket.
Expand Down Expand Up @@ -279,7 +279,7 @@ int connect(int socket, const struct sockaddr *address, socklen_t address_len);
* -1 shall be returned and errno set to indicate the error.
*/
int getsockopt(int socket, int level, int option_name,
void *restrict option_value, socklen_t *restrict option_len);
void *__restrict option_value, socklen_t *__restrict option_len);

/**
* @brief Listen for socket connections and limit the queue of incoming
Expand Down Expand Up @@ -363,9 +363,9 @@ ssize_t recv(int socket, void *buffer, size_t length, int flags);
* return 0. Otherwise, the function shall return -1 and set errno to
* indicate the error.
*/
ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags,
struct sockaddr *restrict address,
socklen_t *restrict address_len);
ssize_t recvfrom(int socket, void *__restrict buffer, size_t length, int flags,
struct sockaddr *__restrict address,
socklen_t *__restrict address_len);

/**
* @brief Send a message on a socket.
Expand Down