From 44adb76799058f8c572ee368b6515423b5eb48b6 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 18 Mar 2007 20:25:18 +0200 Subject: [PATCH] Use add_string_to_string where applicable. --- src/config/conf.c | 4 ++-- src/protocol/common.c | 6 ++---- src/terminal/screen.c | 1 + 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/config/conf.c b/src/config/conf.c index ec3205126..3376e69da 100644 --- a/src/config/conf.c +++ b/src/config/conf.c @@ -767,7 +767,7 @@ create_config_string(unsigned char *prefix, unsigned char *name, smart_config_string(&tmpstring, 2, i18n, options->value.tree, NULL, 0, smart_config_output_fn); if (tmpstring.length > origlen) - add_bytes_to_string(&config, tmpstring.source, tmpstring.length); + add_string_to_string(&config, &tmpstring); done_string(&tmpstring); if (!init_string(&tmpstring)) goto get_me_out; @@ -778,7 +778,7 @@ create_config_string(unsigned char *prefix, unsigned char *name, origlen = tmpstring.length; bind_config_string(&tmpstring); if (tmpstring.length > origlen) - add_bytes_to_string(&config, tmpstring.source, tmpstring.length); + add_string_to_string(&config, &tmpstring); done_string(&tmpstring); get_me_out: diff --git a/src/protocol/common.c b/src/protocol/common.c index d22fd84b1..41807e132 100644 --- a/src/protocol/common.c +++ b/src/protocol/common.c @@ -65,10 +65,8 @@ init_directory_listing(struct string *page, struct uri *uri) && !add_char_to_string(&dirpath, local ? CHAR_DIR_SEP : '/')) goto out_of_memory; - /* Decode uri for displaying. Do not use - * add_string_to_string, because it for some reason returns - * NULL if the second string is empty. */ - if (!add_bytes_to_string(&decoded, dirpath.source, dirpath.length)) + /* Decode uri for displaying. */ + if (!add_string_to_string(&decoded, &dirpath)) goto out_of_memory; decode_uri_string(&decoded); diff --git a/src/terminal/screen.c b/src/terminal/screen.c index f0f096ff6..70d96165f 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -73,6 +73,7 @@ static const unsigned char frame_restrict[48] = { #define TERM_STRING(str) INIT_STRING(str, sizeof(str) - 1) +/* Like add_string_to_string but has fewer checks to slow it down. */ #define add_term_string(str, tstr) \ add_bytes_to_string(str, (tstr).source, (tstr).length)