Skip to content

Commit 6ea45a7

Browse files
franklinschbontoJR
andcommitted
Initial commit for open source
Co-authored-by: Junior Bontognali <[email protected]>
1 parent 991180d commit 6ea45a7

File tree

10 files changed

+49
-250
lines changed

10 files changed

+49
-250
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
/*.xcodeproj
5+
xcuserdata/

Package.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// swift-tools-version:4.2
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "CLMDB",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "CLMDB",
12+
targets: ["CLMDB"]),
13+
],
14+
dependencies: [
15+
// Dependencies declare other packages that this package depends on.
16+
// .package(url: /* package url */, from: "1.0.0"),
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
21+
.target(
22+
name: "CLMDB",
23+
dependencies: []),
24+
]
25+
)

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# CLMDB
2+
3+
CLMDB is a SwiftPM package wrapper for [LMDB](http://www.lmdb.tech/doc/), a key-value database storage solution created for fast read and write processes. You can read more about this project at: <http://www.lmdb.tech/doc>.
4+
5+
This wrapper provides exposure of the library's C interfaces to Swift, allowing a Swift application or service to easily create, read, and manage database instances of LMDB.
6+
7+
Changes in LMDB will be pulled into this repository as the upstream project evolves. The LMDB repository is mirrored here: <https://github.com/LMDB/lmdb>.
8+
9+
## License
10+
11+
The included LMDB database project is released under [The OpenLDAP Public License](https://git.openldap.org/openldap/openldap/-/blob/mdb.master/libraries/liblmdb/LICENSE). This same license applies to the Swift code included in this repository.

Sources/CLMDB/include/lmdb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../libraries/liblmdb/lmdb.h

Sources/CLMDB/mdb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../libraries/liblmdb/mdb.c

Sources/CLMDB/midl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../libraries/liblmdb/midl.c

Sources/CLMDB/midl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../libraries/liblmdb/midl.h

libraries/liblmdb/CHANGES

Lines changed: 0 additions & 248 deletions
This file was deleted.

libraries/liblmdb/mdb_dump.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ static void text(MDB_val *v)
6464
end = c + v->mv_size;
6565
while (c < end) {
6666
if (isprint(*c)) {
67+
if (*c == '\\')
68+
putchar('\\');
6769
putchar(*c);
6870
} else {
6971
putchar('\\');

libraries/liblmdb/mdb_load.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,16 @@ static int readline(MDB_val *out, MDB_val *buf)
236236
while (c2 < end) {
237237
if (*c2 == '\\') {
238238
if (c2[1] == '\\') {
239-
c1++; c2 += 2;
239+
*c1++ = *c2;
240240
} else {
241241
if (c2+3 > end || !isxdigit(c2[1]) || !isxdigit(c2[2])) {
242242
Eof = 1;
243243
badend();
244244
return EOF;
245245
}
246246
*c1++ = unhex(++c2);
247-
c2 += 2;
248247
}
248+
c2 += 2;
249249
} else {
250250
/* copies are redundant when no escapes were used */
251251
*c1++ = *c2++;

0 commit comments

Comments
 (0)