Changeset: ded5d82ed09b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ded5d82ed09b
Modified Files:
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_prelude.c
Branch: Dec2025
Log Message:

Change melFunction's use of fname and comment args.

This saves about 10000 calls to GDKstrdup during startup.

They are now not copied but used as is.  This means that the caller
needs to make sure the args are unchanged for the duration of the
process.  This was done by making the arrays from which they come static
const.


diffs (26 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -77,8 +77,6 @@ freeSymbol(Symbol s)
                freeMalBlk(s->def);
                s->def = NULL;
        } else if (s->allocated && s->func) {
-               GDKfree((char*)s->func->comment);
-               GDKfree((char*)s->func->cname);
                GDKfree(s->func->args);
                GDKfree(s->func);
        }
diff --git a/monetdb5/mal/mal_prelude.c b/monetdb5/mal/mal_prelude.c
--- a/monetdb5/mal/mal_prelude.c
+++ b/monetdb5/mal/mal_prelude.c
@@ -326,8 +326,8 @@ melFunction(bool command, const char *mo
                .argc = argc,
                .args = args,
                .imp = imp,
-               .comment = comment ? GDKstrdup(comment) : NULL,
-               .cname = fname ? GDKstrdup(fname) : NULL,
+               .comment = comment,
+               .cname = fname,
        };
        s->def = NULL;
        s->func = f;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to