summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/regcomp.c12
-rw-r--r--generic/tclFileName.c12
-rw-r--r--generic/tclLoad.c8
4 files changed, 22 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index b6f9f34..fab10b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/regcomp.c Don't use arrays of length 1, just use a single
+ * generic/tclFileName.c element then, it makes code more readable.
+ * generic/tclLoad.c (here it even prevents a type cast)
+
2010-05-17 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tclStrToD.c: Fix [Bug 2996549]: Failure in expr.test on Win32
diff --git a/generic/regcomp.c b/generic/regcomp.c
index 8ff77ad..9753ca4 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -1458,7 +1458,7 @@ brackpart(
celt startc, endc;
struct cvec *cv;
const chr *startp, *endp;
- chr c[1];
+ chr c;
/*
* Parse something, get rid of special cases, take shortcuts.
@@ -1470,7 +1470,7 @@ brackpart(
return;
break;
case PLAIN:
- c[0] = v->nextvalue;
+ c = v->nextvalue;
NEXT();
/*
@@ -1478,10 +1478,10 @@ brackpart(
*/
if (!SEE(RANGE)) {
- onechr(v, c[0], lp, rp);
+ onechr(v, c, lp, rp);
return;
}
- startc = element(v, c, c+1);
+ startc = element(v, &c, &c+1);
NOERR();
break;
case COLLEL:
@@ -1525,9 +1525,9 @@ brackpart(
switch (v->nexttype) {
case PLAIN:
case RANGE:
- c[0] = v->nextvalue;
+ c = v->nextvalue;
NEXT();
- endc = element(v, c, c+1);
+ endc = element(v, &c, &c+1);
NOERR();
break;
case COLLEL:
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 28c0ab8..7c4a360 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclFileName.c,v 1.102 2010/03/05 14:34:04 dkf Exp $
+ * RCS: @(#) $Id: tclFileName.c,v 1.103 2010/05/19 08:23:09 nijtmans Exp $
*/
#include "tclInt.h"
@@ -1983,19 +1983,19 @@ TclGlob(
for (i = 0; i< objc; i++) {
int len;
const char *oldStr = Tcl_GetStringFromObj(objv[i], &len);
- Tcl_Obj *elems[1];
+ Tcl_Obj *elem;
if (len == prefixLen) {
if ((pattern[0] == '\0')
|| (strchr(separators, pattern[0]) == NULL)) {
- TclNewLiteralStringObj(elems[0], ".");
+ TclNewLiteralStringObj(elem, ".");
} else {
- TclNewLiteralStringObj(elems[0], "/");
+ TclNewLiteralStringObj(elem, "/");
}
} else {
- elems[0] = Tcl_NewStringObj(oldStr+prefixLen, len-prefixLen);
+ elem = Tcl_NewStringObj(oldStr+prefixLen, len-prefixLen);
}
- Tcl_ListObjReplace(interp, filenamesObj, i, 1, 1, elems);
+ Tcl_ListObjReplace(interp, filenamesObj, i, 1, 1, &elem);
}
}
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index 8ba90ed..22f1c86 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoad.c,v 1.25 2010/04/02 21:21:06 kennykb Exp $
+ * RCS: @(#) $Id: tclLoad.c,v 1.26 2010/05/19 08:23:09 nijtmans Exp $
*/
#include "tclInt.h"
@@ -129,7 +129,7 @@ Tcl_LoadObjCmd(
InterpPackage *ipFirstPtr, *ipPtr;
int code, namesMatch, filesMatch, offset;
const char *symbols[2];
- void* procPtrs[1];
+ Tcl_PackageInitProc *initProc;
const char *p, *fullFileName, *packageName;
Tcl_LoadHandle loadHandle;
Tcl_UniChar ch;
@@ -354,7 +354,7 @@ Tcl_LoadObjCmd(
symbols[1] = NULL;
Tcl_MutexLock(&packageMutex);
- code = Tcl_LoadFile(interp, objv[1], symbols, 0, procPtrs, &loadHandle);
+ code = Tcl_LoadFile(interp, objv[1], symbols, 0, &initProc, &loadHandle);
Tcl_MutexUnlock(&packageMutex);
if (code != TCL_OK) {
goto done;
@@ -372,7 +372,7 @@ Tcl_LoadObjCmd(
ckalloc((unsigned) (Tcl_DStringLength(&pkgName) + 1));
strcpy(pkgPtr->packageName, Tcl_DStringValue(&pkgName));
pkgPtr->loadHandle = loadHandle;
- pkgPtr->initProc = (Tcl_PackageInitProc*) procPtrs[0];
+ pkgPtr->initProc = initProc;
pkgPtr->safeInitProc = (Tcl_PackageInitProc*)
Tcl_FindSymbol(interp, loadHandle, Tcl_DStringValue(&safeInitName));
pkgPtr->unloadProc = (Tcl_PackageUnloadProc*)