projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*** empty log message ***
[gnulib.git]
/
lib
/
readtokens.c
diff --git
a/lib/readtokens.c
b/lib/readtokens.c
index
8830ed7
..
bb42772
100644
(file)
--- a/
lib/readtokens.c
+++ b/
lib/readtokens.c
@@
-1,5
+1,5
@@
/* readtokens.c -- Functions for reading tokens from an input stream.
/* readtokens.c -- Functions for reading tokens from an input stream.
- Copyright (C) 1990-1991, 1999, 2001
Jim Meyering
.
+ Copyright (C) 1990-1991, 1999, 2001
, 2003 Free Software Foundation, Inc
.
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
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
@@
-50,8
+50,7
@@
#include "readtokens.h"
#include "unlocked-io.h"
#include "readtokens.h"
#include "unlocked-io.h"
-void *xmalloc ();
-void *xrealloc ();
+#include "xalloc.h"
#define STREQ(a,b) ((a) == (b) || ((a) && (b) && *(a) == *(b) \
&& strcmp(a, b) == 0))
#define STREQ(a,b) ((a) == (b) || ((a) && (b) && *(a) == *(b) \
&& strcmp(a, b) == 0))
@@
-63,7
+62,7
@@
init_tokenbuffer (tokenbuffer)
token_buffer *tokenbuffer;
{
tokenbuffer->size = INITIAL_TOKEN_LENGTH;
token_buffer *tokenbuffer;
{
tokenbuffer->size = INITIAL_TOKEN_LENGTH;
- tokenbuffer->buffer =
((char *) xmalloc (INITIAL_TOKEN_LENGTH)
);
+ tokenbuffer->buffer =
xmalloc (INITIAL_TOKEN_LENGTH
);
}
/* Read a token from `stream' into `tokenbuffer'.
}
/* Read a token from `stream' into `tokenbuffer'.
@@
-109,11
+108,12
@@
readtoken (FILE *stream,
if (!same_delimiters)
{
const char *t;
if (!same_delimiters)
{
const char *t;
+ unsigned int j;
saved_delim = delim;
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++)
for (t = delim; *t; t++)
- isdelim[(unsigned
int
) *t] = 1;
+ isdelim[(unsigned
char
) *t] = 1;
}
p = tokenbuffer->buffer;
}
p = tokenbuffer->buffer;
@@
-184,8
+184,8
@@
readtokens (FILE *stream,
else
projected_n_tokens = 64;
sz = projected_n_tokens;
else
projected_n_tokens = 64;
sz = projected_n_tokens;
- tokens =
(char **)
xmalloc (sz * sizeof (char *));
- lengths =
(long *)
xmalloc (sz * sizeof (long));
+ tokens = xmalloc (sz * sizeof (char *));
+ lengths = xmalloc (sz * sizeof (long));
init_tokenbuffer (token);
for (;;)
init_tokenbuffer (token);
for (;;)
@@
-195,8
+195,8
@@
readtokens (FILE *stream,
if (n_tokens >= sz)
{
sz *= 2;
if (n_tokens >= sz)
{
sz *= 2;
- tokens =
(char **)
xrealloc (tokens, sz * sizeof (char *));
- lengths =
(long *)
xrealloc (lengths, sz * sizeof (long));
+ tokens = xrealloc (tokens, sz * sizeof (char *));
+ lengths = xrealloc (lengths, sz * sizeof (long));
}
if (token_length < 0)
}
if (token_length < 0)
@@
-206,7
+206,7
@@
readtokens (FILE *stream,
lengths[n_tokens] = -1;
break;
}
lengths[n_tokens] = -1;
break;
}
- tmp =
(char *)
xmalloc ((token_length + 1) * sizeof (char));
+ tmp = xmalloc ((token_length + 1) * sizeof (char));
lengths[n_tokens] = token_length;
tokens[n_tokens] = strncpy (tmp, token->buffer,
(unsigned) (token_length + 1));
lengths[n_tokens] = token_length;
tokens[n_tokens] = strncpy (tmp, token->buffer,
(unsigned) (token_length + 1));