ldb error codes
metze at samba.org
Mon Oct 31 07:37:26 GMT 2005
On Mon, Oct 31, 2005 at 11:58:20AM +1100, tridge at samba.org wrote:
> So I have a few possible proposals for fixing this:
> 1) change the sign of the LDB_ERR* values, and make all functions
> then return a ldb error value. For ldb_search() if the value is >=
> 0 then its a search count, if its < 0 then its an error code. Not
> pretty, but requires very little code modification.
enum's can't take negative values on AIX, so we would need to fallback
to defines, and gdb won't display the error names...
> 2) change ldb_search() to only return a error code, and add a
> ldb_count_messages() function. This requires changing all existing
> calls to ldb_search(). We'd also have to ensure that all backends
> NULL terminate the result list, as otherwise ldb_count_messages()
> would not be possible to implemenet.
I don't really like this, as we need to calculate the message count twice,
and when we have 1000 messages it would be 1000 cpu cycles in the for()-loop
per request, I think we should avoid this, even when modern hardware should be fast for this.
> 3) we could have a ldb_errorcode() function that returns the last
> error code.
I think that would be the easiest solution, and I would like to use it.
More information about the samba-technical