Changeset: 28dfae9db91c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=28dfae9db91c
Modified Files:
        MonetDB/src/gdk/gdk_bat.mx
Branch: Oct2010
Log Message:

Fixed some minor issues found by Coverity.
We should use the result of BATmaterializet().
Avoid sprintf.
Removed dead code.


diffs (36 lines):

diff -r d234eba0dc22 -r 28dfae9db91c MonetDB/src/gdk/gdk_bat.mx
--- a/MonetDB/src/gdk/gdk_bat.mx        Thu Jan 13 14:07:09 2011 +0100
+++ b/MonetDB/src/gdk/gdk_bat.mx        Thu Jan 13 15:55:06 2011 +0100
@@ -1497,7 +1497,7 @@
                        b->tseqbase = bm->hseqbase = *(oid *) t;
                } else if (b->ttype == TYPE_void && b->tseqbase != oid_nil) {
                        if (*(oid *) t == oid_nil) {
-                               BATmaterializet(b);
+                               b = BATmaterializet(b);
                                countonly = 0;
                                if (b == NULL)
                                        return NULL;
@@ -2421,8 +2421,6 @@
                GDKerror("BATrename: illegal temporary name: '%s'\n", nme);
        } else if (ret == BBPRENAME_LONG) {
                GDKerror("BATrename: name too long: '%s'\n", nme);
-       } else if (b == NULL) {
-               GDKerror("BATrename: BAT argument missing\n");
        }
        return BBPname(b->batCacheid);
 }
@@ -3408,10 +3406,11 @@
                                BAT *bv = VIEWcreate(b, b);
                                Heap *hp = (Heap *) GDKzalloc(sizeof(Heap));
                                str nme = BBP_physical(bv->batCacheid);
-
-                               hp->filename = GDKmalloc(strlen(nme) + 12);
+                               size_t nmelen = strlen(nme);
+
+                               hp->filename = GDKmalloc(nmelen + 12);
                                if (hp->filename != NULL)
-                                       sprintf(hp->filename, "%s.%chash", nme, 
bv->batCacheid > 0 ? 'h' : 't');
+                                       snprintf(hp->filename, nmelen + 12, 
"%s.%chash", nme, bv->batCacheid > 0 ? 'h' : 't');
                                if (hp->filename == NULL ||
                                    (bv->H->hash = HASHnew(hp, tpe, yy + lim, 
HASHmask(lim))) == NULL) {
                                        GDKfree(hp->filename);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to