29 lines
809 B
Plaintext
29 lines
809 B
Plaintext
$OpenBSD: patch-src_avl_avl_c,v 1.1 2005/04/16 21:24:15 sturm Exp $
|
|
--- src/avl/avl.c.orig Sat Apr 16 22:03:38 2005
|
|
+++ src/avl/avl.c Sat Apr 16 22:17:52 2005
|
|
@@ -1063,9 +1063,11 @@ typedef struct _link_node {
|
|
static char balance_chars[3] = {'\\', '-', '/'};
|
|
|
|
static int
|
|
-default_key_printer (char * buffer, void * key)
|
|
+default_key_printer (char * buffer, size_t size, void * key)
|
|
{
|
|
- return sprintf (buffer, "%p", key);
|
|
+ snprintf(buffer, size, "%p", key);
|
|
+
|
|
+ return strlen(buffer);
|
|
}
|
|
|
|
/*
|
|
@@ -1108,8 +1110,8 @@ print_node (avl_key_printer_fun_type key
|
|
link_node * link)
|
|
{
|
|
char buffer[256];
|
|
- unsigned int width;
|
|
- width = key_printer (buffer, node->key);
|
|
+ size_t width;
|
|
+ width = key_printer (buffer, sizeof(buffer), node->key);
|
|
|
|
if (node->right) {
|
|
link_node here;
|