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

Passing auxil to PCC_DEBUG #53

Closed
masatake opened this issue Oct 23, 2021 · 3 comments
Closed

Passing auxil to PCC_DEBUG #53

masatake opened this issue Oct 23, 2021 · 3 comments

Comments

@masatake
Copy link
Contributor

To control what should be printed or not in PCC_DEBUG definition, I would like to pass auxil to the definition of PCC_DEBUG.

#define PCC_DEBUG(event, rule, level, pos, buffer, length) baseDebug(event, rule, level, pos, buffer, length)
static void baseDebug(int event, const char *rule, size_t level, size_t pos, const char *buffer, size_t len)
{
	if (strcmp(rule, "Identifier") != 0)
		return;

PCC_DEBUG can print too many things. In the example, the rule is examined to limit the output only about "Identifier".
In the example, I have to do hardcode ("Identifier").

What I would like to do:

PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) baseDebug(auxil, event, rule, level, pos, buffer, length)

static void baseDebug(struct parserCtx *auxil, int event, const char *rule, size_t level, size_t pos, const char *buffer, size_t len)
{
       if (!isMember(parserCtx->debug_rules_dict, rule))
		return;

PCC_DEBUG is already explained in the README file. So I wonder whether extending it is acceptable or not.

@arithy
Copy link
Owner

arithy commented Oct 23, 2021

Yes, I agree with your request.
I was aware of lack of auxil argument only in this macro.
I'll do this modification and add a notice to README soon.

arithy added a commit that referenced this issue Oct 23, 2021
@arithy
Copy link
Owner

arithy commented Oct 23, 2021

@masatake, please try it.

@masatake
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants