Skip to content

Commit

Permalink
refactor version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Oct 17, 2021
1 parent cb2b1dd commit fa38b07
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions libmport/create_primative.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "mport.h"
#include "mport_private.h"

static int create_stub_db(sqlite3 **, const char *);
static int create_stub_db(mportInstance *, sqlite3 **, const char *);

static int insert_assetlist(sqlite3 *, mportAssetList *, mportPackageMeta *, mportCreateExtras *);

Expand Down Expand Up @@ -76,7 +76,7 @@ mport_create_primative(mportInstance *mport, mportAssetList *assetlist, mportPac
goto CLEANUP;
}

if ((error_code = create_stub_db(&db, tmpdir)) != MPORT_OK)
if ((error_code = create_stub_db(mport, &db, tmpdir)) != MPORT_OK)
goto CLEANUP;

if ((error_code = insert_assetlist(db, assetlist, pack, extra)) != MPORT_OK)
Expand All @@ -100,7 +100,7 @@ mport_create_primative(mportInstance *mport, mportAssetList *assetlist, mportPac


static int
create_stub_db(sqlite3 **db, const char *tmpdir)
create_stub_db(mportInstance *mport, sqlite3 **db, const char *tmpdir)
{
int error_code = MPORT_OK;

Expand All @@ -115,7 +115,7 @@ create_stub_db(sqlite3 **db, const char *tmpdir)
return error_code;

/* create tables */
return mport_generate_stub_schema(*db);
return mport_generate_stub_schema(mport, *db);
}

static int
Expand Down
2 changes: 1 addition & 1 deletion libmport/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ mport_detach_stub_db(sqlite3 *db)
RETURN_CURRENT_ERROR

int
mport_generate_stub_schema(sqlite3 *db)
mport_generate_stub_schema(mportInstance *mport, sqlite3 *db)
{
char *ptr;
char *sql;
Expand Down
4 changes: 2 additions & 2 deletions libmport/merge_primative.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ MPORT_PUBLIC_API int mport_merge_primative(const char **filenames, const char *o
* When this function is done, db points to a readonly sqlite object representing
* the merged db.
*/
static int build_stub_db(sqlite3 **db, const char *tmpdir, const char *dbfile, const char **filenames, struct table_entry **table)
static int build_stub_db(mportInstance *mport, sqlite3 **db, const char *tmpdir, const char *dbfile, const char **filenames, struct table_entry **table)
{
char *tmpdbfile;
const char *name;
Expand All @@ -144,7 +144,7 @@ static int build_stub_db(sqlite3 **db, const char *tmpdir, const char *dbfile,
if (sqlite3_open(dbfile, db) != SQLITE_OK)
RETURN_ERROR(MPORT_ERR_FATAL, sqlite3_errmsg(*db));

if (mport_generate_stub_schema(*db) != MPORT_OK)
if (mport_generate_stub_schema(mport, *db) != MPORT_OK)
RETURN_CURRENT_ERROR;

for (file = *filenames; file != NULL; file = *(++filenames)) {
Expand Down
2 changes: 1 addition & 1 deletion libmport/mport_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int mport_check_preconditions(mportInstance *, mportPackageMeta *, long);

/* schema */
int mport_generate_master_schema(sqlite3 *);
int mport_generate_stub_schema(sqlite3 *);
int mport_generate_stub_schema(mportInstance *, sqlite3 *);
int mport_upgrade_master_schema(sqlite3 *, int);

/* instance */
Expand Down

0 comments on commit fa38b07

Please sign in to comment.