Changeset: 63aa098b0d3c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=63aa098b0d3c
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal.h
monetdb5/mal/mal_builder.c
monetdb5/mal/mal_function.c
monetdb5/mal/mal_function.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_module.c
monetdb5/mal/mal_module.h
monetdb5/mal/mal_parser.c
monetdb5/modules/mal/remote.c
monetdb5/optimizer/opt_generator.c
Branch: default
Log Message:
Make InstrRecord.modname and ModuleRecord.name a const char *.
Since that's what they really are.
diffs (300 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
@@ -1195,11 +1195,11 @@ str export_tableRef;
str fcnDefinition(MalBlkPtr mb, InstrPtr p, str s, int flg, str base, size_t
len);
str fetchRef;
int findGDKtype(int type);
-Module findModule(Module scope, str name);
+Module findModule(Module scope, const char *name);
str findRef;
Scenario findScenario(str nme);
-Symbol findSymbol(Module usermodule, str mod, str fcn);
-Symbol findSymbolInModule(Module v, str fcn);
+Symbol findSymbol(Module usermodule, const char *mod, const char *fcn);
+Symbol findSymbolInModule(Module v, const char *fcn);
int findVariable(MalBlkPtr mb, const char *name);
int findVariableLength(MalBlkPtr mb, str name, int len);
str finishRef;
@@ -1245,7 +1245,7 @@ int getLngConstant(MalBlkPtr mb, lng val
MalBlkPtr getMalBlkHistory(MalBlkPtr mb, int idx);
MalBlkPtr getMalBlkOptimized(MalBlkPtr mb, str name);
lng getMemoryClaim(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int i, int flag);
-Module getModule(str nme);
+Module getModule(const char *nme);
void getModuleList(Module **out, int *length);
BAT *getModules(void);
str getName(const char *nme);
@@ -1268,7 +1268,7 @@ lng getUserTime(void);
str getVariableRef;
lng getVolume(MalStkPtr stk, InstrPtr pci, int rd);
int getprofilerlimit(void);
-Module globalModule(str nme);
+Module globalModule(const char *nme);
str grantRef;
str grant_functionRef;
str grant_rolesRef;
@@ -1436,11 +1436,11 @@ InstrPtr newComment(MalBlkPtr mb, const
InstrPtr newExitStmt(MalBlkPtr mb, str nme);
InstrPtr newFcnCall(MalBlkPtr mb, char *mod, char *fcn);
InstrPtr newFcnCallArgs(MalBlkPtr mb, char *mod, char *fcn, int args);
-Symbol newFunction(str mod, str nme, int kind);
-Symbol newFunctionArgs(str mod, str nme, int kind, int args);
+Symbol newFunction(const char *mod, str nme, int kind);
+Symbol newFunctionArgs(const char *mod, str nme, int kind, int args);
MalStkPtr newGlobalStack(int size);
-InstrPtr newInstruction(MalBlkPtr mb, str modnme, str fcnnme);
-InstrPtr newInstructionArgs(MalBlkPtr mb, str modnme, str fcnnme, int args);
+InstrPtr newInstruction(MalBlkPtr mb, const char *modnme, str fcnnme);
+InstrPtr newInstructionArgs(MalBlkPtr mb, const char *modnme, str fcnnme, int
args);
MalBlkPtr newMalBlk(int elements);
int newMalBlkStmt(MalBlkPtr mb, int elements);
Plant newPlant(MalBlkPtr mb);
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -161,7 +161,7 @@ typedef struct {
lng totticks; /* total time spent on this
instruction. */
lng wbytes; /* number of bytes
produced in last instruction */
/* the core admin */
- str modname; /* module context, reference
into namespace */
+ const char *modname; /* module context,
reference into namespace */
str fcnname; /* function name, reference
into namespace */
int argc, retc, maxarg; /* total and result argument count */
int argv[FLEXIBLE_ARRAY_MEMBER]; /* at least a few entries */
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -710,8 +710,8 @@ pushEmptyBAT(MalBlkPtr mb, InstrPtr q, i
{
if (q == NULL)
return NULL;
- getModuleId(q) = getName("bat");
- getFunctionId(q) = getName("new");
+ setModuleId(q, getName("bat"));
+ setFunctionId(q, getName("new"));
q = pushArgument(mb, q, newTypeVariable(mb,TYPE_void));
q = pushArgument(mb, q, newTypeVariable(mb,getBatType(tpe)));
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -18,7 +18,7 @@
#include "mal_namespace.h"
#include "mal_private.h"
-Symbol newFunctionArgs(str mod, str nme, int kind, int args)
+Symbol newFunctionArgs(const char *mod, str nme, int kind, int args)
{
Symbol s;
InstrPtr p;
@@ -49,7 +49,7 @@ Symbol newFunctionArgs(str mod, str nme,
return s;
}
-Symbol newFunction(str mod, str nme, int kind)
+Symbol newFunction(const char *mod, str nme, int kind)
{
return newFunctionArgs(mod, nme, kind, MAXARG);
}
diff --git a/monetdb5/mal/mal_function.h b/monetdb5/mal/mal_function.h
--- a/monetdb5/mal/mal_function.h
+++ b/monetdb5/mal/mal_function.h
@@ -17,8 +17,8 @@
#define getEndScope(L,I) ((L)->var[I].eolife)
#define getBeginScope(L,I) ((L)->var[I].declared)
-mal_export Symbol newFunction(str mod, str nme,int kind);
-mal_export Symbol newFunctionArgs(str mod, str nme, int kind, int args);
+mal_export Symbol newFunction(const char *mod, str nme,int kind);
+mal_export Symbol newFunctionArgs(const char *mod, str nme, int kind, int
args);
mal_export int getPC(MalBlkPtr mb, InstrPtr p);
mal_export Symbol getFunctionSymbol(Module scope, InstrPtr p);
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
@@ -436,7 +436,7 @@ prepareMalBlk(MalBlkPtr mb, str s)
* Allocation of an instruction should always succeed.
*/
InstrPtr
-newInstructionArgs(MalBlkPtr mb, str modnme, str fcnnme, int args)
+newInstructionArgs(MalBlkPtr mb, const char *modnme, str fcnnme, int args)
{
InstrPtr p = NULL;
@@ -466,7 +466,7 @@ newInstructionArgs(MalBlkPtr mb, str mod
}
InstrPtr
-newInstruction(MalBlkPtr mb, str modnme, str fcnnme)
+newInstruction(MalBlkPtr mb, const char *modnme, str fcnnme)
{
return newInstructionArgs(mb, modnme, fcnnme, MAXARG);
}
diff --git a/monetdb5/mal/mal_instruction.h b/monetdb5/mal/mal_instruction.h
--- a/monetdb5/mal/mal_instruction.h
+++ b/monetdb5/mal/mal_instruction.h
@@ -28,7 +28,7 @@
/* Allocation of space assumes a rather exotic number of
* arguments. Access to module and function name are cast in macros to
* prepare for separate name space management. */
-#define getModuleId(P) (P)->modname
+#define getModuleId(P) ((P)->modname)
#define setModuleId(P,S) (P)->modname= S
#define setModuleScope(P,S) do {(P)->modname= (S)==NULL?NULL: (S)->name;}
while (0)
@@ -121,8 +121,8 @@
mal_export void addMalException(MalBlkPtr mb, str msg);
mal_export void mal_instruction_reset(void);
-mal_export InstrPtr newInstruction(MalBlkPtr mb, str modnme, str fcnnme);
-mal_export InstrPtr newInstructionArgs(MalBlkPtr mb, str modnme, str fcnnme,
int args);
+mal_export InstrPtr newInstruction(MalBlkPtr mb, const char *modnme, str
fcnnme);
+mal_export InstrPtr newInstructionArgs(MalBlkPtr mb, const char *modnme, str
fcnnme, int args);
mal_export InstrPtr copyInstruction(InstrPtr p);
mal_export InstrPtr copyInstructionArgs(InstrPtr p, int args);
mal_export void clrInstruction(InstrPtr p);
diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c
--- a/monetdb5/mal/mal_module.c
+++ b/monetdb5/mal/mal_module.c
@@ -119,7 +119,7 @@ mal_module_reset(void)
}
}
-static int getModuleIndex(str name) {
+static int getModuleIndex(const char *name) {
return (int) (strHash(name) % MODULE_HASH_SIZE);
}
@@ -147,7 +147,7 @@ static void addModuleToIndex(Module cur)
moduleIndex[index] = cur;
}
-Module getModule(str name) {
+Module getModule(const char *name) {
int index = getModuleIndex(name);
Module m = moduleIndex[index];
while(m) {
@@ -192,7 +192,7 @@ void freeModuleList(Module* list) {
* Module scope management
* It will contain the symbol table of all globally accessible functions.
*/
-Module globalModule(str nme)
+Module globalModule(const char *nme)
{ Module cur;
// Global modules are not named 'user'
@@ -373,7 +373,7 @@ void deleteSymbol(Module scope, Symbol p
* The 'user' module is an alias for the scope attached
* to the current user.
*/
-Module findModule(Module scope, str name){
+Module findModule(Module scope, const char *name){
Module def = scope;
Module m;
if (name == NULL) return scope;
@@ -396,7 +396,7 @@ Module findModule(Module scope, str name
* The variation on this routine is to dump the definition of
* all matching definitions.
*/
-Symbol findSymbolInModule(Module v, str fcn) {
+Symbol findSymbolInModule(Module v, const char *fcn) {
Symbol s;
if (v == NULL || fcn == NULL) return NULL;
s = v->space[(int)(*fcn)];
@@ -407,7 +407,7 @@ Symbol findSymbolInModule(Module v, str
return NULL;
}
-Symbol findSymbol(Module usermodule, str mod, str fcn) {
+Symbol findSymbol(Module usermodule, const char *mod, const char *fcn) {
Module m = findModule(usermodule, mod);
return findSymbolInModule(m, fcn);
}
diff --git a/monetdb5/mal/mal_module.h b/monetdb5/mal/mal_module.h
--- a/monetdb5/mal/mal_module.h
+++ b/monetdb5/mal/mal_module.h
@@ -16,22 +16,22 @@
typedef struct SCOPEDEF {
struct SCOPEDEF *link; /* module with same index value */
- str name; /* index in namespace */
+ const char *name; /* index in namespace */
Symbol *space; /* type dispatcher table */
int isAtomModule; /* atom module definition ? */
str help; /* short description of module
functionality*/
} *Module, ModuleRecord;
mal_export Module userModule(void);
-mal_export Module globalModule(str nme);
+mal_export Module globalModule(const char *nme);
mal_export Module fixModule(str nme);
-mal_export Module getModule(str nme);
+mal_export Module getModule(const char *nme);
mal_export void freeModule(Module cur);
mal_export void insertSymbol(Module scope, Symbol prg);
mal_export void deleteSymbol(Module scope, Symbol prg);
-mal_export Module findModule(Module scope, str name);
-mal_export Symbol findSymbol(Module usermodule, str mod, str fcn);
-mal_export Symbol findSymbolInModule(Module v, str fcn);
+mal_export Module findModule(Module scope, const char *name);
+mal_export Symbol findSymbol(Module usermodule, const char *mod, const char
*fcn);
+mal_export Symbol findSymbolInModule(Module v, const char *fcn);
mal_export void getModuleList(Module** out, int* length);
mal_export void freeModuleList(Module* list);
mal_export void dumpModules(stream *out);
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1085,7 +1085,8 @@ fcnHeader(Client cntxt, int kind)
{
int l;
malType tpe;
- str fnme, modnme = NULL;
+ str fnme;
+ const char *modnme = NULL;
char ch;
Symbol curPrg;
MalBlkPtr curBlk = 0;
@@ -1263,7 +1264,7 @@ parseCommandPattern(Client cntxt, int ki
MalBlkPtr curBlk = 0;
Symbol curPrg = 0;
InstrPtr curInstr = 0;
- str modnme = NULL;
+ const char *modnme = NULL;
size_t l = 0;
str msg = MAL_SUCCEED;
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -451,7 +451,7 @@ RMTfindconn(connection *ret, const char
static inline str
RMTgetId(char *buf, MalBlkPtr mb, InstrPtr p, int arg) {
InstrPtr f;
- char *mod;
+ const char *mod;
char *var;
str rt;
static ATOMIC_TYPE idtag = ATOMIC_VAR_INIT(0);
diff --git a/monetdb5/optimizer/opt_generator.c
b/monetdb5/optimizer/opt_generator.c
--- a/monetdb5/optimizer/opt_generator.c
+++ b/monetdb5/optimizer/opt_generator.c
@@ -60,7 +60,6 @@ OPTgeneratorImplementation(Client cntxt,
{
InstrPtr p,q, *old, *series;
int i, k, limit, slimit, actions=0;
- str m;
str bteRef = getName("bte");
str shtRef = getName("sht");
str intRef = getName("int");
@@ -138,7 +137,7 @@ OPTgeneratorImplementation(Client cntxt,
// check for use without conversion
for(k = p->retc; k < p->argc; k++)
if( series[getArg(p,k)]){
- m = getModuleId(p);
+ const char *m = getModuleId(p);
setModuleId(p, generatorRef);
typeChecker(cntxt->usermodule, mb, p, i, TRUE);
if(p->typechk == TYPE_UNKNOWN){
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list