Changeset: 4ef3972231a3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4ef3972231a3
Modified Files:
        monetdb5/modules/atoms/str.c
Branch: default
Log Message:

Error checking.


diffs (37 lines):

diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1085,7 +1085,7 @@ struct UTF8_lower_upper {
 
 #define UTF8_CONVERSIONS (sizeof(UTF8_lower_upper) / 
sizeof(UTF8_lower_upper[0]))
 
-static BAT *UTF8_upperBat = NULL, *UTF8_lowerBat;
+static BAT *UTF8_upperBat = NULL, *UTF8_lowerBat = NULL;
 
 str
 strPrelude(void *ret)
@@ -1095,17 +1095,15 @@ strPrelude(void *ret)
                int i = UTF8_CONVERSIONS;
 
                UTF8_upperBat = COLnew(0, TYPE_int, UTF8_CONVERSIONS, 
TRANSIENT);
-               if (UTF8_upperBat == NULL)
-                       return NULL;
                UTF8_lowerBat = COLnew(0, TYPE_int, UTF8_CONVERSIONS, 
TRANSIENT);
-               if (UTF8_lowerBat == NULL) {
-                       BBPreclaim(UTF8_upperBat);
-                       UTF8_upperBat = NULL;
-                       return NULL;
-               }
+               if (UTF8_upperBat == NULL || UTF8_lowerBat == NULL)
+                       goto bailout;
+
                while (--i >= 0) {
-                       BUNappend(UTF8_upperBat, &UTF8_lower_upper[i].upper, 
FALSE);
-                       BUNappend(UTF8_lowerBat, &UTF8_lower_upper[i].lower, 
FALSE);
+                       if (BUNappend(UTF8_upperBat, 
&UTF8_lower_upper[i].upper, FALSE) != GDK_SUCCEED ||
+                               BUNappend(UTF8_lowerBat, 
&UTF8_lower_upper[i].lower, FALSE) != GDK_SUCCEED) {
+                               goto bailout;
+                       }
                }
                if (BBPrename(UTF8_upperBat->batCacheid, 
"monet_unicode_toupper") != 0 ||
                        BBPrename(UTF8_lowerBat->batCacheid, 
"monet_unicode_tolower") != 0) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to