diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-08-04 19:56:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-08-04 19:56:34 -0700 |
commit | 6a83bc09dbf0ae14e98c891b5a9fd0c424a0e07b (patch) | |
tree | ab446d5c71b26bff85f14876b17d8adb2028cd7b | |
parent | 33d5434aafd847629fc6c70db15d716c77402708 (diff) | |
download | txr-6a83bc09dbf0ae14e98c891b5a9fd0c424a0e07b.tar.gz txr-6a83bc09dbf0ae14e98c891b5a9fd0c424a0e07b.tar.bz2 txr-6a83bc09dbf0ae14e98c891b5a9fd0c424a0e07b.zip |
* stream.c (string_out_put_string): Do not return nil when
buffer calculations overflow, but throw exception.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | stream.c | 6 |
2 files changed, 9 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2015-08-04 Kaz Kylheku <kaz@kylheku.com> + * stream.c (string_out_put_string): Do not return nil when + buffer calculations overflow, but throw exception. + +2015-08-04 Kaz Kylheku <kaz@kylheku.com> + Remove useless return values and checks. * stream.c (vformat_align_pre, vformat_align_post): Change to void @@ -1490,12 +1490,12 @@ static val string_out_put_string(val stream, val str) size_t required_size = len + so->fill + 1; if (required_size < len) - return nil; + goto oflow; while (so->size <= required_size) { so->size *= 2; if (so->size < old_size) - return nil; + goto oflow; } if (so->size != old_size) @@ -1505,6 +1505,8 @@ static val string_out_put_string(val stream, val str) wmemcpy(so->buf + so->fill, s, len + 1); so->fill += len; return t; +oflow: + uw_throw(error_s, lit("string output stream overflow")); } } |