Skip to content

Commit

Permalink
Fixed static functions
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Feb 23, 2020
1 parent eebbab3 commit 0ee7db4
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 90 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
protobluff-1.1.1 (2020-02-23)

* Fixed compilation error when including in C++ units

protobluff-1.1.0 (2019-07-11)

* Fixed generator compatibility issues with protobuf 3.6+
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

AC_PREREQ(2.69)

AC_INIT([protobluff], [1.1.0], [[email protected]])
AC_INIT([protobluff], [1.1.1], [[email protected]])
AM_INIT_AUTOMAKE([subdir-objects foreign])

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Expand All @@ -48,7 +48,7 @@ AC_CONFIG_MACRO_DIR([m4])

# Library versioning as <current:revision:age> - also remember to synchronize
# this value with the version info in the core/common.h header file.
AC_SUBST([VERSION_INFO], [5:1:0])
AC_SUBST([VERSION_INFO], [5:1:1])

# Checks for programs
AC_PROG_AWK
Expand Down
15 changes: 8 additions & 7 deletions docs/guide/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,31 @@ and look like this (excerpt):
``` c
...
/* Person : create */
PB_WARN_UNUSED_RESULT
PB_INLINE pb_message_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_message_t
person_create(pb_journal_t *journal) {
return pb_message_create(&person_descriptor, journal);
}

/* Person : destroy */
PB_INLINE void
PB_INLINE
void
person_destroy(pb_message_t *message) {
assert(pb_message_descriptor(message) == &person_descriptor);
return pb_message_destroy(message);
}

/* Person.name : get */
PB_WARN_UNUSED_RESULT
PB_INLINE pb_error_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_error_t
person_get_name(pb_message_t *message, pb_string_t *value) {
assert(pb_message_descriptor(message) == &person_descriptor);
return pb_message_get(message, 1, value);
}

/* Person.name : put */
PB_WARN_UNUSED_RESULT
PB_INLINE pb_error_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_error_t
person_put_name(pb_message_t *message, const pb_string_t *value) {
assert(pb_message_descriptor(message) == &person_descriptor);
return pb_message_put(message, 1, value);
Expand Down
8 changes: 4 additions & 4 deletions include/protobluff/core/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ typedef struct pb_allocator_t {
* \param[in] size Bytes to be allocated
* \return Memory block
*/
PB_WARN_UNUSED_RESULT
PB_INLINE void *
PB_INLINE PB_WARN_UNUSED_RESULT
void *
pb_allocator_allocate(pb_allocator_t *allocator, size_t size) {
assert(allocator && size);
return allocator->proc.allocate(allocator->data, size);
Expand All @@ -85,8 +85,8 @@ pb_allocator_allocate(pb_allocator_t *allocator, size_t size) {
* \param[in] size Bytes to be allocated
* \return Memory block
*/
PB_WARN_UNUSED_RESULT
PB_INLINE void *
PB_INLINE PB_WARN_UNUSED_RESULT
void *
pb_allocator_resize(pb_allocator_t *allocator, void *block, size_t size) {
assert(allocator && size);
return allocator->proc.resize(allocator->data, block, size);
Expand Down
2 changes: 1 addition & 1 deletion include/protobluff/core/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Current ABI version as a single integer to test binary compatibility in
* the generated header files: current * 10^6 + revision * 10^3 + age
*/
#define PB_VERSION (5 * 1000000) + (0 * 1000) + 0
#define PB_VERSION (5 * 1000000) + (1 * 1000) + 1

/*
* Agnostic C-linkage classifier for extern functions when compiling from C++
Expand Down
60 changes: 30 additions & 30 deletions include/protobluff/core/descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ pb_descriptor_extension(const pb_descriptor_t *descriptor) {
* \param[in] descriptor Descriptor
* \return Descriptor iterator
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_descriptor_iter_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_descriptor_iter_t
pb_descriptor_iter_create(const pb_descriptor_t *descriptor) {
assert(descriptor);
pb_descriptor_iter_t it = {
Expand All @@ -356,8 +356,8 @@ pb_descriptor_iter_destroy(pb_descriptor_iter_t *it) {
* \param[in,out] it Descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_descriptor_iter_begin(pb_descriptor_iter_t *it) {
assert(it);
return !pb_descriptor_empty(it->descriptor)
Expand All @@ -371,8 +371,8 @@ pb_descriptor_iter_begin(pb_descriptor_iter_t *it) {
* \param[in,out] it Descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_descriptor_iter_end(pb_descriptor_iter_t *it) {
assert(it);
return !pb_descriptor_empty(it->descriptor)
Expand All @@ -386,8 +386,8 @@ pb_descriptor_iter_end(pb_descriptor_iter_t *it) {
* \param[in,out] it Descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_descriptor_iter_prev(pb_descriptor_iter_t *it) {
assert(it && it->pos != SIZE_MAX);
assert(!pb_descriptor_empty(it->descriptor));
Expand All @@ -402,8 +402,8 @@ pb_descriptor_iter_prev(pb_descriptor_iter_t *it) {
* \param[in,out] it Descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_descriptor_iter_next(pb_descriptor_iter_t *it) {
assert(it && it->pos != SIZE_MAX);
assert(!pb_descriptor_empty(it->descriptor));
Expand Down Expand Up @@ -496,8 +496,8 @@ pb_enum_descriptor_empty(const pb_enum_descriptor_t *descriptor) {
* \param[in] descriptor Enum descriptor
* \return Enum descriptor iterator
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_enum_descriptor_iter_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_enum_descriptor_iter_t
pb_enum_descriptor_iter_create(const pb_enum_descriptor_t *descriptor) {
assert(descriptor);
pb_enum_descriptor_iter_t it = {
Expand All @@ -523,8 +523,8 @@ pb_enum_descriptor_iter_destroy(pb_enum_descriptor_iter_t *it) {
* \param[in,out] it Enum descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_enum_descriptor_iter_begin(pb_enum_descriptor_iter_t *it) {
assert(it);
return !pb_enum_descriptor_empty(it->descriptor)
Expand All @@ -538,8 +538,8 @@ pb_enum_descriptor_iter_begin(pb_enum_descriptor_iter_t *it) {
* \param[in,out] it Enum descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_enum_descriptor_iter_end(pb_enum_descriptor_iter_t *it) {
assert(it);
return !pb_enum_descriptor_empty(it->descriptor)
Expand All @@ -553,8 +553,8 @@ pb_enum_descriptor_iter_end(pb_enum_descriptor_iter_t *it) {
* \param[in,out] it Enum descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_enum_descriptor_iter_prev(pb_enum_descriptor_iter_t *it) {
assert(it && it->pos != SIZE_MAX);
assert(!pb_enum_descriptor_empty(it->descriptor));
Expand All @@ -569,8 +569,8 @@ pb_enum_descriptor_iter_prev(pb_enum_descriptor_iter_t *it) {
* \param[in,out] it Enum descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_enum_descriptor_iter_next(pb_enum_descriptor_iter_t *it) {
assert(it && it->pos != SIZE_MAX);
assert(!pb_enum_descriptor_empty(it->descriptor));
Expand Down Expand Up @@ -637,8 +637,8 @@ pb_oneof_descriptor_empty(const pb_oneof_descriptor_t *descriptor) {
* \param[in] descriptor Oneof descriptor
* \return Oneof descriptor iterator
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_oneof_descriptor_iter_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_oneof_descriptor_iter_t
pb_oneof_descriptor_iter_create(const pb_oneof_descriptor_t *descriptor) {
assert(descriptor);
pb_oneof_descriptor_iter_t it = {
Expand All @@ -664,8 +664,8 @@ pb_oneof_descriptor_iter_destroy(pb_oneof_descriptor_iter_t *it) {
* \param[in,out] it Oneof descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_oneof_descriptor_iter_begin(pb_oneof_descriptor_iter_t *it) {
assert(it);
return !pb_oneof_descriptor_empty(it->descriptor)
Expand All @@ -679,8 +679,8 @@ pb_oneof_descriptor_iter_begin(pb_oneof_descriptor_iter_t *it) {
* \param[in,out] it Oneof descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_oneof_descriptor_iter_end(pb_oneof_descriptor_iter_t *it) {
assert(it);
return !pb_oneof_descriptor_empty(it->descriptor)
Expand All @@ -694,8 +694,8 @@ pb_oneof_descriptor_iter_end(pb_oneof_descriptor_iter_t *it) {
* \param[in,out] it Oneof descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_oneof_descriptor_iter_prev(pb_oneof_descriptor_iter_t *it) {
assert(it && it->pos != SIZE_MAX);
assert(!pb_oneof_descriptor_empty(it->descriptor));
Expand All @@ -710,8 +710,8 @@ pb_oneof_descriptor_iter_prev(pb_oneof_descriptor_iter_t *it) {
* \param[in,out] it Oneof descriptor iterator
* \return Test result
*/
PB_WARN_UNUSED_RESULT
PB_INLINE int
PB_INLINE PB_WARN_UNUSED_RESULT
int
pb_oneof_descriptor_iter_next(pb_oneof_descriptor_iter_t *it) {
assert(it && it->pos != SIZE_MAX);
assert(!pb_oneof_descriptor_empty(it->descriptor));
Expand Down
4 changes: 2 additions & 2 deletions include/protobluff/util/validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ pb_validator_check(
* \param[in] descriptor Descriptor
* \return Validator
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_validator_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_validator_t
pb_validator_create(const pb_descriptor_t *descriptor) {
assert(descriptor);
pb_validator_t validator = {
Expand Down
8 changes: 4 additions & 4 deletions src/core/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ pb_buffer_grow(
* \param[in] size Raw data size
* \return Buffer
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_buffer_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_buffer_t
pb_buffer_create_zero_copy_internal(uint8_t data[], size_t size) {
pb_buffer_t buffer = {
.allocator = &allocator_zero_copy,
Expand All @@ -72,8 +72,8 @@ pb_buffer_create_zero_copy_internal(uint8_t data[], size_t size) {
*
* \return Buffer
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_buffer_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_buffer_t
pb_buffer_create_invalid(void) {
pb_buffer_t buffer = {};
return buffer;
Expand Down
4 changes: 2 additions & 2 deletions src/core/encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
*
* \return Encoder
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_encoder_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_encoder_t
pb_encoder_create_invalid(void) {
pb_encoder_t encoder = {
.descriptor = NULL,
Expand Down
16 changes: 8 additions & 8 deletions src/core/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ pb_stream_skip_jump[];
* \param[in] buffer Buffer
* \return Stream
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_stream_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_stream_t
pb_stream_create(const pb_buffer_t *buffer) {
assert(buffer);
assert(pb_buffer_valid(buffer));
Expand All @@ -103,8 +103,8 @@ pb_stream_create(const pb_buffer_t *buffer) {
* \param[in] offset Offset
* \return Stream
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_stream_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_stream_t
pb_stream_create_at(const pb_buffer_t *buffer, size_t offset) {
assert(buffer);
assert(pb_buffer_valid(buffer));
Expand Down Expand Up @@ -194,8 +194,8 @@ pb_stream_empty(const pb_stream_t *stream) {
* \param[out] value Pointer receiving value
* \return Error code
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_error_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_error_t
pb_stream_read(pb_stream_t *stream, pb_type_t type, void *value) {
assert(pb_stream_read_jump[type]);
return pb_stream_read_jump[type](stream, type, value);
Expand All @@ -208,8 +208,8 @@ pb_stream_read(pb_stream_t *stream, pb_type_t type, void *value) {
* \param[in] wiretype Wiretype
* \return Error code
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_error_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_error_t
pb_stream_skip(pb_stream_t *stream, pb_wiretype_t wiretype) {
assert(pb_stream_skip_jump[wiretype]);
return pb_stream_skip_jump[wiretype](stream);
Expand Down
4 changes: 2 additions & 2 deletions src/core/varint.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ pb_varint_pack(pb_type_t type, uint8_t data[], const void *value) {
* \param[out] value Pointer receiving value
* \return Bytes read
*/
PB_WARN_UNUSED_RESULT
PB_INLINE size_t
PB_INLINE PB_WARN_UNUSED_RESULT
size_t
pb_varint_unpack(
pb_type_t type, const uint8_t data[], size_t left, void *value) {
assert(pb_varint_unpack_jump[type]);
Expand Down
12 changes: 6 additions & 6 deletions src/message/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ pb_cursor_align(
* \param[in] message Message
* \return Cursor
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_cursor_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_cursor_t
pb_cursor_create_without_tag(pb_message_t *message) {
assert(message);
return pb_cursor_create_unsafe(message, 0);
Expand All @@ -68,8 +68,8 @@ pb_cursor_create_without_tag(pb_message_t *message) {
*
* \return Cursor
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_cursor_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_cursor_t
pb_cursor_create_invalid(void) {
pb_cursor_t cursor = {
.message = pb_message_create_invalid(),
Expand All @@ -84,8 +84,8 @@ pb_cursor_create_invalid(void) {
* \param[in] cursor Cursor
* \return Cursor copy
*/
PB_WARN_UNUSED_RESULT
PB_INLINE pb_cursor_t
PB_INLINE PB_WARN_UNUSED_RESULT
pb_cursor_t
pb_cursor_copy(const pb_cursor_t *cursor) {
assert(cursor);
return *cursor;
Expand Down
Loading

0 comments on commit 0ee7db4

Please sign in to comment.