--- tclBasic.c-orig	2006-07-28 16:48:24.093750000 +0100
+++ tclBasic.c	2006-07-28 16:53:45.531250000 +0100
@@ -200,39 +200,40 @@
  */
 
 typedef struct {
-    CONST char* name;		/* Name of the function */
+    CONST char* tail;		/* The tail name of the function. The full
+                                 * name is "::tcl::mathfunc::<tail>". */
     Tcl_ObjCmdProc* objCmdProc;	/* Function that evaluates the function */
     ClientData clientData;	/* Client data for the function */
 } BuiltinFuncDef;
 static BuiltinFuncDef BuiltinFuncTable[] = {
-    { "::tcl::mathfunc::abs",	ExprAbsFunc,	NULL 			},
-    { "::tcl::mathfunc::acos",	ExprUnaryFunc,	(ClientData) acos 	},
-    { "::tcl::mathfunc::asin",	ExprUnaryFunc,	(ClientData) asin 	},
-    { "::tcl::mathfunc::atan",	ExprUnaryFunc,	(ClientData) atan 	},
-    { "::tcl::mathfunc::atan2",	ExprBinaryFunc,	(ClientData) atan2 	},
-    { "::tcl::mathfunc::bool",	ExprBoolFunc,	NULL			},
-    { "::tcl::mathfunc::ceil",	ExprCeilFunc,	NULL		 	},
-    { "::tcl::mathfunc::cos",	ExprUnaryFunc,	(ClientData) cos 	},
-    { "::tcl::mathfunc::cosh",	ExprUnaryFunc,	(ClientData) cosh	},
-    { "::tcl::mathfunc::double",ExprDoubleFunc,	NULL			},
-    { "::tcl::mathfunc::entier",ExprEntierFunc,	NULL			},
-    { "::tcl::mathfunc::exp",	ExprUnaryFunc,	(ClientData) exp	},
-    { "::tcl::mathfunc::floor",	ExprFloorFunc,	NULL		 	},
-    { "::tcl::mathfunc::fmod",	ExprBinaryFunc,	(ClientData) fmod	},
-    { "::tcl::mathfunc::hypot",	ExprBinaryFunc,	(ClientData) hypot 	},
-    { "::tcl::mathfunc::int",	ExprIntFunc,	NULL			},
-    { "::tcl::mathfunc::log",	ExprUnaryFunc,	(ClientData) log 	},
-    { "::tcl::mathfunc::log10",	ExprUnaryFunc,	(ClientData) log10 	},
-    { "::tcl::mathfunc::pow",	ExprBinaryFunc,	(ClientData) pow 	},
-    { "::tcl::mathfunc::rand",	ExprRandFunc,	NULL			},
-    { "::tcl::mathfunc::round",	ExprRoundFunc,	NULL			},
-    { "::tcl::mathfunc::sin",	ExprUnaryFunc,	(ClientData) sin 	},
-    { "::tcl::mathfunc::sinh",	ExprUnaryFunc,	(ClientData) sinh 	},
-    { "::tcl::mathfunc::sqrt",	ExprSqrtFunc,	NULL		 	},
-    { "::tcl::mathfunc::srand",	ExprSrandFunc,	NULL			},
-    { "::tcl::mathfunc::tan",	ExprUnaryFunc,	(ClientData) tan 	},
-    { "::tcl::mathfunc::tanh",	ExprUnaryFunc,	(ClientData) tanh 	},
-    { "::tcl::mathfunc::wide",	ExprWideFunc,	NULL		 	},
+    { "abs",		ExprAbsFunc,	NULL 			},
+    { "acos",		ExprUnaryFunc,	(ClientData) acos 	},
+    { "asin",		ExprUnaryFunc,	(ClientData) asin 	},
+    { "atan",		ExprUnaryFunc,	(ClientData) atan 	},
+    { "atan2",		ExprBinaryFunc,	(ClientData) atan2 	},
+    { "bool",		ExprBoolFunc,	NULL			},
+    { "ceil",		ExprCeilFunc,	NULL		 	},
+    { "cos",		ExprUnaryFunc,	(ClientData) cos 	},
+    { "cosh",		ExprUnaryFunc,	(ClientData) cosh	},
+    { "double",		ExprDoubleFunc,	NULL			},
+    { "entier",		ExprEntierFunc,	NULL			},
+    { "exp",		ExprUnaryFunc,	(ClientData) exp	},
+    { "floor",		ExprFloorFunc,	NULL		 	},
+    { "fmod",		ExprBinaryFunc,	(ClientData) fmod	},
+    { "hypot",		ExprBinaryFunc,	(ClientData) hypot 	},
+    { "int",		ExprIntFunc,	NULL			},
+    { "log",		ExprUnaryFunc,	(ClientData) log 	},
+    { "log10",		ExprUnaryFunc,	(ClientData) log10 	},
+    { "pow",		ExprBinaryFunc,	(ClientData) pow 	},
+    { "rand",		ExprRandFunc,	NULL			},
+    { "round",		ExprRoundFunc,	NULL			},
+    { "sin",		ExprUnaryFunc,	(ClientData) sin 	},
+    { "sinh",		ExprUnaryFunc,	(ClientData) sinh 	},
+    { "sqrt",		ExprSqrtFunc,	NULL		 	},
+    { "srand",		ExprSrandFunc,	NULL			},
+    { "tan",		ExprUnaryFunc,	(ClientData) tan 	},
+    { "tanh",		ExprUnaryFunc,	(ClientData) tanh 	},
+    { "wide",		ExprWideFunc,	NULL		 	},
     { NULL, NULL, NULL }
 };
 
@@ -271,6 +272,8 @@
 #ifdef TCL_COMPILE_STATS
     ByteCodeStats *statsPtr;
 #endif /* TCL_COMPILE_STATS */
+    char mathFuncName[32]; /* holds "::tcl::mathfunc::<tail>" */
+    char *mathFuncTail; /* points to end of "::tcl::mathfunc::" in mathFuncName */
 
     TclInitSubsystems();
 
@@ -502,16 +505,17 @@
 	Tcl_Panic("Can't create math function namespace");
     }
     i = 0;
+    strcpy(mathFuncName, "::tcl::mathfunc::");
+    mathFuncTail = mathFuncName + (sizeof("::tcl::mathfunc::") - 1);
     for (;;) {
-	CONST char* tail;
 	builtinFuncPtr = &(BuiltinFuncTable[i++]);
-	if (builtinFuncPtr->name == NULL) {
+	if (builtinFuncPtr->tail == NULL) {
 	    break;
 	}
-	Tcl_CreateObjCommand(interp, builtinFuncPtr->name,
+	strcpy(mathFuncTail, builtinFuncPtr->tail);
+	Tcl_CreateObjCommand(interp, mathFuncName,
 		builtinFuncPtr->objCmdProc, builtinFuncPtr->clientData, NULL);
-	tail = builtinFuncPtr->name + strlen("::tcl::mathfunc::");
-	Tcl_Export(interp, mathfuncNSPtr, tail, 0);
+	Tcl_Export(interp, mathfuncNSPtr, builtinFuncPtr->tail, 0);
     }
 
     /*
