mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-13 11:50:40 +03:00
bugfix
This commit is contained in:
1 parent
b9672e7ca4
commit
0c2e226e9f
2 files changed
+10
-3
No files matched your search
@@ -24,7 +24,7 @@ coap_insert(coap_list_t **queue, coap_list_t *node,
|
||||
|
||||
/* replace queue head if new node has to be added before the existing queue head */
|
||||
q = *queue;
|
||||
if ( order( node->data, q->data ) ) {
|
||||
if ( order( node->data, q->data ) < 0) {
|
||||
node->next = q;
|
||||
*queue = node;
|
||||
return 1;
|
||||
@@ -34,7 +34,7 @@ coap_insert(coap_list_t **queue, coap_list_t *node,
|
||||
do {
|
||||
p = q;
|
||||
q = q->next;
|
||||
} while ( q && ! order( node->data, q->data ) );
|
||||
} while ( q && order( node->data, q->data ) >= 0);
|
||||
|
||||
/* insert new item */
|
||||
node->next = q;
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef struct coap_linkedlistnode coap_list_t;
|
||||
|
||||
/* adds node to given queue, ordered by specified order function */
|
||||
int coap_insert(coap_list_t **queue, coap_list_t *node,
|
||||
int (*order)(void *, void *node) );
|
||||
int (*order)(void *, void *) );
|
||||
|
||||
/* destroys specified node */
|
||||
int coap_delete(coap_list_t *node);
|
||||
@@ -23,4 +23,11 @@ int coap_delete(coap_list_t *node);
|
||||
/* removes all items from given queue and frees the allocated storage */
|
||||
void coap_delete_list(coap_list_t *queue);
|
||||
|
||||
/**
|
||||
* Creates a new list node and adds the given data object. The memory allocated
|
||||
* by data will be released by coap_delete() with the new node. Returns the
|
||||
* new list node.
|
||||
*/
|
||||
coap_list_t *coap_new_listnode(void *data);
|
||||
|
||||
#endif /* _COAP_LIST_H_ */
|
||||
Reference in new issue
Block a user