X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Freadtokens.c;h=8ae1e070a2154fff4f67548fc35f990448f3a893;hb=e6d58e55d6ac520a2587210d1856d90455fd860e;hp=651b5efb651602f1976af7b4b37f21481d127ba9;hpb=783c1624bd8b027a65b3fba57d3213ccb1a6ddbd;p=gnulib.git diff --git a/lib/readtokens.c b/lib/readtokens.c index 651b5efb6..8ae1e070a 100644 --- a/lib/readtokens.c +++ b/lib/readtokens.c @@ -1,5 +1,5 @@ /* readtokens.c -- Functions for reading tokens from an input stream. - Copyright (C) 1990-1991 Jim Meyering. + Copyright (C) 1990-1991, 1999, 2001 Jim Meyering. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,8 +49,8 @@ #endif /* not STDC_HEADERS and not HAVE_STRING_H */ #include "readtokens.h" -void *xmalloc (); -void *xrealloc (); +#include "unlocked-io.h" +#include "xalloc.h" #define STREQ(a,b) ((a) == (b) || ((a) && (b) && *(a) == *(b) \ && strcmp(a, b) == 0)) @@ -77,11 +77,10 @@ init_tokenbuffer (tokenbuffer) and on files that aren't newline-terminated. */ long -readtoken (stream, delim, n_delim, tokenbuffer) - FILE *stream; - const char *delim; - int n_delim; - token_buffer *tokenbuffer; +readtoken (FILE *stream, + const char *delim, + int n_delim, + token_buffer *tokenbuffer) { char *p; int c, i, n; @@ -109,9 +108,10 @@ readtoken (stream, delim, n_delim, tokenbuffer) if (!same_delimiters) { const char *t; + unsigned int j; saved_delim = delim; - for (i = 0; i < sizeof (isdelim); i++) - isdelim[i] = 0; + for (j = 0; j < sizeof (isdelim); j++) + isdelim[j] = 0; for (t = delim; *t; t++) isdelim[(unsigned int) *t] = 1; } @@ -164,14 +164,12 @@ readtoken (stream, delim, n_delim, tokenbuffer) %%% realloc() of `tokens' just before returning? */ int -readtokens (stream, projected_n_tokens, delim, n_delim, - tokens_out, token_lengths) - FILE *stream; - int projected_n_tokens; - const char *delim; - int n_delim; - char ***tokens_out; - long **token_lengths; +readtokens (FILE *stream, + int projected_n_tokens, + const char *delim, + int n_delim, + char ***tokens_out, + long **token_lengths) { token_buffer tb, *token = &tb; int token_length;