summaryrefslogtreecommitdiff
path: root/libc/misc/assert/__assert.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-12-20 22:52:58 +0000
committerEric Andersen <andersen@codepoet.org>2000-12-20 22:52:58 +0000
commitc6218dbae579de0cd20f5a7f1e9877673e28225d (patch)
tree0fc8aaf54189b8ef6a2d130c12539814e0a724ee /libc/misc/assert/__assert.c
parent97112ff6f4f2a1dcd4c7f8a7512e0a4a02a2a332 (diff)
A number of updates from Manuel Novoa III. Things look good...
Diffstat (limited to 'libc/misc/assert/__assert.c')
-rw-r--r--libc/misc/assert/__assert.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c
index 905671d98..b98958f43 100644
--- a/libc/misc/assert/__assert.c
+++ b/libc/misc/assert/__assert.c
@@ -3,11 +3,24 @@
* under the GNU Library General Public License.
*/
+/*
+ * Manuel Novoa III Dec 2000
+ *
+ * Converted to use my new (un)signed long (long) to string routines, which
+ * are smaller than the previous functions and don't require static buffers.
+ */
+
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
+#include <limits.h>
-extern char *itoa(int);
+#if (INT_MAX >> 31)
+/* We're set up for 32 bit ints */
+#error need to check size allocation for buffer 'buf'
+#endif
+
+extern char *__ltostr(char *buf, unsigned long uval, int base, int uppercase);
static void errput(str)
const char *str;
@@ -21,9 +34,11 @@ const char *filename;
int linenumber;
const char *function;
{
+ char buf[12];
+
errput(filename);
errput(":");
- errput(itoa(linenumber));
+ errput(__ltostr(buf + sizeof(buf) - 1, linenumber, 10, 0));
errput(function ? ": " : "");
errput(function ? function : "");
errput(function ? "() " : "");