Skip to content

Commit adf3dde

Browse files
authored
Updated writingmodules.rst - replaced fetch_data by the new func (#2071)
1 parent 1be9811 commit adf3dde

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/writingmodules.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ checks in your code nevertheless). In those cases you can use the
659659
block = first_memory_block(context);
660660
if (block != NULL)
661661
{
662-
block_data = block->fetch_data(block)
662+
block_data = yr_fetch_block_data(block)
663663
664664
if (block_data != NULL)
665665
{
@@ -668,23 +668,23 @@ checks in your code nevertheless). In those cases you can use the
668668
}
669669
}
670670
671-
In the previous example you can also see how to use the ``fetch_data`` function.
672-
This function, which is a member of the ``YR_MEMORY_BLOCK`` structure, receives
673-
a pointer to the same block (as a ``self`` or ``this`` pointer) and returns a
674-
pointer to the block's data. Your module doesn't own the memory pointed to by
675-
this pointer, freeing that memory is not your responsibility. However keep in
676-
mind that the pointer is valid only until you ask for the next memory block. As
677-
long as you use the pointer within the scope of a ``foreach_memory_block`` you
678-
are on the safe side. Also take into account that ``fetch_data`` can return a
679-
NULL pointer, your code must be prepared for that case.
671+
In the previous example you can also see how to use the ``yr_fetch_block_data``
672+
function. This function receives a pointer to the same block (as a ``self`` or
673+
``this`` pointer) and returns a pointer to the block's data. Your module
674+
doesn't own the memory pointed to by this pointer, freeing that memory is not
675+
your responsibility. However keep in mind that the pointer is valid only until
676+
you ask for the next memory block. As long as you use the pointer within the
677+
scope of a ``foreach_memory_block`` you are on the safe side. Also take into
678+
account that ``yr_fetch_block_data`` can return a NULL pointer, your code must
679+
be prepared for that case.
680680

681681
.. code-block:: c
682682
683683
const uint8_t* block_data;
684684
685685
foreach_memory_block(context, block)
686686
{
687-
block_data = block->fetch_data(block);
687+
block_data = yr_fetch_block_data(block);
688688
689689
if (block_data != NULL)
690690
{

0 commit comments

Comments
 (0)