Skip to content

Commit

Permalink
Adjust flmdb.c adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jul 20, 2024
1 parent 8c33468 commit 3b0f236
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions libcob/flmdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,12 @@ db_suppresskey (cob_file *f, int idx)
{
unsigned char ch_sprs;
int i,len;
struct indexed_file *p;
struct indexed_file *p = f->file;

if (!f->keys[idx].tf_suppress) {
return 0;
}
ch_sprs = f->keys[idx].char_suppress & 0xFF;
p = f->file;
len = db_savekey(f, p->suppkey, f->record->data, idx);
for (i = 0; i < len; i++) {
if (p->suppkey[i] != ch_sprs)
Expand Down Expand Up @@ -1163,13 +1162,12 @@ lmdb_start (cob_file_api *a, cob_file *f, const int cond, cob_field *key)
static int
lmdb_read (cob_file_api *a, cob_file *f, cob_field *key, const int read_opts)
{
struct indexed_file *p;
struct indexed_file *p = f->file;
int ret;
int db_opts;
int test_lock = 0;

COB_UNUSED (a);
p = f->file;
db_opts = read_opts;

if ((ret = lmdb_start_internal (f, COB_EQ, key, db_opts, test_lock)) != COB_STATUS_00_SUCCESS) {
Expand Down Expand Up @@ -1209,8 +1207,9 @@ lmdb_read_next (cob_file_api *a, cob_file *f, const int read_opts)
if (f->open_mode != COB_OPEN_I_O ||
(f->lock_mode & COB_FILE_EXCLUSIVE)) {
db_opts &= ~COB_READ_LOCK;
} else if ((f->lock_mode & COB_LOCK_AUTOMATIC) &&
!(db_opts & COB_READ_NO_LOCK)) {
} else
if ((f->lock_mode & COB_LOCK_AUTOMATIC) &&
!(db_opts & COB_READ_NO_LOCK)) {
db_opts |= COB_READ_LOCK;
}
unlock_record (f);
Expand Down Expand Up @@ -1290,6 +1289,7 @@ lmdb_read_next (cob_file_api *a, cob_file *f, const int read_opts)

#if 0 /* TODO: Come back and implement locking. */
if (db_env != NULL && !file_changed) {
ret = 0;
if (!(db_opts & COB_READ_IGNORE_LOCK)) {
ret = test_record_lock (f, p->key.mv_data, p->key.mv_size);
if (ret) {
Expand All @@ -1299,7 +1299,7 @@ lmdb_read_next (cob_file_api *a, cob_file *f, const int read_opts)
}
return COB_STATUS_51_RECORD_LOCKED;
}
}
} else
if (db_opts & COB_READ_LOCK) {
ret = lock_record (f, p->key.mv_data, p->key.mv_size);
if (ret) {
Expand Down Expand Up @@ -1413,6 +1413,7 @@ lmdb_read_next (cob_file_api *a, cob_file *f, const int read_opts)

#if 0 /* TODO: Come back and implement locking */
if (db_env != NULL) {
ret = 0;
if (!(db_opts & COB_READ_IGNORE_LOCK)) {
ret = test_record_lock (f, p->key.mv_data, p->key.mv_size);
if (ret) {
Expand All @@ -1424,7 +1425,7 @@ lmdb_read_next (cob_file_api *a, cob_file *f, const int read_opts)
}
return COB_STATUS_51_RECORD_LOCKED;
}
}
} else
if (db_opts & COB_READ_LOCK) {
ret = lock_record (f, p->key.mv_data, p->key.mv_size);
if (ret) {
Expand Down Expand Up @@ -1473,15 +1474,14 @@ lmdb_read_next (cob_file_api *a, cob_file *f, const int read_opts)
static int
lmdb_write (cob_file_api *a, cob_file *f, const int opt)
{
struct indexed_file *p;
struct indexed_file *p = f->file;
int rc = 0;
unsigned int cs = COB_STATUS_00_SUCCESS;

COB_UNUSED (a);
if (f->flag_nonexistent) {
return COB_STATUS_48_OUTPUT_DENIED;
}
p = f->file;

/* Check record key */
db_setkey (f, 0);
Expand Down

0 comments on commit 3b0f236

Please sign in to comment.