stream: replace the stream function pointer with a macro

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2022-11-25 17:19:45 +08:00 committed by Xiang Xiao
parent 511070c300
commit 377bf97613
5 changed files with 33 additions and 33 deletions

View file

@ -61,7 +61,7 @@
static int elf_flush(FAR struct elf_dumpinfo_s *cinfo)
{
return cinfo->stream->flush(cinfo->stream);
return lib_stream_flush(cinfo->stream);
}
/****************************************************************************
@ -81,7 +81,7 @@ static int elf_emit(FAR struct elf_dumpinfo_s *cinfo,
while (total > 0)
{
ret = cinfo->stream->puts(cinfo->stream, ptr, total);
ret = lib_stream_puts(cinfo->stream, ptr, total);
if (ret < 0)
{
break;

View file

@ -247,17 +247,17 @@ static int readstream(FAR struct lib_instream_s *instream,
/* Skip until the beginning of line start code is encountered */
ch = instream->get(instream);
ch = lib_stream_getc(instream);
while (ch != RECORD_STARTCODE && ch != EOF)
{
ch = instream->get(instream);
ch = lib_stream_getc(instream);
}
/* Skip over the startcode */
if (ch != EOF)
{
ch = instream->get(instream);
ch = lib_stream_getc(instream);
}
/* Then read, verify, and buffer until the end of line is encountered */
@ -286,7 +286,7 @@ static int readstream(FAR struct lib_instream_s *instream,
/* Read the next character from the input stream */
ch = instream->get(instream);
ch = lib_stream_getc(instream);
}
/* Some error occurred: Unexpected EOF, line too long, or bad character in
@ -563,7 +563,7 @@ int hex2bin(FAR struct lib_instream_s *instream,
if (address != expected)
{
off_t pos = outstream->seek(outstream,
off_t pos = lib_stream_seek(outstream,
address - baseaddr, SEEK_SET);
if (pos == (off_t)-1)
{

View file

@ -139,7 +139,7 @@ int kbd_decode(FAR struct lib_instream_s *stream,
/* No, ungotten characters. Check for the beginning of an ESC sequence. */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream */
@ -163,7 +163,7 @@ int kbd_decode(FAR struct lib_instream_s *stream,
/* Check for ESC-[ */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream. Return the escape character now. We will
@ -189,7 +189,7 @@ int kbd_decode(FAR struct lib_instream_s *stream,
/* Get and verify the special keyboard data to decode */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream. Unget everything and return the ESC character.
@ -216,7 +216,7 @@ int kbd_decode(FAR struct lib_instream_s *stream,
/* Check for the final semicolon */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream. Unget everything and return the ESC character.

View file

@ -177,7 +177,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream,
/* No, ungotten characters. Get the next character from the buffer. */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream (or perhaps an I/O error) */
@ -201,7 +201,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream,
/* Get the next character from the buffer */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream. Return the escape character now. We will
@ -230,7 +230,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream,
/* Get the next character from the buffer */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream. Return the ESC now; return the following
@ -278,7 +278,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream,
/* Get the next character from the buffer */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream. Return the ESC now; return the following
@ -311,7 +311,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream,
/* Get the next character from the buffer */
ch = stream->get(stream);
ch = lib_stream_getc(stream);
if (ch == EOF)
{
/* End of file/stream. Return the ESC now; return the following

View file

@ -256,7 +256,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
/* Get first character, we keep always the next character in c */
c = obj->get(obj);
c = lib_stream_getc(obj);
while (fmt_char(fmt))
{
@ -266,7 +266,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
{
while (isspace(c))
{
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
@ -366,7 +366,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
while (isspace(c))
{
c = obj->get(obj);
c = lib_stream_getc(obj);
}
/* But we only perform the data conversion is we still have
@ -390,7 +390,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
}
fwidth++;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
if (!noassign)
@ -445,7 +445,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
}
fwidth++;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
if (!fwidth)
@ -509,7 +509,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
}
fwidth++;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
if (fwidth != width)
@ -582,7 +582,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
while (isspace(c))
{
c = obj->get(obj);
c = lib_stream_getc(obj);
}
/* But we only perform the data conversion if we still have
@ -641,7 +641,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
if (!stopconv)
{
tmp[fwidth++] = c;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
@ -691,7 +691,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
if (!stopconv)
{
tmp[fwidth++] = c;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
@ -716,7 +716,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
if (!stopconv)
{
tmp[fwidth++] = c;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
@ -741,7 +741,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
if (!stopconv)
{
tmp[fwidth++] = c;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
@ -796,7 +796,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
if (!stopconv)
{
tmp[fwidth++] = c;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
break;
@ -954,7 +954,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
while (isspace(c))
{
c = obj->get(obj);
c = lib_stream_getc(obj);
}
/* But we only perform the data conversion is we still have
@ -1038,7 +1038,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
if (!stopconv)
{
tmp[fwidth++] = c;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
@ -1168,7 +1168,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
}
else
{
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
@ -1188,7 +1188,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
while (isspace(c))
{
c = obj->get(obj);
c = lib_stream_getc(obj);
}
#endif
@ -1201,7 +1201,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
else
{
fmt++;
c = obj->get(obj);
c = lib_stream_getc(obj);
}
}
else