1919import static java .util .Objects .requireNonNull ;
2020import jnr .ffi .Pointer ;
2121import jnr .ffi .byref .PointerByReference ;
22+ import static org .lmdbjava .Library .LIB ;
2223import org .lmdbjava .Library .MDB_envinfo ;
2324import org .lmdbjava .Library .MDB_stat ;
24- import static org .lmdbjava .Library .lib ;
25- import static org .lmdbjava .Library .runtime ;
25+ import static org .lmdbjava .Library .RUNTIME ;
2626import static org .lmdbjava .MaskedFlag .mask ;
2727import static org .lmdbjava .ResultCodeMapper .checkRc ;
2828
@@ -42,7 +42,7 @@ public final class Env implements AutoCloseable {
4242 */
4343 public Env () throws LmdbNativeException {
4444 final PointerByReference envPtr = new PointerByReference ();
45- checkRc (lib .mdb_env_create (envPtr ));
45+ checkRc (LIB .mdb_env_create (envPtr ));
4646 ptr = envPtr .getValue ();
4747 }
4848
@@ -60,7 +60,7 @@ public void close() {
6060 if (!open ) {
6161 return ;
6262 }
63- lib .mdb_env_close (ptr );
63+ LIB .mdb_env_close (ptr );
6464 }
6565
6666 /**
@@ -91,7 +91,7 @@ public void copy(final File path, final CopyFlags... flags) throws
9191 throw new InvalidCopyDestination ("Path must contain no files" );
9292 }
9393 final int flagsMask = mask (flags );
94- checkRc (lib .mdb_env_copy2 (ptr , path .getAbsolutePath (), flagsMask ));
94+ checkRc (LIB .mdb_env_copy2 (ptr , path .getAbsolutePath (), flagsMask ));
9595 }
9696
9797 /**
@@ -111,7 +111,7 @@ public void setMapSize(final int mapSize) throws AlreadyOpenException,
111111 if (closed ) {
112112 throw new AlreadyClosedException ();
113113 }
114- checkRc (lib .mdb_env_set_mapsize (ptr , mapSize ));
114+ checkRc (LIB .mdb_env_set_mapsize (ptr , mapSize ));
115115 }
116116
117117 /**
@@ -131,7 +131,7 @@ public void setMaxDbs(final int dbs) throws AlreadyOpenException,
131131 if (closed ) {
132132 throw new AlreadyClosedException ();
133133 }
134- checkRc (lib .mdb_env_set_maxdbs (ptr , dbs ));
134+ checkRc (LIB .mdb_env_set_maxdbs (ptr , dbs ));
135135 }
136136
137137 /**
@@ -151,7 +151,7 @@ public void setMaxReaders(final int readers) throws AlreadyOpenException,
151151 if (closed ) {
152152 throw new AlreadyClosedException ();
153153 }
154- checkRc (lib .mdb_env_set_maxreaders (ptr , readers ));
154+ checkRc (LIB .mdb_env_set_maxreaders (ptr , readers ));
155155 }
156156
157157 /**
@@ -165,8 +165,8 @@ public EnvInfo info() throws NotOpenException, LmdbNativeException {
165165 if (!open ) {
166166 throw new NotOpenException ();
167167 }
168- final MDB_envinfo info = new MDB_envinfo (runtime );
169- checkRc (lib .mdb_env_info (ptr , info ));
168+ final MDB_envinfo info = new MDB_envinfo (RUNTIME );
169+ checkRc (LIB .mdb_env_info (ptr , info ));
170170
171171 final long mapAddress ;
172172 if (info .me_mapaddr .get () == null ) {
@@ -222,7 +222,7 @@ public void open(final File path, final int mode, final EnvFlags... flags)
222222 throw new AlreadyClosedException ();
223223 }
224224 final int flagsMask = mask (flags );
225- checkRc (lib .mdb_env_open (ptr , path .getAbsolutePath (), flagsMask , mode ));
225+ checkRc (LIB .mdb_env_open (ptr , path .getAbsolutePath (), flagsMask , mode ));
226226 this .open = true ;
227227 }
228228
@@ -237,8 +237,8 @@ public EnvStat stat() throws NotOpenException, LmdbNativeException {
237237 if (!open ) {
238238 throw new NotOpenException ();
239239 }
240- final MDB_stat stat = new MDB_stat (runtime );
241- checkRc (lib .mdb_env_stat (ptr , stat ));
240+ final MDB_stat stat = new MDB_stat (RUNTIME );
241+ checkRc (LIB .mdb_env_stat (ptr , stat ));
242242 return new EnvStat (
243243 stat .ms_psize .intValue (),
244244 stat .ms_depth .intValue (),
@@ -258,7 +258,7 @@ public EnvStat stat() throws NotOpenException, LmdbNativeException {
258258 */
259259 public void sync (final boolean force ) throws LmdbNativeException {
260260 final int f = force ? 1 : 0 ;
261- checkRc (lib .mdb_env_sync (ptr , f ));
261+ checkRc (LIB .mdb_env_sync (ptr , f ));
262262 }
263263
264264 /**
0 commit comments