Skip to content

Commit

Permalink
Merge pull request #12 from cedric-d/no-static-in-headers
Browse files Browse the repository at this point in the history
Remove static declaration of the dummy callback bundle from header
  • Loading branch information
PJK committed May 5, 2016
2 parents 3c934cf + 5186f77 commit f925df9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
46 changes: 46 additions & 0 deletions src/cbor/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,49 @@ void cbor_null_undefined_callback(void *_ctx) CBOR_DUMMY_CALLBACK
void cbor_null_boolean_callback(void *_ctx, bool _val) CBOR_DUMMY_CALLBACK

void cbor_null_indef_break_callback(void *_ctx) CBOR_DUMMY_CALLBACK

const struct cbor_callbacks cbor_empty_callbacks = {
/* Type 0 - Unsigned integers */
.uint8 = cbor_null_uint8_callback,
.uint16 = cbor_null_uint16_callback,
.uint32 = cbor_null_uint32_callback,
.uint64 = cbor_null_uint64_callback,

/* Type 1 - Negative integers */
.negint8 = cbor_null_negint8_callback,
.negint16 = cbor_null_negint16_callback,
.negint32 = cbor_null_negint32_callback,
.negint64 = cbor_null_negint64_callback,

/* Type 2 - Byte strings */
.byte_string = cbor_null_byte_string_callback,
.byte_string_start = cbor_null_byte_string_start_callback,

/* Type 3 - Strings */
.string = cbor_null_string_callback,
.string_start = cbor_null_string_start_callback,

/* Type 4 - Arrays */
.array_start = cbor_null_array_start_callback,
.indef_array_start = cbor_null_indef_array_start_callback,

/* Type 5 - Maps */
.map_start = cbor_null_map_start_callback,
.indef_map_start = cbor_null_indef_map_start_callback,

/* Type 6 - Tags */
.tag = cbor_null_tag_callback,

/* Type 7 - Floats & misc */
/* Type names cannot be member names */
.float2 = cbor_null_float2_callback,
/* 2B float is not supported in standard C */
.float4 = cbor_null_float4_callback,
.float8 = cbor_null_float8_callback,
.undefined = cbor_null_undefined_callback,
.null = cbor_null_null_callback,
.boolean = cbor_null_boolean_callback,

/* Shared indefinites */
.indef_break = cbor_null_indef_break_callback,
};
46 changes: 1 addition & 45 deletions src/cbor/callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,51 +177,7 @@ void cbor_null_boolean_callback(void *, bool);
void cbor_null_indef_break_callback(void *);

/** Dummy callback bundle - does nothing */
static const struct cbor_callbacks cbor_empty_callbacks = {
/* Type 0 - Unsigned integers */
.uint8 = cbor_null_uint8_callback,
.uint16 = cbor_null_uint16_callback,
.uint32 = cbor_null_uint32_callback,
.uint64 = cbor_null_uint64_callback,

/* Type 1 - Negative integers */
.negint8 = cbor_null_negint8_callback,
.negint16 = cbor_null_negint16_callback,
.negint32 = cbor_null_negint32_callback,
.negint64 = cbor_null_negint64_callback,

/* Type 2 - Byte strings */
.byte_string = cbor_null_byte_string_callback,
.byte_string_start = cbor_null_byte_string_start_callback,

/* Type 3 - Strings */
.string = cbor_null_string_callback,
.string_start = cbor_null_string_start_callback,

/* Type 4 - Arrays */
.array_start = cbor_null_array_start_callback,
.indef_array_start = cbor_null_indef_array_start_callback,

/* Type 5 - Maps */
.map_start = cbor_null_map_start_callback,
.indef_map_start = cbor_null_indef_map_start_callback,

/* Type 6 - Tags */
.tag = cbor_null_tag_callback,

/* Type 7 - Floats & misc */
/* Type names cannot be member names */
.float2 = cbor_null_float2_callback,
/* 2B float is not supported in standard C */
.float4 = cbor_null_float4_callback,
.float8 = cbor_null_float8_callback,
.undefined = cbor_null_undefined_callback,
.null = cbor_null_null_callback,
.boolean = cbor_null_boolean_callback,

/* Shared indefinites */
.indef_break = cbor_null_indef_break_callback,
};
extern const struct cbor_callbacks cbor_empty_callbacks;

#ifdef __cplusplus
}
Expand Down

0 comments on commit f925df9

Please sign in to comment.