mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
libs/libc/stdio: Remove unused, non-standard functions lib_sscanf() and lib_sprintf().
This commit is contained in:
@@ -34,16 +34,15 @@
|
||||
############################################################################
|
||||
|
||||
# Add the stdio C files to the build
|
||||
# This first group of C files do not depend on having file descriptors or
|
||||
# C streams.
|
||||
# This first group of C files do not depend on having C streams.
|
||||
|
||||
CSRCS += lib_fileno.c lib_printf.c lib_sprintf.c lib_asprintf.c
|
||||
CSRCS += lib_snprintf.c lib_libsprintf.c lib_vsprintf.c lib_vasprintf.c
|
||||
CSRCS += lib_vsnprintf.c lib_dprintf.c lib_vdprintf.c
|
||||
CSRCS += lib_snprintf.c lib_vsprintf.c lib_vasprintf.c lib_vsnprintf.c
|
||||
CSRCS += lib_dprintf.c lib_vdprintf.c
|
||||
CSRCS += lib_meminstream.c lib_memoutstream.c lib_memsistream.c
|
||||
CSRCS += lib_memsostream.c lib_lowoutstream.c
|
||||
CSRCS += lib_zeroinstream.c lib_nullinstream.c lib_nulloutstream.c
|
||||
CSRCS += lib_sscanf.c lib_vsscanf.c lib_libsscanf.c lib_libnoflush.c
|
||||
CSRCS += lib_sscanf.c lib_vsscanf.c lib_libvscanf.c lib_libnoflush.c
|
||||
CSRCS += lib_libsnoflush.c
|
||||
|
||||
ifeq ($(CONFIG_NANO_PRINTF),y)
|
||||
@@ -62,12 +61,7 @@ CSRCS += lib_libvsprintf.c
|
||||
|
||||
endif
|
||||
|
||||
# The remaining sources files depend upon file descriptors
|
||||
|
||||
CSRCS += lib_rawinstream.c lib_rawoutstream.c lib_rawsistream.c
|
||||
CSRCS += lib_rawsostream.c lib_remove.c
|
||||
|
||||
# And these depend upon both file descriptors and C streams
|
||||
# The remaining sources files depend upon C streams
|
||||
|
||||
ifneq ($(CONFIG_NFILE_STREAMS),0)
|
||||
|
||||
@@ -79,7 +73,9 @@ CSRCS += lib_rdflush.c lib_wrflush.c lib_fputc.c lib_puts.c lib_fputs.c
|
||||
CSRCS += lib_ungetc.c lib_vprintf.c lib_fprintf.c lib_vfprintf.c
|
||||
CSRCS += lib_stdinstream.c lib_stdoutstream.c lib_stdsistream.c
|
||||
CSRCS += lib_stdsostream.c lib_perror.c lib_feof.c lib_ferror.c
|
||||
CSRCS += lib_clearerr.c lib_scanf.c lib_fscanf.c lib_vfscanf.c
|
||||
CSRCS += lib_rawinstream.c lib_rawoutstream.c lib_rawsistream.c
|
||||
CSRCS += lib_rawsostream.c lib_remove.c lib_clearerr.c lib_scanf.c
|
||||
CSRCS += lib_fscanf.c lib_vfscanf.c
|
||||
|
||||
endif
|
||||
|
||||
|
||||
@@ -200,34 +200,15 @@ doexit:
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_sscanf
|
||||
*
|
||||
* Description:
|
||||
* Stream-oriented version of sscanf.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lib_sscanf(FAR struct lib_instream_s *obj, FAR const IPTR char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int count;
|
||||
|
||||
va_start(ap, fmt);
|
||||
count = lib_vsscanf(obj, NULL, fmt, ap);
|
||||
va_end(ap);
|
||||
return count;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_vsscanf
|
||||
* Name: lib_vscanf
|
||||
*
|
||||
* Description:
|
||||
* Stream-oriented version of vsscanf.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lib_vsscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
|
||||
FAR const IPTR char *fmt, va_list ap)
|
||||
int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
|
||||
FAR const IPTR char *fmt, va_list ap)
|
||||
{
|
||||
int c;
|
||||
FAR char *tv;
|
||||
@@ -58,20 +58,20 @@ int vfscanf(FAR FILE *stream, FAR const IPTR char *fmt, va_list ap)
|
||||
|
||||
if (stream)
|
||||
{
|
||||
/* Wrap the stream in a stream object and let lib_vsscanf do the work. */
|
||||
/* Wrap the stream in a stream object and let lib_vscanf do the work. */
|
||||
|
||||
lib_stdinstream(&stdinstream, stream);
|
||||
|
||||
/* Hold the stream semaphore throughout the lib_vsscanf call so that
|
||||
/* Hold the stream semaphore throughout the lib_vscanf call so that
|
||||
* this thread can get its entire message out before being pre-empted by
|
||||
* the next thread.
|
||||
*/
|
||||
|
||||
lib_take_semaphore(stream);
|
||||
|
||||
n = lib_vsscanf(&stdinstream.public, &lastc, fmt, ap);
|
||||
n = lib_vscanf(&stdinstream.public, &lastc, fmt, ap);
|
||||
|
||||
/* The lib_vsscanf function reads always one character more, this
|
||||
/* The lib_vscanf function reads always one character more, this
|
||||
* character needs to be written back.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/stdio/lib_libsprintf.c
|
||||
* libs/libc/stdio/lib_vscanf.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@gnutt.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -37,27 +37,33 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <nuttx/streams.h>
|
||||
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_sprintf
|
||||
****************************************************************************/
|
||||
|
||||
int lib_sprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *fmt,
|
||||
...)
|
||||
int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
|
||||
{
|
||||
va_list ap;
|
||||
int n;
|
||||
struct lib_meminstream_s meminstream;
|
||||
int n;
|
||||
|
||||
/* Let lib_vsprintf do the real work */
|
||||
/* Initialize a memory stream to freadm from the buffer */
|
||||
|
||||
va_start(ap, fmt);
|
||||
n = lib_vsprintf(obj, fmt, ap);
|
||||
va_end(ap);
|
||||
lib_meminstream((FAR struct lib_meminstream_s *)&meminstream, buf,
|
||||
LIB_BUFLEN_UNKNOWN);
|
||||
|
||||
/* Then let lib_vscanf do the real work */
|
||||
|
||||
|
||||
n = lib_vscanf((FAR struct lib_instream_s *)&meminstream.public, NULL,
|
||||
fmt, ap);
|
||||
return n;
|
||||
}
|
||||
Reference in New Issue
Block a user