2022-12-21 11:17:00 +05:30
|
|
|
/*
|
2024-03-06 15:21:10 +08:00
|
|
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
2022-12-21 11:17:00 +05:30
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2024-07-30 16:41:28 +02:00
|
|
|
#warning "This file is deprecated, as __containerof is available via libbsd. To use __containerof, include string.h."
|
2024-03-06 15:21:10 +08:00
|
|
|
|
2022-12-21 11:17:00 +05:30
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2023-04-03 20:31:51 +02:00
|
|
|
#if CONFIG_IDF_TARGET_LINUX && !defined(__containerof)
|
2022-12-21 11:17:00 +05:30
|
|
|
#define __containerof(ptr, type, member) ({ \
|
|
|
|
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
|
|
|
(type *)( (char *)__mptr - offsetof(type,member) );})
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|