mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-17 21:39:04 +03:00
mem.c: allow re-definition of COAP_MAX_STRING_SIZE and COAP_MAX_STRINGS
The pre-processor symbols COAP_MAX_STRING_SIZE and COAP_MAX_STRINGS are to be used on platforms that allocate memory from fixed-size blocks such as the MEMB allocator on Contiki. As the strings are used to reassemble URIs (including query strings), the reasonable string size depends on the application. The current values now are COAP_MAX_STRING_SIZE = 64, and COAP_MAX_STRINGS = 8. These can be changed at build time with compiler flag -D. Currently, only platform Contiki uses these definitions.
This commit is contained in:
1 parent
132a830b59
commit
9b62b79ef7
1 file changed
+14
-1
@@ -47,8 +47,21 @@ coap_free_type(coap_memory_tag_t type, void *p) {
|
||||
|
||||
#ifdef WITH_CONTIKI
|
||||
|
||||
#define COAP_MAX_STRING_SIZE 12
|
||||
/**
|
||||
* The maximum size of a string on platforms that allocate fixed-size
|
||||
* memory blocks.
|
||||
*/
|
||||
#ifndef COAP_MAX_STRING_SIZE
|
||||
#define COAP_MAX_STRING_SIZE 64
|
||||
#endif /* COAP_MAX_STRING_SIZE */
|
||||
|
||||
/**
|
||||
* The maximum number of a strings on platforms that allocate
|
||||
* fixed-size memory blocks.
|
||||
*/
|
||||
#ifndef COAP_MAX_STRINGS
|
||||
#define COAP_MAX_STRINGS 8
|
||||
#endif /* COAP_MAX_STRINGS */
|
||||
|
||||
struct coap_string_t {
|
||||
char data[COAP_MAX_STRING_SIZE];
|
||||
|
||||
Reference in new issue
Block a user