@@ -63,70 +63,6 @@ int prot_from_flags(int flags) _const_;
6363bool in_initrd (void );
6464void in_initrd_force (bool value );
6565
66- void * xbsearch_r (const void * key , const void * base , size_t nmemb , size_t size ,
67- __compar_d_fn_t compar , void * arg );
68-
69- #define typesafe_bsearch_r (k , b , n , func , userdata ) \
70- ({ \
71- const typeof(b[0]) *_k = k; \
72- int (*_func_)(const typeof(b[0])*, const typeof(b[0])*, typeof(userdata)) = func; \
73- xbsearch_r((const void*) _k, (b), (n), sizeof((b)[0]), (__compar_d_fn_t) _func_, userdata); \
74- })
75-
76- /**
77- * Normal bsearch requires base to be nonnull. Here were require
78- * that only if nmemb > 0.
79- */
80- static inline void * bsearch_safe (const void * key , const void * base ,
81- size_t nmemb , size_t size , __compar_fn_t compar ) {
82- if (nmemb <= 0 )
83- return NULL ;
84-
85- assert (base );
86- return bsearch (key , base , nmemb , size , compar );
87- }
88-
89- #define typesafe_bsearch (k , b , n , func ) \
90- ({ \
91- const typeof(b[0]) *_k = k; \
92- int (*_func_)(const typeof(b[0])*, const typeof(b[0])*) = func; \
93- bsearch_safe((const void*) _k, (b), (n), sizeof((b)[0]), (__compar_fn_t) _func_); \
94- })
95-
96- /**
97- * Normal qsort requires base to be nonnull. Here were require
98- * that only if nmemb > 0.
99- */
100- static inline void qsort_safe (void * base , size_t nmemb , size_t size , __compar_fn_t compar ) {
101- if (nmemb <= 1 )
102- return ;
103-
104- assert (base );
105- qsort (base , nmemb , size , compar );
106- }
107-
108- /* A wrapper around the above, but that adds typesafety: the element size is automatically derived from the type and so
109- * is the prototype for the comparison function */
110- #define typesafe_qsort (p , n , func ) \
111- ({ \
112- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \
113- qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
114- })
115-
116- static inline void qsort_r_safe (void * base , size_t nmemb , size_t size , __compar_d_fn_t compar , void * userdata ) {
117- if (nmemb <= 1 )
118- return ;
119-
120- assert (base );
121- qsort_r (base , nmemb , size , compar , userdata );
122- }
123-
124- #define typesafe_qsort_r (p , n , func , userdata ) \
125- ({ \
126- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
127- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
128- })
129-
13066int on_ac_power (void );
13167
13268static inline void _reset_errno_ (int * saved_errno ) {
0 commit comments