From: Peter Stuge Date: Sun, 21 Oct 2012 23:12:52 +0000 (+0200) Subject: Add struct sr_context to the sr_init() and sr_exit() calls X-Git-Tag: pulseview-0.1.0~223 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=f224292974bed0d34333c5a2158968200e42238c Add struct sr_context to the sr_init() and sr_exit() calls libsigrok.git commit b8072700c1bc7d13ba004fd897668b56cec4ac62 adds struct sr_context to the public API, and changes sr_init() and sr_exit() to take a struct sr_context ** and struct sr_context * parameter respectively. struct sr_context is opaque, and all sr_init() and sr_exit() calls must be balanced. --- diff --git a/main.cpp b/main.cpp index 56b4dd5f..ba6d6645 100644 --- a/main.cpp +++ b/main.cpp @@ -48,6 +48,8 @@ void usage() int main(int argc, char *argv[]) { int ret = 0; + struct sr_context *sr_ctx = NULL; + QApplication a(argc, argv); // Set some application metadata @@ -82,7 +84,7 @@ int main(int argc, char *argv[]) } // Initialise libsigrok - if (sr_init() != SR_OK) { + if (sr_init(&sr_ctx) != SR_OK) { qDebug() << "ERROR: libsigrok init failed."; return 1; } @@ -120,7 +122,8 @@ int main(int argc, char *argv[]) qDebug() << "ERROR: libsigrokdecode init failed."; } - sr_exit(); + if (sr_ctx) + sr_exit(sr_ctx); return ret; }