nuttx/libs/libc/misc
chenrun1 a1ccf15e39 idr:Tool for associating discrete ids with addresses
This is a tool for associating discrete IDs with addresses.
This tool is implemented through the red-black tree method provided by <sys/tree.h>, and the time complexity when calling, searching, and deleting is optimized to O(logn)
The implementation is the moving node operation of two red-black trees
1. When applying for a node, it will first check whether there is an available node in the "removed" tree. If so, the memory address of the node will be reused and moved to the "alloced" tree.
2. If the "removed" tree is an "empty tree", then the node will be requested from the memory and added to the "alloced" tree
3. Similarly, when removing a node, we set the address pointed to in the node to "NULL" and move it to the "removed" tree. Next time we alloc the node, we can reduce the overhead caused by memory application
For now, we still have something that can be optimized, and that is the memory elimination mechanism of the "removed tree". The current implementation will only release all the content under the "removed" tree when the idtree is destroyed.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
..
CMakeLists.txt idr:Tool for associating discrete ids with addresses 2024-08-19 11:05:40 -03:00
Kconfig libc/uname: Add option to disable uname timestamp 2024-03-23 11:42:22 +08:00
lib_crc8.c
lib_crc8ccitt.c
lib_crc8table.c
lib_crc16.c
lib_crc16ccitt.c
lib_crc32.c
lib_crc64.c
lib_cxx_initialize.c
lib_debug.c
lib_dumpbuffer.c
lib_dumpvbuffer.c
lib_envpath.c
lib_err.c libc: Change errno to set_errno and get_errno 2023-10-29 17:16:09 +02:00
lib_execinfo.c libc/execinfo: extract a common backtrace format function 2024-06-29 22:44:39 +08:00
lib_fchmodat.c
lib_fdcheck.c fdcheck: fix race condition in fdcheck 2024-08-18 10:27:03 -03:00
lib_fdsan.c fdcheck: Enable fdcheck to automatically detect ownership of fd 2024-03-07 09:08:48 +08:00
lib_fnmatch.c
lib_fstatat.c
lib_ftok.c
lib_getfullpath.c
lib_getrandom.c
lib_glob.c libc: Change errno to set_errno and get_errno 2023-10-29 17:16:09 +02:00
lib_idr.c idr:Tool for associating discrete ids with addresses 2024-08-19 11:05:40 -03:00
lib_impure.c
lib_instrument.c libc: add instrument api support 2023-12-11 02:06:51 -08:00
lib_kbddecode.c
lib_kbdencode.c
lib_log2ceil.c libs/log2ceil: Move implementation of log2ceil to a common place 2023-12-14 08:46:12 -08:00
lib_log2floor.c libs/log2ceil: Move implementation of log2ceil to a common place 2023-12-14 08:46:12 -08:00
lib_mallopt.c libc/mallopt: implement dummy mallopt 2023-09-07 23:11:10 +08:00
lib_memfd.c lib_memfd: turn a runtime error into a linker error 2023-10-11 23:39:37 +08:00
lib_memoryregion.c coredump: support coredump save to block device when crash 2023-12-10 07:02:03 -08:00
lib_mkdirat.c
lib_mkfifo.c
lib_mknod.c
lib_mutex.c sched/semaphore: Move cancel point and errno handling to libc / user-space 2023-11-27 04:52:54 -08:00
lib_ncompress.c
lib_openat.c
lib_slcddecode.c lib_slcd: fix encode/decode of binary nibble to/from ascii hex 2023-12-10 21:54:01 -08:00
lib_slcdencode.c lib_slcd: fix encode/decode of binary nibble to/from ascii hex 2023-12-10 21:54:01 -08:00
lib_tea_decrypt.c
lib_tea_encrypt.c
lib_uadd32x64.c
lib_uadd64.c
lib_umask.c
lib_umul32.c
lib_umul32x64.c
lib_umul64.c
lib_usub64.c
lib_usub64x32.c
lib_utimensat.c
lib_utsname.c libc/uname: Add option to disable uname timestamp 2024-03-23 11:42:22 +08:00
lib_xorshift128.c
Make.defs idr:Tool for associating discrete ids with addresses 2024-08-19 11:05:40 -03:00