1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: Add tdb_data_equal

This commit is contained in:
Volker Lendecke 2009-12-03 18:43:49 +01:00 committed by Michael Adam
parent a035062f11
commit ebc08b9938
2 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,14 @@ TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize)
return ret;
}
bool tdb_data_equal(TDB_DATA t1, TDB_DATA t2)
{
if (t1.dsize != t2.dsize) {
return false;
}
return (memcmp(t1.dptr, t2.dptr, t1.dsize) == 0);
}
TDB_DATA string_tdb_data(const char *string)
{
return make_tdb_data((const uint8_t *)string, string ? strlen(string) : 0 );

View File

@ -6,6 +6,7 @@
Make a TDB_DATA and keep the const warning in one place
****************************************************************/
TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize);
bool tdb_data_equal(TDB_DATA t1, TDB_DATA t2);
TDB_DATA string_tdb_data(const char *string);
TDB_DATA string_term_tdb_data(const char *string);