2017-09-04 22:10:57 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "ipfs/repo/fsrepo/lmdb_cursor.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new lmdb_trans_cursor struct
|
|
|
|
* @returns a newly allocated trans_cursor struct
|
|
|
|
*/
|
|
|
|
struct lmdb_trans_cursor* lmdb_trans_cursor_new() {
|
|
|
|
struct lmdb_trans_cursor* out = (struct lmdb_trans_cursor*) malloc(sizeof(struct lmdb_trans_cursor));
|
|
|
|
if (out != NULL) {
|
2017-09-07 16:05:56 +00:00
|
|
|
out->environment = NULL;
|
2017-09-04 22:10:57 +00:00
|
|
|
out->cursor = NULL;
|
2017-09-07 16:05:56 +00:00
|
|
|
out->parent_transaction = NULL;
|
2017-09-04 22:10:57 +00:00
|
|
|
out->transaction = NULL;
|
|
|
|
out->database = NULL;
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
* Clean up resources from a lmdb_trans_cursor struct
|
|
|
|
* @param in the cursor
|
|
|
|
* @returns true(1)
|
|
|
|
*/
|
|
|
|
int lmdb_trans_cursor_free(struct lmdb_trans_cursor* in) {
|
2017-09-07 16:05:56 +00:00
|
|
|
if (in != NULL) {
|
|
|
|
free(in);
|
|
|
|
}
|
2017-09-04 22:10:57 +00:00
|
|
|
return 1;
|
|
|
|
}
|