Remove GLib dependency WIP

Add a shim implementing half-assed versions of most of the GLib
functions used by MDB Tools. If GLib is detected at compile-time,
use it, otherwise use the shim.

This work is not complete, as the option-parsing code is not yet
implemented - so most of the command-line tools crash.
This commit is contained in:
Evan Miller
2020-08-03 17:19:40 -04:00
parent a2fa34c0cb
commit e9f4c6c786
14 changed files with 460 additions and 31 deletions

View File

@@ -1,7 +1,16 @@
AUTOMAKE_OPTIONS = subdir-objects
SUBDIRS = bash-completion
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql mdb-ver mdb-prop mdb-count
noinst_PROGRAMS = mdb-import prtable prcat prdata prkkd prdump prole updrow prindex
LIBS = $(GLIB_LIBS) @LIBS@
if !HAVE_GLIB
mdb_export_SOURCES = mdb-export.c ../libmdb/fakeglib.c
mdb_schema_SOURCES = mdb-schema.c ../libmdb/fakeglib.c
mdb_tables_SOURCES = mdb-tables.c ../libmdb/fakeglib.c
mdb_sql_SOURCES = mdb-sql.c ../libmdb/fakeglib.c
mdb_ver_SOURCES = mdb-ver.c ../libmdb/fakeglib.c
mdb_import_SOURCES = mdb-import.c ../libmdb/fakeglib.c
endif
LIBS = $(GLIB_LIBS) @LIBS@
DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
AM_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
LDADD = ../libmdb/libmdb.la

View File

@@ -91,12 +91,12 @@ main(int argc, char **argv)
}
void dump_kkd(MdbHandle *mdb, void *kkd, size_t len)
{
GArray *aprops = mdb_kkd_to_props(mdb, kkd, len);
GPtrArray *aprops = mdb_kkd_to_props(mdb, kkd, len);
int i;
if (!aprops)
return;
for (i=0; i<aprops->len; ++i) {
MdbProperties *props = g_array_index(aprops, MdbProperties*, i);
MdbProperties *props = g_ptr_array_index(aprops, i);
mdb_dump_props(props, stdout, 1);
}
}