Skip to content

Conversation

@wargio
Copy link
Member

@wargio wargio commented Jan 19, 2026

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository.
  • I made sure to follow the project's coding style.
  • I've documented every RZ_API function and struct this PR changes.
  • I've added tests that prove my changes are effective (required for changes to RZ_API).
  • I've updated the Rizin book with the relevant information (if needed).
  • I've used AI tools to generate fully or partially these code changes and I'm sure the changes are not copyrighted by somebody else.

Detailed description

Cleans up RzConfig and implements proper bindings.

@wargio wargio changed the title Refactor rz config Refactor RzConfig Jan 19, 2026
Copy link
Member

@Rot127 Rot127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only checked the main files and hexagon. Looks like a way better architecture now.

Will do a full review later (currently pretty busy).

General request: Please document the high level design somewhere while you still remember the details.

char *name; ///< Variable name
char *desc; ///< Description of the variable
RzList /*<char *>*/ *options; ///< Holds the string options
ut32 flags; ///< define the type of the data via RzConfigNodeFlags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ut32 flags; ///< define the type of the data via RzConfigNodeFlags
ut32 /*RzConfigNodeFlags*/ flags; ///< define the type of the data.


struct rz_config_hold_t {
RzConfig *cfg;
RzVector /* ConfigValue */ variables;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RzVector /* ConfigValue */ variables;
RzVector /*<ConfigValue>*/ variables;

bool lock; ///< When true forbids the add/remove of variables
void *user; ///< Pointer passed to the callbacks (getter, setter, setopt)
RzList /*<RzConfigNode *>*/ *nodes; ///< List of stored variables.
HtSP *ht; ///< HashMap for fast access to the nodes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
HtSP *ht; ///< HashMap for fast access to the nodes.
HtSP *node_index; ///< HashMap for fast access to the nodes.

Why not use only a hash map?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have remove this (and i'm trying to figure it out where to place this) but essentially is to store the nodes in a sorted way, so when you iterate over them you always have the variables sorted.

Copy link
Member

@Rot127 Rot127 Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't rz_list_add_sorted work?

I mean, does it need to be fast? The configs are no hot path.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added sorted method.

}

/**
* \brief Sets the value (type string list) of a given variable of the config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* \brief Sets the value (type string list) of a given variable of the config
* \brief Sets the value (type string list) of a given variable of the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants