bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] Re: [PATCH] getopt, argp - reentrant getopt interface, argp


From: Marcus Brinkmann
Subject: [Bug-gnulib] Re: [PATCH] getopt, argp - reentrant getopt interface, argp fixes
Date: Mon, 08 Mar 2004 14:43:29 +0100
User-agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Sun, 07 Mar 2004 23:07:22 -0800,
Ulrich Drepper wrote:
> Don't move the declarations into include/getopt.h.  Instead create a new
> internal header, getopt_int.h or whatever named.  Move all the internal
> stuff in there.  This means users outside glibc will have to copy along
> another file but that cannot be a problem.

This is certainly the best way to do it.  I put it in
posix/getopt_int.h.  I had to add include/getopt_int.h, too, though,
so that argp/argp-parse.h can include it.  (Including
posix/getopt_int.h from include/getopt.h or including <posix/getopt_int.h>
from argp/argp-parse.c looked wrong to me.)
 
> The patch itself is botch.

Urgh, sorry.

> There should be no need for the global __getopt_initialized variable.

Removed.

> Just always use the value in the struct.  This variable has always been
> internal.  Also, in _getopt_internal() there should be no need to copy
> the variables going into the function.  Check the code all paths whether
> any of the values is being read.  I might miss something but I think
> there are none.

opterr and optind are user input variables that need to be copied.
optind, optarg and optopt are output variables.  I removed all the
other copies.

> I do not worry about the case where the value in the
> global opt* variables gets overwritten with a value from __getopt_data
> even though the latter hasn't been written to in the _getopt_internal_r
> call.
> 
> Aslo, you're using some C99 syntax which probably won't make the gnulib
> people happy.  Look for uses of _GETOPT_DATA_INITIALIZER.

Fixed.

New patch attached.  Hopefully it is converging :)

Thanks!
Marcus

Attachment: libc-argp4.diff
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]