mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
4d629be602
* Users can now use libbsd string.h and sys/cdefs.h functionality (e.g., strlcpy, containerof) on Linux by just including string.h or sys/cdefs.h. In other words, the includes are the same on the Linux target as well as on chips targets (ESP32, etc.). * libbsd linking is done by the linux component (belongs to common components) now instead of handling it separately in each component
27 lines
634 B
C
27 lines
634 B
C
/*
|
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#pragma once
|
|
|
|
/*
|
|
* NOTE: This file is deprecated and will be removed in the future.
|
|
* Use include sys/cdefs.h instead, it will also include
|
|
* the corresponding libbsd header. TODO: IDF-9391
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if CONFIG_IDF_TARGET_LINUX && !defined(__containerof)
|
|
#define __containerof(ptr, type, member) ({ \
|
|
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
|
(type *)( (char *)__mptr - offsetof(type,member) );})
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|