mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	 f912a48315
			
		
	
	
		f912a48315
		
	
	
	
	
		
			
			`static const` variables can be computed and initialized at run-time during initialization or the first time a function is called. Change them to `static constexpr` to ensure they are computed at compile-time. This allows some removal of `strlen` because the length of the `StringView` can be used which is pre-computed at compile-time.
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			971 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			971 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Gunnar Beutner <gunnar@beutner.name>
 | |
|  * Copyright (c) 2022, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibC/bits/pthread_forward.h>
 | |
| 
 | |
| static constexpr PthreadFunctions s_functions = {
 | |
|     .pthread_mutex_trylock = pthread_mutex_trylock,
 | |
|     .pthread_mutex_destroy = pthread_mutex_destroy,
 | |
| 
 | |
|     .pthread_mutexattr_init = pthread_mutexattr_init,
 | |
|     .pthread_mutexattr_settype = pthread_mutexattr_settype,
 | |
|     .pthread_mutexattr_destroy = pthread_mutexattr_destroy,
 | |
| 
 | |
|     .pthread_once = pthread_once,
 | |
| 
 | |
|     .pthread_cond_broadcast = pthread_cond_broadcast,
 | |
|     .pthread_cond_init = pthread_cond_init,
 | |
|     .pthread_cond_signal = pthread_cond_signal,
 | |
|     .pthread_cond_wait = pthread_cond_wait,
 | |
|     .pthread_cond_destroy = pthread_cond_destroy,
 | |
|     .pthread_cond_timedwait = pthread_cond_timedwait,
 | |
| };
 | |
| 
 | |
| [[gnu::constructor]] static void forward_pthread_functions()
 | |
| {
 | |
|     __init_pthread_forward(s_functions);
 | |
| }
 |