comparison reverse/README.rst @ 57:d77cd888a2f2 default tip

We should say something about how to return from the bulk function.
author Sjoerd Mullender <sjoerd@acm.org>
date Thu, 24 Mar 2022 18:37:39 +0100
parents 68263b10998e
children
comparison
equal deleted inserted replaced
56:8122094c79b1 57:d77cd888a2f2
434 bn->tnokey[0] = bn->tnokey[1] = 0; 434 bn->tnokey[0] = bn->tnokey[1] = 0;
435 435
436 Note also that the function ``BUNappend`` maintains the property flags 436 Note also that the function ``BUNappend`` maintains the property flags
437 as best it can. That is why in the example we didn't need to do 437 as best it can. That is why in the example we didn't need to do
438 anything with the property flags. 438 anything with the property flags.
439
440 Returning the Result
441 --------------------
442
443 When the return BAT has been created and filled, it needs to be
444 returned. This is done by assigning the BAT id to the space the result
445 pointer points to. In addition, we need to deal with the reference
446 counting mentioned before. The input BAT's reference that we got from
447 ``BATdescriptor`` should be released with ``BBPunfix`` and one physical
448 reference to the new BAT needs to be converted to one logical reference.
449 This is done by a call to BBPkeepref. And finally, the function should
450 return and indicate that no errors occurred. This is done by returning
451 the value ``MAL_SUCCEED`` (which is just a ``NULL`` pointer).
452
453 .. code-block:: c
454
455 BBPunfix(b->batCacheid);
456 BBPkeepref(bn->batCacheid);
457 *retval = bn->batCacheid;
458 return MAL_SUCCEED;
439 459
440 Informing the Server 460 Informing the Server
441 -------------------- 461 --------------------
442 462
443 So far we have created the necessary C code that can be called by the 463 So far we have created the necessary C code that can be called by the