[libc-commits] [libc] [libc][tsearch] add tsearch functions (PR #172625)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Thu Jan 29 07:24:16 PST 2026


================
@@ -550,3 +551,18 @@ add_header(EFI_SYSTEM_TABLE
     .EFI_TABLE_HEADER
     .char16_t
 )
+add_header(__action_closure_fn_t 
+  HDR 
+    __action_closure_fn_t.h 
+  DEPENDS 
+    .posix_tnode 
+    .VISIT
+)
+add_header(__action_fn_t 
+  HDR 
+    __action_fn_t.h 
+  DEPENDS 
+    .posix_tnode 
+    .VISIT
+)
+add_header(__free_fn_t HDR __free_fn_t.h)
----------------
SchrodingerZhu wrote:

```
/* Destroy the whole tree, call FREEFCT for each node or leaf.  */
extern void tdestroy (void *__root, __free_fn_t __freefct);

/* Perform linear search for KEY by comparing by COMPAR in an array
   [BASE,BASE+NMEMB*SIZE).  */
extern void *lfind (const void *__key, const void *__base,
                    size_t *__nmemb, size_t __size, __compar_fn_t __compar);

/* Perform linear search for KEY by comparing by COMPAR function in
   array [BASE,BASE+NMEMB*SIZE) and insert entry if not found.  */
extern void *lsearch (const void *__key, void *__base,
                      size_t *__nmemb, size_t __size, __compar_fn_t __compar);
```
Two reasons for these additions:
- These types are in the system library on GNU/Linux.
- Our header generator cannot really handle raw function pointer types.
                      

https://github.com/llvm/llvm-project/pull/172625


More information about the libc-commits mailing list