svn commit: samba r18436 - in
branches/SAMBA_4_0/source/lib/ldb: common ldb_ildap ldb_sqlite3
ldb_tdb modules tools
simo
idra at samba.org
Wed Sep 13 01:28:05 GMT 2006
On Wed, 2006-09-13 at 00:10 +0000, tridge at samba.org wrote:
> Author: tridge
> Date: 2006-09-13 00:10:38 +0000 (Wed, 13 Sep 2006)
> New Revision: 18436
>
> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18436
>
> Log:
>
> converted ldb to use talloc_move() instead of talloc_steal() when
> appropriate.
>
> Note that I also removed the error checks that were being done on the
> result of talloc_steal(). They are pointless as talloc_steal() doesn't
> have any failure modes that wouldn't cause a segv anyway, and they
> tend to clutter the code
> Modified: branches/SAMBA_4_0/source/lib/ldb/modules/paged_results.c
> ===================================================================
> --- branches/SAMBA_4_0/source/lib/ldb/modules/paged_results.c 2006-09-13 00:05:07 UTC (rev 18435)
> +++ branches/SAMBA_4_0/source/lib/ldb/modules/paged_results.c 2006-09-13 00:10:38 UTC (rev 18436)
> @@ -190,10 +190,7 @@
>
> ac->store->num_entries++;
>
> - ac->store->last->r = talloc_steal(ac->store->last, ares);
> - if (ac->store->last->r == NULL) {
> - goto error;
> - }
> + ac->store->last->r = talloc_move(ac->store->last, ares);
> ac->store->last->next = NULL;
> }
Tridge,
is this really the right case?
I find the fact that talloc_move() is really a macro that transforms the
second argument in a pointer to itself a bit deceiving.
For example in this case you did a:
talloc_move(ac->store->last, ares);
which translates to _talloc_move(ac->store->last, &ares);
Now &ares is just a pointer in the stack as the function is defined as:
static int paged_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares)
So what do we gain by doing it?
Or is there something I don't get and should wait after I digested my
dinner to realized what it is? :-)
Simo.
--
Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org
http://samba.org
More information about the samba-technical
mailing list