From 1c841bd2299922375c1b05f9c568d64ae5b5a818 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 27 May 1999 16:13:19 +0000 Subject: Split out the routine rtems_assoc_name_bad(). --- c/src/exec/libcsupport/src/assoc.c | 18 ++++----------- c/src/exec/libcsupport/src/assocnamebad.c | 37 +++++++++++++++++++++++++++++++ c/src/lib/libc/assoc.c | 18 ++++----------- c/src/lib/libc/assocnamebad.c | 37 +++++++++++++++++++++++++++++++ c/src/lib/libmisc/assoc/Makefile.in | 2 +- c/src/lib/libmisc/assoc/assoc.c | 18 ++++----------- c/src/lib/libmisc/assoc/assocnamebad.c | 37 +++++++++++++++++++++++++++++++ c/src/libmisc/assoc/Makefile.in | 2 +- c/src/libmisc/assoc/assoc.c | 18 ++++----------- c/src/libmisc/assoc/assocnamebad.c | 37 +++++++++++++++++++++++++++++++ 10 files changed, 166 insertions(+), 58 deletions(-) create mode 100644 c/src/exec/libcsupport/src/assocnamebad.c create mode 100644 c/src/lib/libc/assocnamebad.c create mode 100644 c/src/lib/libmisc/assoc/assocnamebad.c create mode 100644 c/src/libmisc/assoc/assocnamebad.c (limited to 'c') diff --git a/c/src/exec/libcsupport/src/assoc.c b/c/src/exec/libcsupport/src/assoc.c index 74387a8c5b..5a24bd43a7 100644 --- a/c/src/exec/libcsupport/src/assoc.c +++ b/c/src/exec/libcsupport/src/assoc.c @@ -8,7 +8,6 @@ #include #include "assoc.h" -#include /* sprintf */ #include /* strcat, strcmp */ #define STREQ(a,b) (strcmp((a), (b)) == 0) @@ -135,20 +134,11 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -const char * -rtems_assoc_name_bad( +const char *rtems_assoc_name_bad( unsigned32 bad_value -) -{ -#ifdef RTEMS_DEBUG - static char bad_buffer[32]; - - sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); -#else - static char bad_buffer[32] = ""; -#endif - return bad_buffer; -} +); + +/* body in separate file to reduce dependency on printf */ const char * diff --git a/c/src/exec/libcsupport/src/assocnamebad.c b/c/src/exec/libcsupport/src/assocnamebad.c new file mode 100644 index 0000000000..e336c39cc7 --- /dev/null +++ b/c/src/exec/libcsupport/src/assocnamebad.c @@ -0,0 +1,37 @@ +/* + * assoc.c + * rtems assoc routines + * + * $Id$ + */ + +#include +#include "assoc.h" + +#include /* sprintf */ +#include /* strcat, strcmp */ + +#define STREQ(a,b) (strcmp((a), (b)) == 0) +#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) + +/* + * what to return if a value is not found + * this is not reentrant, but it really shouldn't be invoked anyway + */ + +const char * +rtems_assoc_name_bad( + unsigned32 bad_value +) +{ +#ifdef RTEMS_DEBUG + static char bad_buffer[32]; + + sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif + return bad_buffer; +} + + diff --git a/c/src/lib/libc/assoc.c b/c/src/lib/libc/assoc.c index 74387a8c5b..5a24bd43a7 100644 --- a/c/src/lib/libc/assoc.c +++ b/c/src/lib/libc/assoc.c @@ -8,7 +8,6 @@ #include #include "assoc.h" -#include /* sprintf */ #include /* strcat, strcmp */ #define STREQ(a,b) (strcmp((a), (b)) == 0) @@ -135,20 +134,11 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -const char * -rtems_assoc_name_bad( +const char *rtems_assoc_name_bad( unsigned32 bad_value -) -{ -#ifdef RTEMS_DEBUG - static char bad_buffer[32]; - - sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); -#else - static char bad_buffer[32] = ""; -#endif - return bad_buffer; -} +); + +/* body in separate file to reduce dependency on printf */ const char * diff --git a/c/src/lib/libc/assocnamebad.c b/c/src/lib/libc/assocnamebad.c new file mode 100644 index 0000000000..e336c39cc7 --- /dev/null +++ b/c/src/lib/libc/assocnamebad.c @@ -0,0 +1,37 @@ +/* + * assoc.c + * rtems assoc routines + * + * $Id$ + */ + +#include +#include "assoc.h" + +#include /* sprintf */ +#include /* strcat, strcmp */ + +#define STREQ(a,b) (strcmp((a), (b)) == 0) +#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) + +/* + * what to return if a value is not found + * this is not reentrant, but it really shouldn't be invoked anyway + */ + +const char * +rtems_assoc_name_bad( + unsigned32 bad_value +) +{ +#ifdef RTEMS_DEBUG + static char bad_buffer[32]; + + sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif + return bad_buffer; +} + + diff --git a/c/src/lib/libmisc/assoc/Makefile.in b/c/src/lib/libmisc/assoc/Makefile.in index d10064af13..2374e720eb 100644 --- a/c/src/lib/libmisc/assoc/Makefile.in +++ b/c/src/lib/libmisc/assoc/Makefile.in @@ -18,7 +18,7 @@ VPATH = @srcdir@ LIB=${ARCH}/libassoc-tmp.a # C source names, if any, go here -- minus the .c -C_PIECES=assoc +C_PIECES=assoc assocnamebad C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libmisc/assoc/assoc.c b/c/src/lib/libmisc/assoc/assoc.c index 74387a8c5b..5a24bd43a7 100644 --- a/c/src/lib/libmisc/assoc/assoc.c +++ b/c/src/lib/libmisc/assoc/assoc.c @@ -8,7 +8,6 @@ #include #include "assoc.h" -#include /* sprintf */ #include /* strcat, strcmp */ #define STREQ(a,b) (strcmp((a), (b)) == 0) @@ -135,20 +134,11 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -const char * -rtems_assoc_name_bad( +const char *rtems_assoc_name_bad( unsigned32 bad_value -) -{ -#ifdef RTEMS_DEBUG - static char bad_buffer[32]; - - sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); -#else - static char bad_buffer[32] = ""; -#endif - return bad_buffer; -} +); + +/* body in separate file to reduce dependency on printf */ const char * diff --git a/c/src/lib/libmisc/assoc/assocnamebad.c b/c/src/lib/libmisc/assoc/assocnamebad.c new file mode 100644 index 0000000000..e336c39cc7 --- /dev/null +++ b/c/src/lib/libmisc/assoc/assocnamebad.c @@ -0,0 +1,37 @@ +/* + * assoc.c + * rtems assoc routines + * + * $Id$ + */ + +#include +#include "assoc.h" + +#include /* sprintf */ +#include /* strcat, strcmp */ + +#define STREQ(a,b) (strcmp((a), (b)) == 0) +#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) + +/* + * what to return if a value is not found + * this is not reentrant, but it really shouldn't be invoked anyway + */ + +const char * +rtems_assoc_name_bad( + unsigned32 bad_value +) +{ +#ifdef RTEMS_DEBUG + static char bad_buffer[32]; + + sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif + return bad_buffer; +} + + diff --git a/c/src/libmisc/assoc/Makefile.in b/c/src/libmisc/assoc/Makefile.in index d10064af13..2374e720eb 100644 --- a/c/src/libmisc/assoc/Makefile.in +++ b/c/src/libmisc/assoc/Makefile.in @@ -18,7 +18,7 @@ VPATH = @srcdir@ LIB=${ARCH}/libassoc-tmp.a # C source names, if any, go here -- minus the .c -C_PIECES=assoc +C_PIECES=assoc assocnamebad C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/libmisc/assoc/assoc.c b/c/src/libmisc/assoc/assoc.c index 74387a8c5b..5a24bd43a7 100644 --- a/c/src/libmisc/assoc/assoc.c +++ b/c/src/libmisc/assoc/assoc.c @@ -8,7 +8,6 @@ #include #include "assoc.h" -#include /* sprintf */ #include /* strcat, strcmp */ #define STREQ(a,b) (strcmp((a), (b)) == 0) @@ -135,20 +134,11 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -const char * -rtems_assoc_name_bad( +const char *rtems_assoc_name_bad( unsigned32 bad_value -) -{ -#ifdef RTEMS_DEBUG - static char bad_buffer[32]; - - sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); -#else - static char bad_buffer[32] = ""; -#endif - return bad_buffer; -} +); + +/* body in separate file to reduce dependency on printf */ const char * diff --git a/c/src/libmisc/assoc/assocnamebad.c b/c/src/libmisc/assoc/assocnamebad.c new file mode 100644 index 0000000000..e336c39cc7 --- /dev/null +++ b/c/src/libmisc/assoc/assocnamebad.c @@ -0,0 +1,37 @@ +/* + * assoc.c + * rtems assoc routines + * + * $Id$ + */ + +#include +#include "assoc.h" + +#include /* sprintf */ +#include /* strcat, strcmp */ + +#define STREQ(a,b) (strcmp((a), (b)) == 0) +#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) + +/* + * what to return if a value is not found + * this is not reentrant, but it really shouldn't be invoked anyway + */ + +const char * +rtems_assoc_name_bad( + unsigned32 bad_value +) +{ +#ifdef RTEMS_DEBUG + static char bad_buffer[32]; + + sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif + return bad_buffer; +} + + -- cgit v1.2.3