diff options
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/util_tdb.c | 4 | ||||
-rw-r--r-- | lib/util/util_tdb.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c index 02c7095f66..0c30d7774d 100644 --- a/lib/util/util_tdb.c +++ b/lib/util/util_tdb.c @@ -46,6 +46,10 @@ bool tdb_data_equal(TDB_DATA t1, TDB_DATA t2) return (memcmp(t1.dptr, t2.dptr, t1.dsize) == 0); } +bool tdb_data_is_empty(TDB_DATA d) { + return (d.dsize == 0) || (d.dptr == NULL); +} + TDB_DATA string_tdb_data(const char *string) { return make_tdb_data((const uint8_t *)string, string ? strlen(string) : 0 ); diff --git a/lib/util/util_tdb.h b/lib/util/util_tdb.h index 2d805d7d20..3d03b990c2 100644 --- a/lib/util/util_tdb.h +++ b/lib/util/util_tdb.h @@ -27,6 +27,7 @@ ****************************************************************/ TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize); bool tdb_data_equal(TDB_DATA t1, TDB_DATA t2); +bool tdb_data_is_empty(TDB_DATA d); TDB_DATA string_tdb_data(const char *string); TDB_DATA string_term_tdb_data(const char *string); |