NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/60945: libmenu (curses): arguments of new_item function should be constified



>Number:         60945
>Category:       lib
>Synopsis:       libmenu (curses): arguments of new_item function should be constified
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 30 23:00:00 +0000 2026
>Originator:     nia
>Release:        
>Organization:
The CursedBSD Foundation
>Environment:
NetBSD siphon 11.99.9 NetBSD 11.99.9 (SIPHON) #2: Sun Oct 11 21:09:47 CEST 2026  nia@siphon:/encrypt/obj/sys/arch/amd64/compile/SIPHON amd64
>Description:
new_item(3) has the following signature:

ITEM *new_item(char *, char *);

in ncurses it has the following signature:

extern MENU_EXPORT(ITEM *) new_item(const char *, const char *);

The lack of const causes problems because API users probably want to
pass string literals to this function. And then gcc complains that
the const is being discarded.

I don't see why it would need to modify the strings: "new_item()
allocates storage for a new item then copies in the item name
and description for the new item."

libmenu is not part of X/Open Curses, and there's no specification
to go on here. Looks like illumos (i.e. SVR4) libmenu has the same
signature as NetBSD:

extern ITEM *new_item(char *, char *);

Recent decisions made in this field would perhaps indicate we value
compatibility with ncurses over history here.
>How-To-Repeat:

>Fix:




Home | Main Index | Thread Index | Old Index