Changeset: 17905c84e025 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/17905c84e025
Modified Files:
        sql/backends/monet5/sql_bincopyfrom.c
Branch: Jul2021
Log Message:

Make assertion cheaper and more correct


diffs (26 lines):

diff --git a/sql/backends/monet5/sql_bincopyfrom.c 
b/sql/backends/monet5/sql_bincopyfrom.c
--- a/sql/backends/monet5/sql_bincopyfrom.c
+++ b/sql/backends/monet5/sql_bincopyfrom.c
@@ -335,10 +335,8 @@ convert_and_validate(char *text)
        if (*r == 0x80 && *(r+1) == 0) {
                // Technically a utf-8 violation, but we treat it as the NULL 
marker
                // GDK does so as well so we can just pass it on.
-               // The following asserts will fail if GDK ever moves to another 
string representation:
-               assert(sizeof(str_nil) == 2);
-               assert(str_nil[0] == 0x80);
-               assert(str_nil[1] == 0);
+               // load_zero_terminated_text() below contains an assert to 
ensure
+               // this remains the case.
                return MAL_SUCCEED;
        }
 
@@ -399,6 +397,9 @@ load_zero_terminated_text(BAT *bat, stre
        str msg = MAL_SUCCEED;
        bstream *bs = NULL;
 
+       // convert_and_validate() above counts on the following property to 
hold:
+       assert(strNil((const char[2]){ 0x80, 0 }));
+
        bs = bstream_create(s, 1 << 20);
        if (bs == NULL) {
                msg = createException(SQL, "sql", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to