Changeset: 6f2783323ed8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6f2783323ed8 Modified Files: gdk/gdk.h monetdb5/optimizer/opt_pipes.c Branch: resource_management Log Message:
use allocator in opt_pipes diffs (67 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -636,6 +636,7 @@ gdk_export void sa_close( allocator *sa #define MA_ZNEW_ARRAY( sa, type, size ) (type*)sa_zalloc( sa, ((size)*sizeof(type))) #define MA_RENEW_ARRAY( sa, type, ptr, sz, osz ) (type*)sa_realloc( sa, ptr, ((sz)*sizeof(type)), ((osz)*sizeof(type))) #define MA_STRDUP( sa, s) sa_strdup(sa, s) +#define MA_STRNDUP( sa, s, l) sa_strndup(sa, s, l) #if !defined(NDEBUG) && !defined(__COVERITY__) && defined(__GNUC__) diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c --- a/monetdb5/optimizer/opt_pipes.c +++ b/monetdb5/optimizer/opt_pipes.c @@ -306,10 +306,11 @@ addPipeDefinition(Client cntxt, const ch SQLSTATE(42000) "No overwrite of built in allowed"); } + ma_open(cntxt->ta); /* save old value */ oldpipe = pipes[i]; pipes[i] = (struct pipeline) { - .name = GDKstrdup(name), + .name = MA_STRDUP(cntxt->ta, name), }; if (pipes[i].name == NULL) goto bailout; @@ -318,7 +319,7 @@ addPipeDefinition(Client cntxt, const ch p++; n++; } - if ((pipes[i].def = GDKmalloc(n * sizeof(char *))) == NULL) + if ((pipes[i].def = ma_alloc(cntxt->ta, n * sizeof(char *))) == NULL) goto bailout; n = 0; while ((p = strchr(pipe, ';')) != NULL) { @@ -333,7 +334,7 @@ addPipeDefinition(Client cntxt, const ch goto bailout; } if (q > pipe) { - if ((pipes[i].def[n++] = GDKstrndup(pipe, q - pipe)) == NULL) + if ((pipes[i].def[n++] = MA_STRNDUP(cntxt->ta, pipe, q - pipe)) == NULL) goto bailout; } pipe = p + 1; @@ -353,14 +354,16 @@ addPipeDefinition(Client cntxt, const ch for (n = 0; oldpipe.def[n]; n++) GDKfree(oldpipe.def[n]); GDKfree(oldpipe.def); + ma_close(cntxt->ta); return msg; bailout: - GDKfree(pipes[i].name); - if (pipes[i].def) - for (n = 0; pipes[i].def[n]; n++) - GDKfree(pipes[i].def[n]); - GDKfree(pipes[i].def); + //GDKfree(pipes[i].name); + //if (pipes[i].def) + // for (n = 0; pipes[i].def[n]; n++) + // GDKfree(pipes[i].def[n]); + //GDKfree(pipes[i].def); + ma_close(cntxt->ta); pipes[i] = oldpipe; MT_lock_unset(&pipeLock); if (msg) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org