Re: Dealing with long lines
Stephen Gildea <[email protected]> Mon, 30 Jun 2025 20:26:43 -0700
| Newsgroups | gmane.mail.nmh.devel |
|---|---|
| Message-ID | <[email protected]> |
Ken Hornstein <[email protected]> wrote: > Stephen's recent emails has made me thinking about something that has bugged > me for some time: long lines. > > ... > > This suggests to me that netsec_readline() could be modified in two > ways: > > - Add a flag that says, "Always read a full line, no matter what, and > allocate whatever memory is required to do so". > > - Return a flag that indicates whether or not you got a full line. I had come to the same conclusion, and this is the interface that my patch of 24 November provides. In that patch, I introduce a new function 'netsec_readline_or_part' that has the same arguments as 'netsec_readline' plus one new argument, 'int *partial_line_status'. If that new argument is passed as a NULL pointer, it is your "always read a full line" flag. (In my patch, I do not implement the "no matter what" part, because I do not expect to be called with this flag to read the body of a message, where such long lines have been seen to occur.) If that argument is passed as a non-NULL pointer, then the function stores there a flag that indicates what part of a line it read. < Stephen