All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] slirp: Remove unused code for bad sprintf
@ 2010-11-15 20:15 Stefan Weil
  2010-11-21 15:21 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2010-11-15 20:15 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Blue Swirl

Neither DECLARE_SPRINTF nor BAD_SPRINTF are needed for QEMU.

QEMU won't support systems with missing or bad declarations
for sprintf. The unused code was detected while looking for
functions with missing format checking. Instead of adding
GCC_FMT_ATTR, the unused code was removed.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 slirp/misc.c         |   42 ------------------------------------------
 slirp/slirp.h        |   14 --------------
 slirp/slirp_config.h |    6 ------
 3 files changed, 0 insertions(+), 62 deletions(-)

diff --git a/slirp/misc.c b/slirp/misc.c
index 1aeb401..19dbec4 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -264,48 +264,6 @@ void lprint(const char *format, ...)
     va_end(args);
 }
 
-#ifdef BAD_SPRINTF
-
-#undef vsprintf
-#undef sprintf
-
-/*
- * Some BSD-derived systems have a sprintf which returns char *
- */
-
-int
-vsprintf_len(string, format, args)
-	char *string;
-	const char *format;
-	va_list args;
-{
-	vsprintf(string, format, args);
-	return strlen(string);
-}
-
-int
-#ifdef __STDC__
-sprintf_len(char *string, const char *format, ...)
-#else
-sprintf_len(va_alist) va_dcl
-#endif
-{
-	va_list args;
-#ifdef __STDC__
-	va_start(args, format);
-#else
-	char *string;
-	char *format;
-	va_start(args);
-	string = va_arg(args, char *);
-	format = va_arg(args, char *);
-#endif
-	vsprintf(string, format, args);
-	return strlen(string);
-}
-
-#endif
-
 void
 u_sleep(int usec)
 {
diff --git a/slirp/slirp.h b/slirp/slirp.h
index 462292d..dfd977a 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -237,20 +237,6 @@ void if_start(Slirp *);
 void if_start(struct ttys *);
 #endif
 
-#ifdef BAD_SPRINTF
-# define vsprintf vsprintf_len
-# define sprintf sprintf_len
- extern int vsprintf_len(char *, const char *, va_list);
- extern int sprintf_len(char *, const char *, ...);
-#endif
-
-#ifdef DECLARE_SPRINTF
-# ifndef BAD_SPRINTF
- extern int vsprintf(char *, const char *, va_list);
-# endif
- extern int vfprintf(FILE *, const char *, va_list);
-#endif
-
 #ifndef HAVE_STRERROR
  extern char *strerror(int error);
 #endif
diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h
index f19c703..18db45c 100644
--- a/slirp/slirp_config.h
+++ b/slirp/slirp_config.h
@@ -85,9 +85,6 @@
 /* Define if the machine is big endian */
 //#undef HOST_WORDS_BIGENDIAN
 
-/* Define if your sprintf returns char * instead of int */
-#undef BAD_SPRINTF
-
 /* Define if you have readv */
 #undef HAVE_READV
 
@@ -97,9 +94,6 @@
 #define DECLARE_IOVEC
 #endif
 
-/* Define if a declaration of sprintf/fprintf is needed */
-#undef DECLARE_SPRINTF
-
 /* Define if you have a POSIX.1 sys/wait.h */
 #undef HAVE_SYS_WAIT_H
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] slirp: Remove unused code for bad sprintf
  2010-11-15 20:15 [Qemu-devel] [PATCH] slirp: Remove unused code for bad sprintf Stefan Weil
@ 2010-11-21 15:21 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2010-11-21 15:21 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Blue Swirl, QEMU Developers

On 11/15/2010 02:15 PM, Stefan Weil wrote:
> Neither DECLARE_SPRINTF nor BAD_SPRINTF are needed for QEMU.
>
> QEMU won't support systems with missing or bad declarations
> for sprintf. The unused code was detected while looking for
> functions with missing format checking. Instead of adding
> GCC_FMT_ATTR, the unused code was removed.
>
> Cc: Blue Swirl<blauwirbel@gmail.com>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
>    

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   slirp/misc.c         |   42 ------------------------------------------
>   slirp/slirp.h        |   14 --------------
>   slirp/slirp_config.h |    6 ------
>   3 files changed, 0 insertions(+), 62 deletions(-)
>
> diff --git a/slirp/misc.c b/slirp/misc.c
> index 1aeb401..19dbec4 100644
> --- a/slirp/misc.c
> +++ b/slirp/misc.c
> @@ -264,48 +264,6 @@ void lprint(const char *format, ...)
>       va_end(args);
>   }
>
> -#ifdef BAD_SPRINTF
> -
> -#undef vsprintf
> -#undef sprintf
> -
> -/*
> - * Some BSD-derived systems have a sprintf which returns char *
> - */
> -
> -int
> -vsprintf_len(string, format, args)
> -	char *string;
> -	const char *format;
> -	va_list args;
> -{
> -	vsprintf(string, format, args);
> -	return strlen(string);
> -}
> -
> -int
> -#ifdef __STDC__
> -sprintf_len(char *string, const char *format, ...)
> -#else
> -sprintf_len(va_alist) va_dcl
> -#endif
> -{
> -	va_list args;
> -#ifdef __STDC__
> -	va_start(args, format);
> -#else
> -	char *string;
> -	char *format;
> -	va_start(args);
> -	string = va_arg(args, char *);
> -	format = va_arg(args, char *);
> -#endif
> -	vsprintf(string, format, args);
> -	return strlen(string);
> -}
> -
> -#endif
> -
>   void
>   u_sleep(int usec)
>   {
> diff --git a/slirp/slirp.h b/slirp/slirp.h
> index 462292d..dfd977a 100644
> --- a/slirp/slirp.h
> +++ b/slirp/slirp.h
> @@ -237,20 +237,6 @@ void if_start(Slirp *);
>   void if_start(struct ttys *);
>   #endif
>
> -#ifdef BAD_SPRINTF
> -# define vsprintf vsprintf_len
> -# define sprintf sprintf_len
> - extern int vsprintf_len(char *, const char *, va_list);
> - extern int sprintf_len(char *, const char *, ...);
> -#endif
> -
> -#ifdef DECLARE_SPRINTF
> -# ifndef BAD_SPRINTF
> - extern int vsprintf(char *, const char *, va_list);
> -# endif
> - extern int vfprintf(FILE *, const char *, va_list);
> -#endif
> -
>   #ifndef HAVE_STRERROR
>    extern char *strerror(int error);
>   #endif
> diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h
> index f19c703..18db45c 100644
> --- a/slirp/slirp_config.h
> +++ b/slirp/slirp_config.h
> @@ -85,9 +85,6 @@
>   /* Define if the machine is big endian */
>   //#undef HOST_WORDS_BIGENDIAN
>
> -/* Define if your sprintf returns char * instead of int */
> -#undef BAD_SPRINTF
> -
>   /* Define if you have readv */
>   #undef HAVE_READV
>
> @@ -97,9 +94,6 @@
>   #define DECLARE_IOVEC
>   #endif
>
> -/* Define if a declaration of sprintf/fprintf is needed */
> -#undef DECLARE_SPRINTF
> -
>   /* Define if you have a POSIX.1 sys/wait.h */
>   #undef HAVE_SYS_WAIT_H
>
>    

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-21 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-15 20:15 [Qemu-devel] [PATCH] slirp: Remove unused code for bad sprintf Stefan Weil
2010-11-21 15:21 ` Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.