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.
This commit is contained in:
Peter Stuge 2012-10-22 01:12:52 +02:00 committed by Joel Holdsworth
parent be03620eb7
commit f224292974
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}