diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-05-27 16:13:19 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-05-27 16:13:19 +0000 |
commit | 1c841bd2299922375c1b05f9c568d64ae5b5a818 (patch) | |
tree | fa31037abd59549b11ef697ad7eae989df415f6e /cpukit | |
parent | Removed usage of printf. (diff) | |
download | rtems-1c841bd2299922375c1b05f9c568d64ae5b5a818.tar.bz2 |
Split out the routine rtems_assoc_name_bad().
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libcsupport/src/assoc.c | 18 | ||||
-rw-r--r-- | cpukit/libcsupport/src/assocnamebad.c | 37 |
2 files changed, 41 insertions, 14 deletions
diff --git a/cpukit/libcsupport/src/assoc.c b/cpukit/libcsupport/src/assoc.c index 74387a8c5b..5a24bd43a7 100644 --- a/cpukit/libcsupport/src/assoc.c +++ b/cpukit/libcsupport/src/assoc.c @@ -8,7 +8,6 @@ #include <rtems.h> #include "assoc.h" -#include <stdio.h> /* sprintf */ #include <string.h> /* 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] = "<assoc.c: BAD NAME>"; -#endif - return bad_buffer; -} +); + +/* body in separate file to reduce dependency on printf */ const char * diff --git a/cpukit/libcsupport/src/assocnamebad.c b/cpukit/libcsupport/src/assocnamebad.c new file mode 100644 index 0000000000..e336c39cc7 --- /dev/null +++ b/cpukit/libcsupport/src/assocnamebad.c @@ -0,0 +1,37 @@ +/* + * assoc.c + * rtems assoc routines + * + * $Id$ + */ + +#include <rtems.h> +#include "assoc.h" + +#include <stdio.h> /* sprintf */ +#include <string.h> /* 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] = "<assoc.c: BAD NAME>"; +#endif + return bad_buffer; +} + + |