Skip to content

Commit

Permalink
include: data: add missing __cplusplus checks
Browse files Browse the repository at this point in the history
This patch adds `extern "C"` linkage directives so the header files can
be included by C++ source files.

Signed-off-by: Markus Fuchs <[email protected]>
  • Loading branch information
mrfuchs authored and andrewboie committed Jul 23, 2019
1 parent f1afb4c commit 779381b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
16 changes: 11 additions & 5 deletions include/data/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#ifndef ZEPHYR_INCLUDE_DATA_JSON_H_
#define ZEPHYR_INCLUDE_DATA_JSON_H_

#include <sys/util.h>
#include <stddef.h>
#include <zephyr/types.h>
#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Structured Data
Expand All @@ -21,11 +28,6 @@
* @{
*/

#include <sys/util.h>
#include <stddef.h>
#include <zephyr/types.h>
#include <sys/types.h>

enum json_tokens {
/* Before changing this enum, ensure that its maximum
* value is still within 7 bits. See comment next to the
Expand Down Expand Up @@ -632,6 +634,10 @@ int json_obj_encode(const struct json_obj_descr *descr, size_t descr_len,
const void *val, json_append_bytes_t append_bytes,
void *data);

#ifdef __cplusplus
}
#endif

/**
* @}
*/
Expand Down
8 changes: 8 additions & 0 deletions include/data/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include <zephyr/types.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief JSON Web Token (JWT)
* @defgroup jwt JSON Web Token (JWT)
Expand Down Expand Up @@ -89,6 +93,10 @@ static inline size_t jwt_payload_len(struct jwt_builder *builder)
return (builder->buf - builder->base);
}

#ifdef __cplusplus
}
#endif

/**
* @}
*/
Expand Down

0 comments on commit 779381b

Please sign in to comment.