Re: strfile: new module

2006-05-31 Thread Paul Eggert
Simon Josefsson <[EMAIL PROTECTED]> writes: > I think we should be able to assume free (NULL) works though Yes. To my knowledge the last major system for which the 'free' module was needed was SunOS 4.1.4 aka Solaris 1.1.2. Sun stopped patching SunOS 4.1.4 in 2000 and stopped supporting it in 2

Re: strfile: new module

2006-05-31 Thread Simon Josefsson
Paul Eggert <[EMAIL PROTECTED]> writes: > Looks nice. A couple of comments: > >> + count = fread (buf + size, 1, BUFSIZ, stream); > > BUFSIZ is too small on many systems, for backward compatibility reasons. > Why not change that "BUFSIZ" to "alloc - size - 1"? Done. > Also, for the common

Re: strfile: new module

2006-05-31 Thread Paul Eggert
Looks nice. A couple of comments: > + count = fread (buf + size, 1, BUFSIZ, stream); BUFSIZ is too small on many systems, for backward compatibility reasons. Why not change that "BUFSIZ" to "alloc - size - 1"? Also, for the common case of regular files that you have opened, you can use fst

Re: strfile: new module

2006-05-31 Thread Simon Josefsson
Simon Josefsson <[EMAIL PROTECTED]> writes: > Hmmm. I've made the same mistake before. I'll see how hard it would > be to write a tool that will "prepare" additions of a gnulib module, > for one it should run indent on the files, and then run 'cvs > --new-file diff' on the modules file, and the

Re: strfile: new module

2006-05-31 Thread Simon Josefsson
Simon Josefsson <[EMAIL PROTECTED]> writes: > I like this, and I also like your fread_file function. I will create > a module read-file with two functions fread_file and read_file. Here's the module. Only lighted tested, mostly to get feedback on the approach, but if you agree with it, detailed

Re: strfile: new module

2006-05-31 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote: > /* Read the contents of an input stream, and return it, terminated with a NUL >byte. */ > char* fread_file (FILE* stream) > { How about an interface that provides a length as well as a malloc'd buffer, so that it works also when the file contains NUL b

Re: strfile: new module

2006-05-31 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: >> Index: modules/strfile > > I would call the module 'read-file' and the function 'read_file'. So that it's > possible to add a module 'write_file' if needed, and for consistency with the > 'copy-file' module. I like this, and I also like your fread_file