updated picoTCP to 1.4.0, lowered build optimization levels to -O2, improved selftest
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*********************************************************************
|
||||
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
|
||||
See LICENSE and COPYING for usage.
|
||||
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
|
||||
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
|
||||
|
||||
Authors: Frederik Van Slycken
|
||||
*********************************************************************/
|
||||
@@ -30,7 +30,7 @@ static int mock_dev_cmp(void *ka, void *kb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PICO_TREE_DECLARE(mock_device_tree, mock_dev_cmp);
|
||||
static PICO_TREE_DECLARE(mock_device_tree, mock_dev_cmp);
|
||||
|
||||
static int pico_mock_send(struct pico_device *dev, void *buf, int len)
|
||||
{
|
||||
@@ -207,7 +207,7 @@ struct mock_device *pico_mock_create(uint8_t*mac)
|
||||
if(mac != NULL) {
|
||||
mock->mac = PICO_ZALLOC(6 * sizeof(uint8_t));
|
||||
if(!mock->mac) {
|
||||
PICO_FREE(mock->mac);
|
||||
PICO_FREE(mock->dev);
|
||||
PICO_FREE(mock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ struct mock_device *pico_mock_create(uint8_t*mac)
|
||||
|
||||
if( 0 != pico_device_init((struct pico_device *)mock->dev, "mock", mac)) {
|
||||
dbg ("Loop init failed.\n");
|
||||
pico_mock_destroy((struct pico_device *)mock->dev);
|
||||
pico_device_destroy(mock->dev);
|
||||
if(mock->mac != NULL)
|
||||
PICO_FREE(mock->mac);
|
||||
|
||||
@@ -230,7 +230,16 @@ struct mock_device *pico_mock_create(uint8_t*mac)
|
||||
mock->dev->destroy = pico_mock_destroy;
|
||||
dbg("Device %s created.\n", mock->dev->name);
|
||||
|
||||
pico_tree_insert(&mock_device_tree, mock);
|
||||
if (pico_tree_insert(&mock_device_tree, mock)) {
|
||||
if (mock->mac != NULL)
|
||||
PICO_FREE(mock->mac);
|
||||
|
||||
pico_device_destroy(mock->dev);
|
||||
|
||||
PICO_FREE(mock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return mock;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user