Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use new module macros in docs #2100

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/writingmodules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -974,26 +974,26 @@ to the module's variables, or additional data stored in the ``data`` field of
``YR_OBJECT`` structures as discussed earlier in
:ref:`storing-data-for-later-use`. But for that we need a way to get access to
the corresponding ``YR_OBJECT`` first. There are two functions to do that:
``module()`` and ``parent()``. The ``module()`` function returns a pointer to
``yr_module()`` and ``yr_parent()``. The ``yr_module()`` function returns a pointer to
the top-level ``YR_OBJECT`` corresponding to the module, the same one passed
to the ``module_load`` function. The ``parent()`` function returns a pointer to
to the ``module_load`` function. The ``yr_parent()`` function returns a pointer to
the ``YR_OBJECT`` corresponding to the structure where the function is
contained. For example, consider the following code snippet:

.. code-block:: c

define_function(f1)
{
YR_OBJECT* module = module();
YR_OBJECT* parent = parent();
YR_OBJECT* module = yr_module();
YR_OBJECT* parent = yr_parent();

// parent == module;
}

define_function(f2)
{
YR_OBJECT* module = module();
YR_OBJECT* parent = parent();
YR_OBJECT* module = yr_module();
YR_OBJECT* parent = yr_parent();

// parent != module;
}
Expand Down Expand Up @@ -1026,4 +1026,4 @@ you get a pointer to the ``YR_SCAN_CONTEXT`` structure:

.. code-block:: c

YR_SCAN_CONTEXT* context = scan_context();
YR_SCAN_CONTEXT* context = yr_scan_context();
Loading