Changeset: d46c6fd82c1c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d46c6fd82c1c
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/mal/mal_exception.c
        monetdb5/mal/mal_exception.h
        monetdb5/mal/mal_session.c
        monetdb5/modules/mal/tablet.c
Branch: default
Log Message:

Remove M5OutOfMemory from the public interface.
Create an expection using createException (or throw) and free it with
freeException.


diffs (86 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1257,7 +1257,6 @@ str JSONvalueArray(json *ret, json *arg)
 str JSONvalueTable(bat *ret, json *j);
 str LIKEsubjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const str 
*esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng 
*estimate);
 str LIKEsubjoin1(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat 
*slid, const bat *srid, const bit *nil_matches, const lng *estimate);
-char *M5OutOfMemory;
 str MACROprocessor(Client cntxt, MalBlkPtr mb, Symbol t);
 int MAL_MAXCLIENTS;
 int MALadmission(lng argclaim, lng hotclaim);
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -43,7 +43,7 @@ isExceptionVariable(str nme){
        return 0;
 }
 
-char *M5OutOfMemory = "Memory allocation failed.";
+static char *M5OutOfMemory = "Memory allocation failed.";
 
 /**
  * Internal helper function for createException and
diff --git a/monetdb5/mal/mal_exception.h b/monetdb5/mal/mal_exception.h
--- a/monetdb5/mal/mal_exception.h
+++ b/monetdb5/mal/mal_exception.h
@@ -53,7 +53,6 @@ mal_export enum malexception  getExceptio
 mal_export str getExceptionPlace(str);
 mal_export str getExceptionMessage(str);
 mal_export void dumpExceptionsToStream(stream *out, str msg);
-mal_export char *M5OutOfMemory;        /* pointer to constant string */
 mal_export void freeException(str);
 
 #include "mal_errors.h"
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -447,8 +447,7 @@ MSserveClient(void *dummy)
                do {
                        do {
                                msg = runScenario(c);
-                               if (msg != MAL_SUCCEED && msg != M5OutOfMemory)
-                                       GDKfree(msg);
+                               freeException(msg);
                                if (c->mode == FINISHCLIENT)
                                        break;
                                resetScenario(c);
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -713,7 +713,7 @@ tablet_error(READERtask *task, lng row, 
                BUNappend(task->cntxt->error_msg, msg, FALSE);
                BUNappend(task->cntxt->error_input, fcn, FALSE);
                if (task->as->error == NULL && (msg == NULL || (task->as->error 
= GDKstrdup(msg)) == NULL))
-                       task->as->error = M5OutOfMemory;
+                       task->as->error = createException(MAL, "sql.copy_from", 
MAL_MALLOC_FAIL);
                if (row != lng_nil)
                        task->rowerror[row]++;
 #ifdef _DEBUG_TABLET_
@@ -725,7 +725,7 @@ tablet_error(READERtask *task, lng row, 
        } else {
                MT_lock_set(&errorlock);
                if (task->as->error == NULL && (msg == NULL || (task->as->error 
= GDKstrdup(msg)) == NULL))
-                       task->as->error = M5OutOfMemory;
+                       task->as->error = createException(MAL, "sql.copy_from", 
MAL_MALLOC_FAIL);
                task->errorcnt++;
                MT_lock_unset(&errorlock);
        }
@@ -908,7 +908,7 @@ SQLinsert_val(READERtask *task, int col,
                        GDKfree(s);
                        buf[sizeof(buf)-1]=0;
                        if (task->as->error == NULL && (task->as->error = 
GDKstrdup(buf)) == NULL)
-                               task->as->error = M5OutOfMemory;
+                               task->as->error = createException(MAL, 
"sql.copy_from", MAL_MALLOC_FAIL);
                        task->rowerror[idx]++;
                        task->errorcnt++;
                        if (BUNappend(task->cntxt->error_row, &row, FALSE) != 
GDK_SUCCEED ||
@@ -1706,7 +1706,7 @@ SQLload_file(Client cntxt, Tablet *as, b
                task->fields[i] = GDKzalloc(sizeof(char *) * task->limit);
                if (task->fields[i] == 0) {
                        if (task->as->error == NULL)
-                               as->error = M5OutOfMemory;
+                               as->error = createException(MAL, 
"sql.copy_from", MAL_MALLOC_FAIL);
                        goto bailout;
                }
 #ifdef MLOCK_TST
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to