2025-02-27 17:59:18 +08:00

69 lines
1.8 KiB
C
Executable File

/* clib.h
*
* Driver Framework v4, C Library Abstraction
*
* This header function guarantees the availability of a select list of
* Standard C APIs. This makes the user of this API compiler independent.
* It also gives a single customization point for these functions.
*/
/*****************************************************************************
* Copyright (c) 2008-2016 INSIDE Secure B.V. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef INCLUDE_GUARD_CLIB_H
#define INCLUDE_GUARD_CLIB_H
/* guaranteed APIs:
memcpy
memmove
memset
memcmp
offsetof
strcmp
*/
/* Note: This is a template. Copy and customize according to your needs! */
#if defined(linux) && defined(MODULE)
#include <linux/string.h> // memmove, memcpy, memset, strcmp
#include <linux/stddef.h> // offsetof
#else
#include <string.h> // memmove, memset, strcmp, etc.
#include <stddef.h> // offsetof
#endif
/* Zero-init macro
*
* _x (input)
* Name of the variable that must be zeroed
*
*/
#define ZEROINIT(_x) memset(&_x, 0, sizeof(_x))
#endif /* Inclusion Guard */
/* end of file clib.h */