first
This commit is contained in:
9
rt-thread/components/utilities/libadt/uthash/SConscript
Normal file
9
rt-thread/components/utilities/libadt/uthash/SConscript
Normal file
@@ -0,0 +1,9 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
group = []
|
||||
|
||||
group = DefineGroup('LIBADT', src, depend = [], CPPPATH = CPPPATH)
|
||||
Return('group')
|
16
rt-thread/components/utilities/libadt/uthash/dict.h
Normal file
16
rt-thread/components/utilities/libadt/uthash/dict.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-11-01 Shell Init ver.
|
||||
*/
|
||||
|
||||
#ifndef __LIBADT_DICT_H__
|
||||
#define __LIBADT_DICT_H__
|
||||
|
||||
#include "rt_uthash.h"
|
||||
|
||||
#endif
|
57
rt-thread/components/utilities/libadt/uthash/rt_uthash.h
Normal file
57
rt-thread/components/utilities/libadt/uthash/rt_uthash.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-11-01 Shell Porting to RTT API
|
||||
*/
|
||||
#ifndef __LIBADT_RT_UTHASH_H__
|
||||
#define __LIBADT_RT_UTHASH_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#define uthash_malloc(sz) rt_malloc(sz)
|
||||
#define uthash_free(ptr, sz) rt_free(ptr)
|
||||
|
||||
/**
|
||||
* for performance consideration, using libc implementations
|
||||
* as the default case. If you care about the compatibility
|
||||
* problem, define the RT_UTHASH_CONFIG_COMPATIBILITY_FIRST
|
||||
* before including the rt_uthash.h.
|
||||
*/
|
||||
#ifndef RT_UTHASH_CONFIG_COMPATIBILITY_FIRST
|
||||
#define uthash_bzero(a, n) memset(a, '\0', n)
|
||||
#define uthash_strlen(s) strlen(s)
|
||||
|
||||
#else
|
||||
#define uthash_bzero(a, n) rt_memset(a, '\0', n)
|
||||
#define uthash_strlen(s) rt_strlen(s)
|
||||
|
||||
#endif /* RT_UTHASH_CONFIG_COMPATIBILITY_FIRST */
|
||||
|
||||
/* if any fatal happen, throw an exception and return a failure */
|
||||
#define uthash_fatal(msg) \
|
||||
do \
|
||||
{ \
|
||||
LOG_E(msg); \
|
||||
return -RT_ENOMEM; \
|
||||
} while (0)
|
||||
|
||||
#include "uthash.h"
|
||||
|
||||
#define DEFINE_RT_UTHASH_TYPE(entry_name, key_type, key_name) \
|
||||
typedef struct entry_name \
|
||||
{ \
|
||||
key_type key_name; \
|
||||
UT_hash_handle hh; \
|
||||
} *entry_name##_t;
|
||||
|
||||
#define RT_UTHASH_ADD(head, key_member, keylen_in, value) \
|
||||
HASH_ADD(hh, head, key_member, keylen_in, value)
|
||||
#define RT_UTHASH_FIND(head, key_ptr, keylen_in, pval) \
|
||||
HASH_FIND(hh, head, key_ptr, keylen_in, pval)
|
||||
#define RT_UTHASH_DELETE(head, pobj) HASH_DELETE(hh, head, pobj)
|
||||
|
||||
#endif /* __LIBADT_RT_UTHASH_H__ */
|
1140
rt-thread/components/utilities/libadt/uthash/uthash.h
Normal file
1140
rt-thread/components/utilities/libadt/uthash/uthash.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user