tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: adding getdelim(3) and getline(3) to libc
On Sun, 12 Jul 2009, Roy Marples wrote:
> The only issue is that getline collides with quite a few userland bits
> such as ctags and nawk. I propose we change their internal definitons to
> get_line, unless the really implement their own getline(3) and we can
> just remove it.
A couple of months ago, in response to a PR or a mailing list message
about inability to build NetBSD on a host system that ahs POSIX
getline(), I started experimenting with a semantic patch that was
intended to rename getline to mygetline in cases where the usage was
incompatible with POSIX. It almost works but has some issues whose
details I forget.
I am unlikely to continue this work, but I append a copy of the spatch
file in case anybody else wants to pick it up. "spatch" is part of the
devel/coccinelle package. Usage is something like "spatch -sp_file
getline.spatch -dir /usr/src".
--apb (Alan Barrett)
// convert getline() to mygetline() in cases where the argument or return
// types do not match the glibc or POSIX 2008 definition of
//
// ssize_t getline(char ** lineptr, size_t *n, FILE * stream);
//
@ good_decl @
position p;
parameter P1, P2, P3;
@@
ssize_t getline@p(P1, P2, P3);
@ bad_decl @
position p != good_decl.p;
type RETURNTYPE;
parameter list ARGS;
@@
RETURNTYPE
- getline@p
+ mygetline
(ARGS);
@ good_defn @
position p;
parameter P1, P2, P3;
@@
ssize_t getline@p(P1, P2, P3) { ... }
@ bad_defn @
position p != good_defn.p;
type RETURNTYPE;
parameter list ARGS;
@@
RETURNTYPE
- getline@p
+ mygetline
(ARGS) { ... }
@ good_use expression @
position p;
expression E1, E2, E3;
@@
getline@p(E1, E2, E3)
@ bad_use expression @
position p != good_use.p;
expression list ARGS;
@@
- getline@p
+ mygetline
(ARGS)
Home |
Main Index |
Thread Index |
Old Index