mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Cache libasound.so access in snd_dlopen
Speed up repeated calls to snd_dlopen by caching the path to libasound.so; this reduces the instructions executed by snd_device_name_hint by 40 percent. Signed-off-by: John Lindgren <john.lindgren@tds.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									e1c7dd2613
								
							
						
					
					
						commit
						0bff868580
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								src/dlmisc.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/dlmisc.c
									
										
									
									
									
								
							| 
						 | 
					@ -54,9 +54,13 @@ void *snd_dlopen(const char *name, int mode)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#ifdef HAVE_LIBDL
 | 
					#ifdef HAVE_LIBDL
 | 
				
			||||||
	if (name == NULL) {
 | 
						if (name == NULL) {
 | 
				
			||||||
		Dl_info dlinfo;
 | 
							static const char * self = NULL;
 | 
				
			||||||
		if (dladdr(snd_dlopen, &dlinfo) > 0)
 | 
							if (self == NULL) {
 | 
				
			||||||
			name = dlinfo.dli_fname;
 | 
								Dl_info dlinfo;
 | 
				
			||||||
 | 
								if (dladdr(snd_dlopen, &dlinfo) > 0)
 | 
				
			||||||
 | 
									self = dlinfo.dli_fname;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							name = self;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue