Commit 39f99d84 authored by Rick Bruyninckx's avatar Rick Bruyninckx Committed by Anas Nashif
Browse files

data: Use designated initializers consistently in macro's



This PR updates the json macros to be consistend with C++20
Signed-off-by: default avatarRick Bruyninckx <xactme@gmail.com>
parent 5c1e7d94
Loading
Loading
Loading
Loading
+38 −54
Original line number Diff line number Diff line
@@ -191,12 +191,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = (sizeof(#field_name_) - 1), \
		.type = JSON_TOK_OBJECT_START, \
		.offset = offsetof(struct_, field_name_), \
		{ \
		.object = { \
			.sub_descr = sub_descr_, \
			.sub_descr_len = ARRAY_SIZE(sub_descr_), \
		}, \
		}, \
	}

/**
@@ -277,13 +275,11 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = sizeof(#field_name_) - 1, \
		.type = JSON_TOK_ARRAY_START, \
		.offset = offsetof(struct_, field_name_), \
		{ \
		.array = { \
			.element_descr = Z_JSON_ELEMENT_DESCR(struct_, len_field_, \
				elem_type_,), \
			.n_elements = (max_len_), \
		}, \
		}, \
	}

/**
@@ -328,14 +324,12 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = sizeof(#field_name_) - 1, \
		.type = JSON_TOK_ARRAY_START, \
		.offset = offsetof(struct_, field_name_), \
		{ \
		.array = { \
			.element_descr = Z_JSON_ELEMENT_DESCR(struct_, len_field_, \
				JSON_TOK_OBJECT_START, \
				Z_JSON_DESCR_OBJ(elem_descr_, elem_descr_len_)), \
			.n_elements = (max_len_), \
		}, \
		}, \
	}

/**
@@ -389,7 +383,6 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = sizeof(#field_name_) - 1, \
		.type = JSON_TOK_ARRAY_START, \
		.offset = offsetof(struct_, field_name_), \
		{ \
		.array = { \
			.element_descr = Z_JSON_ELEMENT_DESCR( \
				struct_, len_field_, JSON_TOK_ARRAY_START, \
@@ -398,7 +391,6 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
					1 + ZERO_OR_COMPILE_ERROR(elem_descr_len_ == 1))), \
			.n_elements = (max_len_), \
		}, \
		}, \
	}

/**
@@ -426,7 +418,6 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = sizeof(#json_field_name_) - 1, \
		.type = JSON_TOK_ARRAY_START, \
		.offset = offsetof(struct_, struct_field_name_), \
		{ \
		.array = { \
			.element_descr = Z_JSON_ELEMENT_DESCR( \
				struct_, len_field_, JSON_TOK_ARRAY_START, \
@@ -435,7 +426,6 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
					1 + ZERO_OR_COMPILE_ERROR(elem_descr_len_ == 1))), \
			.n_elements = (max_len_), \
		}, \
		}, \
	}

/**
@@ -483,12 +473,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = (sizeof(json_field_name_) - 1), \
		.type = JSON_TOK_OBJECT_START, \
		.offset = offsetof(struct_, struct_field_name_), \
		{ \
		.object = { \
			.sub_descr = sub_descr_, \
			.sub_descr_len = ARRAY_SIZE(sub_descr_), \
		}, \
		}, \
	}

/**
@@ -516,13 +504,11 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = sizeof(json_field_name_) - 1, \
		.type = JSON_TOK_ARRAY_START, \
		.offset = offsetof(struct_, struct_field_name_), \
		{ \
		.array = { \
			.element_descr = \
				Z_JSON_ELEMENT_DESCR(struct_, len_field_, elem_type_,), \
			.n_elements = (max_len_), \
		}, \
		}, \
	}

/**
@@ -575,14 +561,12 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
		.field_name_len = sizeof(json_field_name_) - 1, \
		.type = JSON_TOK_ARRAY_START, \
		.offset = offsetof(struct_, struct_field_name_), \
		{ \
		.array = { \
			.element_descr = Z_JSON_ELEMENT_DESCR(struct_, len_field_, \
				JSON_TOK_OBJECT_START, \
				Z_JSON_DESCR_OBJ(elem_descr_, elem_descr_len_)), \
			.n_elements = (max_len_), \
		}, \
		}, \
	}

/**