Skip to content

Conversation

@Kangie
Copy link
Contributor

@Kangie Kangie commented Sep 23, 2024

Explicitly cast regex match to const char **; we don't modify the value once it's set like this; we should be safe.

} else {
if (g->nplus > 0 && m->lastpos == NULL)
m->lastpos = (char **)cli_max_malloc((g->nplus+1) *
m->lastpos = (const char **)cli_max_malloc((g->nplus+1) *
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels like the correct fix is to remove const in the lastpos definition. Check out the warnings in the "Files Changed" tab.

Copy link
Contributor

@val-ms val-ms May 22, 2025

Choose a reason for hiding this comment

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

Well now I'm confused. Now I see issues because sp is declared as const char *sp;
image

It looks like that was intended to be an improvement with an upgrade to the newer version of the regex module as well: 87cdd70

Perhaps we should cast like:

m->lastpos[lev] = (char *)sp;

(and for the second one)

What do you think @Kangie ?

Drop `const` in the `lastpos` definition to resolve
`incompatbile-pointer-types` warnings (errors in modern compilers).

Signed-off-by: Matt Jolly <[email protected]>
@Kangie
Copy link
Contributor Author

Kangie commented May 17, 2025

Fixed, thanks.

@Kangie
Copy link
Contributor Author

Kangie commented May 17, 2025

test failure seems unrelated; it's in rust code.

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

Successfully merging this pull request may close these issues.

2 participants