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

draft: jail_unix: Simplify sub-argument matching #4202

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dridi
Copy link
Member

@dridi dridi commented Sep 26, 2024

TODO: find a name and a home for the ARG_MATCH() macro.

Refs 4001ea2
Refs #4174

TODO: find a name and a home for the ARG_MATCH() macro.

Refs 4001ea2
Refs varnishcache#4174
@dridi dridi marked this pull request as draft September 26, 2024 14:53
Taking inspiration from other languages with a match keyword, replace
the if statement altogether by a pseudo-match statement that populates
a destination variable similar to what FOREACH macros do.
@bsdphk
Copy link
Contributor

bsdphk commented Sep 30, 2024

Needs more work.

I dont like that the strings become unquoted.

Also: strlen() on constant strings is free with all compilers in recent memory.

@dridi
Copy link
Member Author

dridi commented Sep 30, 2024

Requiring an actual quoted string is trivial, but before I proceed, where should this macro live and how should it be named?

@nigoroll
Copy link
Member

Flexelint has comments:

--- Module:   mgt/mgt_jail_unix.c (C)
File mgt/mgt_jail_unix.c, Line 120
                            _
#define _MATCH_ARG(arg, name)   \
    Note 9071: defined macro '_MATCH_ARG' is reserved to the compiler

name: I do not have any better idea

place: next to ARGV_ERR ?

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.

3 participants