assume errno

2006-06-16 Thread Eric Blake
OK to apply? These are the last five references within gnulib where we did not assume the existance of errno. lib/ChangeLog: 2006-06-16 Eric Blake <[EMAIL PROTECTED]> * unsetenv.c [!defined errno]: Assume errno.h declares errno. * unicodeio.c [!defined errno]: Likewise.

Re: read-file

2006-06-16 Thread Larry Jones
Simon Josefsson writes: > > I believe the one in glibc does. Also, 1003.1-2004 says malloc should > set errno: But the C Standard doesn't. All the world isn't POSIX. -Larry Jones I don't want to learn this! It's completely irrelevant to my life! -- Calvin

Re: read-file

2006-06-16 Thread Larry Jones
Simon Josefsson writes: > > OTOH, if the EOF marker is already set, should we really continue to > read from the stream? The function may take an already open stream, > that have been read from before. > > Perhaps the function should also test ferror outside of the loop... If either the end-of-

Re: read-file

2006-06-16 Thread Simon Josefsson
[EMAIL PROTECTED] (Larry Jones) writes: > Simon Josefsson writes: >> >> Yup. That's the intention. (Of course, other functions may set errno >> too, if, e.g., malloc or fclose fails.) > > malloc() doesn't set errno, either. I believe the one in glibc does. Also, 1003.1-2004 says malloc should

Re: read-file

2006-06-16 Thread Simon Josefsson
[EMAIL PROTECTED] (Larry Jones) writes: > Simon Josefsson writes: >> >> Looking at the code, it seems it depends on whether feof() return true >> immediately after fopen on a zero-size file. Does the standards says >> anything about this? > > Not explicitly, but there's nothing to suggest that f

Re: read-file

2006-06-16 Thread Larry Jones
Simon Josefsson writes: > > Yup. That's the intention. (Of course, other functions may set errno > too, if, e.g., malloc or fclose fails.) malloc() doesn't set errno, either. -Larry Jones I sure like summer vacation. -- Calvin

Re: read-file

2006-06-16 Thread Larry Jones
Simon Josefsson writes: > > Looking at the code, it seems it depends on whether feof() return true > immediately after fopen on a zero-size file. Does the standards says > anything about this? Not explicitly, but there's nothing to suggest that fopen() can set the end-of-file indicator for the s

Re: read-file

2006-06-16 Thread Simon Josefsson
[EMAIL PROTECTED] (Larry Jones) writes: > Aaron Stone writes: >> >> If I were using a function like this, I'd expect NULL on error (and >> errno set according to fopen), and an empty string if the file is empty. > > Note that the C Standard doesn't require fopen to set errno and > traditional imp

Re: read-file

2006-06-16 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> Is this ready to be installed? > > Yes, it looks good. I installed, with some of Paul's changes. If there are more review or suggestions, we can install that later.

Re: read-file

2006-06-16 Thread Simon Josefsson
Aaron Stone <[EMAIL PROTECTED]> writes: > On Fri, 2006-06-16 at 11:18 -0700, Paul Eggert wrote: >> Simon Josefsson <[EMAIL PROTECTED]> writes: >> >> > + if (buf) >> > +buf[size] = '\0'; >> >> The file reading code returns NULL if the file was empty? But the >> comments makes it sound like

Re: read-file

2006-06-16 Thread Larry Jones
Aaron Stone writes: > > If I were using a function like this, I'd expect NULL on error (and > errno set according to fopen), and an empty string if the file is empty. Note that the C Standard doesn't require fopen to set errno and traditional implementations didn't, at least in some cases. -Larr

Re: read-file

2006-06-16 Thread Simon Josefsson
Paul Eggert <[EMAIL PROTECTED]> writes: > Simon Josefsson <[EMAIL PROTECTED]> writes: > >> + if (buf) >> +buf[size] = '\0'; > > The file reading code returns NULL if the file was empty? But the > comments makes it sound like it will return xstrdup (""), and that > would be more consistent.

Re: read-file

2006-06-16 Thread Aaron Stone
On Fri, 2006-06-16 at 11:18 -0700, Paul Eggert wrote: > Simon Josefsson <[EMAIL PROTECTED]> writes: > > > + if (buf) > > +buf[size] = '\0'; > > The file reading code returns NULL if the file was empty? But the > comments makes it sound like it will return xstrdup (""), and that > would be m

Re: [bug-gnulib] gettext: -lintl if necessary

2006-06-16 Thread Ralf Wildenhues
Hello Paul, * Paul Eggert wrote on Fri, Jun 16, 2006 at 08:01:33PM CEST: > > [...] in coreutils CVS we're using a new gl_IGNORE_UNUSED_LIBRARIES > macro (defined in m4/lib-ignore.m4) that tells the linker to omit > references to libraries that are not actually used (this is the '-z > ignore' opti

Re: read-file

2006-06-16 Thread Paul Eggert
Simon Josefsson <[EMAIL PROTECTED]> writes: > + if (buf) > +buf[size] = '\0'; The file reading code returns NULL if the file was empty? But the comments makes it sound like it will return xstrdup (""), and that would be more consistent. You might also add a test case, to read from /dev/nul

Re: [bug-gnulib] gettext: -lintl if necessary

2006-06-16 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> The gettext module brings in the proper -I's to make gettext calls >> work, but doesn't bring in the library. > > This is normal. We specify the needed libraries for each program and > for each shared library separately. So that,

Re: [bug-gnulib] read-file (was: strfile)

2006-06-16 Thread Bruno Haible
Simon Josefsson wrote: > Is this ready to be installed? Yes, it looks good. Bruno

Re: stdint module rewrite (was: Re: Build CVS (TRUNK) failed.)

2006-06-16 Thread Mark D. Baushke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bruno Haible <[EMAIL PROTECTED]> writes: > Hi Mark, > > > I see the following: > > > > #if 0 > > # ifndef UINT_FAST16_MAX > > # if < 32 > > # define UINT_FAST16_MAX (((1 << ( - 1)) - 1) * 2 + 1) > > # else > > # define UINT_FAST16_MAX (((1U

Re: [bug-gnulib] gettext: -lintl if necessary

2006-06-16 Thread Bruno Haible
Simon Josefsson wrote: > (Sorry if this is a dupe, didn't see it delivered.) > > The gettext module brings in the proper -I's to make gettext calls > work, but doesn't bring in the library. This is normal. We specify the needed libraries for each program and for each shared library separately. So

Re: [bug-gnulib] arpa_inet_h: new module, replaces inet_ntop

2006-06-16 Thread Bruno Haible
Simon Josefsson wrote: > It would replace the > inet_ntop module, and lib/inet_ntop.h would be removed. > > With this, files only need to #include for inet_ntop or > inet_pton, just like it should be. How would this work on platforms which have an already but don't have and don't declare the in

Re: stdint module rewrite (was: Re: Build CVS (TRUNK) failed.)

2006-06-16 Thread Bruno Haible
Hi Mark, > I see the following: > > #if 0 > # ifndef UINT_FAST16_MAX > # if < 32 > # define UINT_FAST16_MAX (((1 << ( - 1)) - 1) * 2 + 1) > # else > # define UINT_FAST16_MAX (((1UL << ( - 1)) - 1) * 2 + 1) > # endif > # endif > #else > > I am not at all certain that all compilers will

read-file (was: strfile)

2006-06-16 Thread Simon Josefsson
The discussion regarding the read-file module (which started out as a 'strfile' module) died down, but I've made some changes. I've tried this on i686-debian and i686-mingw. Is this ready to be installed? Thanks! Index: lib/read-file.c ===

gettext: -lintl if necessary

2006-06-16 Thread Simon Josefsson
(Sorry if this is a dupe, didn't see it delivered.) The gettext module brings in the proper -I's to make gettext calls work, but doesn't bring in the library. On mingw, it isn't sufficient to add -lintl when I use the gnulib library, it has to be specified when the gnulib library is linked. The

Re: stdint module rewrite (was: Re: Build CVS (TRUNK) failed.)

2006-06-16 Thread Mark D. Baushke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Bruno, No values are assigned to some of the BITSIZEOF_* macros in the config.h file: /* Define to the number of bits in type 'int_fast16_t'. */ /* #undef BITSIZEOF_INT_FAST16_T */ /* Define to the number of bits in type 'int_fast32_t'. */ /* #un

arpa_inet_h: new module, replaces inet_ntop

2006-06-16 Thread Simon Josefsson
Here is a module to provide an arpa/inet.h header file, which is useful for mingw. Incidentally, mingw lack both inet_ntop and inet_pon. What do you think about this? It would replace the inet_ntop module, and lib/inet_ntop.h would be removed. With this, files only need to #include for inet_nt

Re: stdint module rewrite

2006-06-16 Thread Ralf Wildenhues
Hello Bruno, * Bruno Haible wrote on Fri, Jun 16, 2006 at 03:08:11PM CEST: > Ralf Wildenhues wrote: > > > > Yes, but that's basically the only part that breaks this way. And only > > one part of the AC_DEFINE_UNQUOTED, namely the part that needs to be > > traceable for autoheader: the AH_TEMPLAT

Re: Fix size_max macro

2006-06-16 Thread Bruno Haible
Here's the fix that I now committed: 2006-06-15 Bruno Haible <[EMAIL PROTECTED]> * size_max.m4 (gl_SIZE_MAX): Make it work also when cross-compiling. *** size_max.m4 11 Jul 2005 11:29:40 - 1.4 --- size_max.m4 16 Jun 2006 13:12:33 - *** *** 1,5 ! # size_max

Re: stdint module rewrite

2006-06-16 Thread Bruno Haible
Simon Josefsson wrote: > >> The essential difference is that the installed "idn-int.h" should work > >> without assuming any config.h symbols, but instead rely on a > >> combination of install-time "guesses" and CPP symbol checks to define > >> the proper uint32_t types for the host and the compile

Re: stdint module rewrite (was: Re: Build CVS (TRUNK) failed.)

2006-06-16 Thread Bruno Haible
Ralf Wildenhues wrote: > > But this way, autoheader didn't recognise the AC_DEFINE_UNQUOTED > > invocations, i.e. in the end, HAVE_INT8_T etc. were not present in > > config.h.in. > > Yes, but that's basically the only part that breaks this way. And only > one part of the AC_DEFINE_UNQUOTED, name

Re: [bug-gnulib] Re: regex.c not 64-bit clean (?)

2006-06-16 Thread Bruno Haible
Eric Blake asked: > Bruno, is it okay to apply this? > > 2006-06-14 Eric Blake <[EMAIL PROTECTED]> > > * ssize_t.m4 (gt_TYPE_SSIZE_T): Work in spite of -Werror. The change is OK. I'm copying it to GNU gettext, where the file comes from. (Although I think that using CPPFLAGS=-Werror is ca