The original code contained rawmemchr for performance reasons. I
would expect the very common strlen routine to be not much worse
performance-wise than rawmemchr. On top, for me this patch simplifies
the expression a bit.
Signed-off-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Jun 14 16:55:58 CEST 2012 on sn-devel-104
if (tdb_data_is_empty(d) || (d.dptr[d.dsize-1] != '\0')) {
return false;
}
- return strchr((char *)d.dptr, '\0') == (char *)&d.dptr[d.dsize-1];
+ return strlen((char *)d.dptr) == d.dsize-1;
}
static char* tdb_data_print(TALLOC_CTX *mem_ctx, TDB_DATA d)