hrydgard / minitrace

Simple C/C++ library for producing JSON traces suitable for Chrome's built-in trace viewer (about:tracing).
MIT License
370 stars 63 forks source link

Support initializing minitrace with an externally-provided `FILE` stream #13

Closed inequation closed 5 years ago

inequation commented 5 years ago

This is a simple patch that allows passing in an already opened FILE stream from the outside, and reimplements mtr_init() trivially in terms of the new entry point.

Argument type has been picked as void * to avoid polluting the header with all of #include <stdio>. It's a trivial change to include it and use FILE *, but I think void * suits the no-error-checking, you-should-know-what-you're-doing spirit of the library, though.

hrydgard commented 5 years ago

Yeah, why not.