projects
/
platform
/
upstream
/
libusb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
22d61cd
)
Only initialize the default context when it is requested
author
Ludovic Rousseau
<rousseau@debian.org>
Mon, 21 Jun 2010 08:19:29 +0000
(10:19 +0200)
committer
Daniel Drake
<dan@reactivated.net>
Tue, 22 Jun 2010 23:43:44 +0000
(18:43 -0500)
libusb/core.c
patch
|
blob
|
history
diff --git
a/libusb/core.c
b/libusb/core.c
index
f16a05a
..
ac10266
100644
(file)
--- a/
libusb/core.c
+++ b/
libusb/core.c
@@
-1532,15
+1532,15
@@
API_EXPORTED int libusb_init(libusb_context **context)
goto err_destroy_mutex;
}
- if (!usbi_default_context) {
+ if (context) {
+ *context = ctx;
+ } else if (!usbi_default_context) {
usbi_dbg("created default context");
usbi_default_context = ctx;
default_context_refcnt++;
}
usbi_mutex_static_unlock(&default_context_lock);
- if (context)
- *context = ctx;
return 0;
err_destroy_mutex: