Skip to content

Commit 9708b12

Browse files
authored
drop utf8.h (#264)
1 parent 96c3ab5 commit 9708b12

File tree

4 files changed

+17
-1618
lines changed

4 files changed

+17
-1618
lines changed

Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
#
2020

2121
SRC = c_src/sqlite3_nif.c
22-
HEADERS = c_src/utf8.h
2322

2423
CFLAGS = -I"$(ERTS_INCLUDE_DIR)"
2524

2625
ifeq ($(EXQLITE_USE_SYSTEM),)
2726
SRC += c_src/sqlite3.c
28-
HEADERS += c_src/sqlite3.h c_src/sqlite3ext.h
2927
CFLAGS += -Ic_src
3028
else
3129
ifneq ($(EXQLITE_SYSTEM_LDFLAGS),)

c_src/sqlite3_nif.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include <erl_nif.h>
1111
#include <sqlite3.h>
1212

13-
#include "utf8.h"
14-
1513
#define MAX_ATOM_LENGTH 255
1614
#define MAX_PATHNAME 512
1715

@@ -177,7 +175,7 @@ static ERL_NIF_TERM
177175
make_sqlite3_error_tuple(ErlNifEnv* env, int rc, sqlite3* db)
178176
{
179177
const char* msg = get_sqlite3_error_msg(rc, db);
180-
size_t len = utf8len(msg);
178+
size_t len = strlen(msg);
181179

182180
return enif_make_tuple2(
183181
env,
@@ -431,11 +429,11 @@ bind(ErlNifEnv* env, const ERL_NIF_TERM arg, sqlite3_stmt* statement, int index)
431429
}
432430

433431
if (enif_get_atom(env, arg, the_atom, sizeof(the_atom), ERL_NIF_LATIN1)) {
434-
if (0 == utf8cmp("undefined", the_atom) || 0 == utf8cmp("nil", the_atom)) {
432+
if (0 == strcmp("undefined", the_atom) || 0 == strcmp("nil", the_atom)) {
435433
return sqlite3_bind_null(statement, index);
436434
}
437435

438-
return sqlite3_bind_text(statement, index, the_atom, utf8len(the_atom), SQLITE_TRANSIENT);
436+
return sqlite3_bind_text(statement, index, the_atom, strlen(the_atom), SQLITE_TRANSIENT);
439437
}
440438

441439
if (enif_inspect_iolist_as_binary(env, arg, &the_blob)) {
@@ -448,7 +446,7 @@ bind(ErlNifEnv* env, const ERL_NIF_TERM arg, sqlite3_stmt* statement, int index)
448446
}
449447

450448
if (enif_get_atom(env, tuple[0], the_atom, sizeof(the_atom), ERL_NIF_LATIN1)) {
451-
if (0 == utf8ncmp("blob", the_atom, 4)) {
449+
if (0 == strcmp("blob", the_atom)) {
452450
if (enif_inspect_iolist_as_binary(env, tuple[1], &the_blob)) {
453451
return sqlite3_bind_blob(statement, index, the_blob.data, the_blob.size, SQLITE_TRANSIENT);
454452
}
@@ -716,7 +714,7 @@ exqlite_columns(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
716714
return make_error_tuple(env, "out_of_memory");
717715
}
718716

719-
columns[i] = make_binary(env, name, utf8len(name));
717+
columns[i] = make_binary(env, name, strlen(name));
720718
}
721719

722720
result = enif_make_list_from_array(env, columns, size);

0 commit comments

Comments
 (0)