mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 10:17:30 +02:00
fix(examples): Fixed esp_netif_next() warning with IDFv5.3
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -109,7 +109,11 @@ static esp_netif_t *get_netif_with_esp_index(int index)
|
|||||||
{
|
{
|
||||||
esp_netif_t *netif = NULL;
|
esp_netif_t *netif = NULL;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||||
|
while ((netif = esp_netif_next_unsafe(netif)) != NULL) {
|
||||||
|
#else
|
||||||
while ((netif = esp_netif_next(netif)) != NULL) {
|
while ((netif = esp_netif_next(netif)) != NULL) {
|
||||||
|
#endif
|
||||||
if (counter == index) {
|
if (counter == index) {
|
||||||
return netif;
|
return netif;
|
||||||
}
|
}
|
||||||
@ -124,7 +128,11 @@ static int get_esp_netif_index(esp_netif_t *esp_netif)
|
|||||||
{
|
{
|
||||||
esp_netif_t *netif = NULL;
|
esp_netif_t *netif = NULL;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||||
|
while ((netif = esp_netif_next_unsafe(netif)) != NULL) {
|
||||||
|
#else
|
||||||
while ((netif = esp_netif_next(netif)) != NULL) {
|
while ((netif = esp_netif_next(netif)) != NULL) {
|
||||||
|
#endif
|
||||||
if (esp_netif == netif) {
|
if (esp_netif == netif) {
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user