[FDT] Fix POSIX compatibility for string.h (#6923)

* [FDT] Fix POSIX compatibility for string.h

* [FDT] format libfdt code.

* [FDT] format libfdt code.
This commit is contained in:
Bernard Xiong 2023-02-13 16:36:16 +08:00 committed by GitHub
parent 03bcd0701c
commit fc1aced665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 716 additions and 710 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*/

View File

@ -139,6 +139,13 @@
#define FDT_ERR_MAX 17
/* string.h for POSIX compatibility */
#include <string.h>
typedef unsigned int uint;
size_t strnlen (const char *, size_t);
char *strdup (const char *);
char *strchrnul (const char *, int);
/**********************************************************************/
/* Low-level functions (you probably don't need these) */
/**********************************************************************/

View File

@ -1,10 +1,8 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*/
#define _GNU_SOURCE
#include "libfdt.h"
#include "dtb_node.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -189,7 +189,7 @@ const char *dtb_node_get_name(const struct dtb_node *node)
}
struct dtb_node *dtb_node_get_by_phandle(uint phandle)
struct dtb_node *dtb_node_get_by_phandle(uint32_t phandle)
{
if (dtb_node_active())
return dtb_node_find_node_by_phandle(phandle);

View File

@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "libfdt.h"
#include <stdio.h>
#include <unistd.h>
#include "dtb_node.h"