diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-08-08 13:43:43 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-08-08 13:44:18 +0100 |
commit | 05d2b9a92cd718a38aed647400159c6c40a743d2 (patch) | |
tree | 9022aaad10ad7d27fbb4f8e673db13a2fc1ecfa9 | |
parent | aa10f2f1efd9e910b675381c7be3d363c019e06a (diff) | |
download | netsurf-05d2b9a92cd718a38aed647400159c6c40a743d2.tar.gz netsurf-05d2b9a92cd718a38aed647400159c6c40a743d2.tar.bz2 |
update urldb dump to use LOG rather than writing to stderr directly
-rw-r--r-- | content/urldb.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/content/urldb.c b/content/urldb.c index 2f7b4a7fc..add0e4bae 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -1343,25 +1343,36 @@ static void urldb_dump_hosts(struct host_part *parent) static void urldb_dump_search(struct search_node *parent, int depth) { const struct host_part *h; - int i; + int i; /* index into string */ + char s[1024]; + int r; if (parent == &empty) return; urldb_dump_search(parent->left, depth + 1); - for (i = 0; i != depth; i++) - fputc(' ', stderr); + for (i = 0; i != depth; i++) { + s[i] = ' '; + } for (h = parent->data; h; h = h->parent) { - if (h->part) - fprintf(stderr, "%s", h->part); + if (h->part) { + r = snprintf(&s[i], (sizeof(s) - 2) - i, "%s", h->part); + if ((i + r) > (sizeof(s) - 2)) { + break; + } + i += r; + } - if (h->parent && h->parent->parent) - fputc('.', stderr); + if (h->parent && h->parent->parent) { + s[i]='.'; + i++; + } } + s[i]= 0; - fputc('\n', stderr); + LOG("%s", s); urldb_dump_search(parent->right, depth + 1); } |