[prev in list] [next in list] [prev in thread] [next in thread]
List: libusb-devel
Subject: Re: [Libusb-devel] [PATCH 15/37] log functions can be called before
From: "Michael Plante" <michael.plante () gmail ! com>
Date: 2010-05-27 18:56:13
Message-ID: HKEDKEEGPPEOHLHHEPEDOEENCHAA.michael.plante () gmail ! com
[Download RAW message or body]
Daniel Drake wrote:
>> The interesting point you raise is that you can't control the log level
>> of the code that runs in the initialization path. The solution might be
>> simple: add a libusb_init() variant which takes a log level as a
>> parameter, basically combining _init and _set_debug into a single call.
That would be fine by me. Something like (sans the appropriate
visibility&export attributes):
static inline int libusb_init(libusb_context **context) {
return libusb_init_with_level(context, -1);
}
int libusb_init_with_level(libusb_context **context, int debug_level) {
// ... old stuff ...
if (dbg) {
ctx->debug = atoi(dbg);
if (ctx->debug)
ctx->debug_fixed = 1;
}
+ else if(debug_level >= 0) {
+ ctx->debug = debug_level;
+ }
// ... old stuff ...
}
I am also open to reversing the "else if" and "if" above (i.e., to ignoring
the env var in certain cases). FWIW, I have not tried compiling the above.
Regards,
Michael
------------------------------------------------------------------------------
_______________________________________________
Libusb-devel mailing list
Libusb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic