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>
#else
#ifdef HAVE_LIBDL
if (name == NULL) {
- Dl_info dlinfo;
- if (dladdr(snd_dlopen, &dlinfo) > 0)
- name = dlinfo.dli_fname;
+ static const char * self = NULL;
+ if (self == NULL) {
+ Dl_info dlinfo;
+ if (dladdr(snd_dlopen, &dlinfo) > 0)
+ self = dlinfo.dli_fname;
+ }
+ name = self;
}
#endif
#endif