/* readtokens.c -- Functions for reading tokens from an input stream.
- Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2010 Free Software
+ Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2012 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
Written by Jim Meyering. */
-/* This almost supercedes xreadline stuff -- using delim="\n"
+/* This almost supersedes xreadline stuff -- using delim="\n"
gives the same functionality, except that these functions
would never return empty lines. */
All storage is obtained through calls to xmalloc-like functions.
%%% Question: is it worth it to do a single
- %%% realloc() of `tokens' just before returning? */
+ %%% realloc() of 'tokens' just before returning? */
size_t
readtokens (FILE *stream,
*tokens_out = tokens;
if (token_lengths != NULL)
*token_lengths = lengths;
+ else
+ free (lengths);
return n_tokens;
}