diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-05-27 13:18:51 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-05-27 13:18:51 (GMT) |
commit | d63bdddac575b06d8dbaff5caf199f191258281a (patch) | |
tree | 81621affdfd50f3451faa2c5568732111932e247 /generic | |
parent | 4761295d5dc11e76a759fc26de4b30d09bccd1a5 (diff) | |
download | tcl-d63bdddac575b06d8dbaff5caf199f191258281a.zip tcl-d63bdddac575b06d8dbaff5caf199f191258281a.tar.gz tcl-d63bdddac575b06d8dbaff5caf199f191258281a.tar.bz2 |
Made compiling with -Wstrict-prototypes -Wmissing-prototypes much cleaner.
Also added support for [FRQ 951168] but left that switched off by default.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdMZ.c | 18 | ||||
-rw-r--r-- | generic/tclDictObj.c | 3 | ||||
-rw-r--r-- | generic/tclHash.c | 8 | ||||
-rw-r--r-- | generic/tclScan.c | 26 | ||||
-rw-r--r-- | generic/tclVar.c | 7 |
5 files changed, 36 insertions, 26 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 0e0bffc..17620d2 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.101 2004/04/06 22:25:49 dgp Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.102 2004/05/27 13:18:52 dkf Exp $ */ #include "tclInt.h" @@ -1325,12 +1325,14 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) * comparison in INST_EQ/INST_NEQ/INST_LT/...). */ int i, match, length, nocase = 0, reqlength = -1; - int (*strCmpFn)(); + typedef int (*strCmpFn_t) _ANSI_ARGS_((const char *, const char *, + unsigned int)); + strCmpFn_t strCmpFn; if (objc < 4 || objc > 7) { str_cmp_args: Tcl_WrongNumArgs(interp, 2, objv, - "?-nocase? ?-length int? string1 string2"); + "?-nocase? ?-length int? string1 string2"); return TCL_ERROR; } @@ -1381,7 +1383,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) */ string1 = (char*) Tcl_GetByteArrayFromObj(objv[0], &length1); string2 = (char*) Tcl_GetByteArrayFromObj(objv[1], &length2); - strCmpFn = memcmp; + strCmpFn = (strCmpFn_t) memcmp; } else if ((objv[0]->typePtr == &tclStringType) && (objv[1]->typePtr == &tclStringType)) { /* @@ -1392,7 +1394,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) */ string1 = (char*) Tcl_GetUnicodeFromObj(objv[0], &length1); string2 = (char*) Tcl_GetUnicodeFromObj(objv[1], &length2); - strCmpFn = nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp; + strCmpFn = (strCmpFn_t) + (nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp); } else { /* * As a catch-all we will work with UTF-8. We cannot use @@ -1404,11 +1407,12 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) string1 = (char*) Tcl_GetStringFromObj(objv[0], &length1); string2 = (char*) Tcl_GetStringFromObj(objv[1], &length2); if ((reqlength < 0) && !nocase) { - strCmpFn = TclpUtfNcmp2; + strCmpFn = (strCmpFn_t) TclpUtfNcmp2; } else { length1 = Tcl_NumUtfChars(string1, length1); length2 = Tcl_NumUtfChars(string2, length2); - strCmpFn = nocase ? Tcl_UtfNcasecmp : Tcl_UtfNcmp; + strCmpFn = (strCmpFn_t) + (nocase ? Tcl_UtfNcasecmp : Tcl_UtfNcmp); } } diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index bbbc156..c29ac40 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.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: tclDictObj.c,v 1.15 2004/03/12 23:21:05 dkf Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.16 2004/05/27 13:18:53 dkf Exp $ */ #include "tclInt.h" @@ -73,6 +73,7 @@ static int DictValuesCmd _ANSI_ARGS_((Tcl_Interp *interp, static void DupDictInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr, Tcl_Obj *copyPtr)); static void FreeDictInternalRep _ANSI_ARGS_((Tcl_Obj *dictPtr)); +static void InvalidateDictChain _ANSI_ARGS_((Tcl_Obj *dictObj)); static int SetDictFromAny _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr)); static void UpdateStringOfDict _ANSI_ARGS_((Tcl_Obj *dictPtr)); diff --git a/generic/tclHash.c b/generic/tclHash.c index 54a6efa..360acfe 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.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: tclHash.c,v 1.18 2004/04/06 22:25:51 dgp Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.19 2004/05/27 13:18:53 dkf Exp $ */ #include "tclInt.h" @@ -986,11 +986,14 @@ AllocStringEntry(tablePtr, keyPtr) static int CompareStringKeys(keyPtr, hPtr) VOID *keyPtr; /* New key to compare. */ - Tcl_HashEntry *hPtr; /* Existing key to compare. */ + Tcl_HashEntry *hPtr; /* Existing key to compare. */ { register CONST char *p1 = (CONST char *) keyPtr; register CONST char *p2 = (CONST char *) hPtr->key.string; +#ifdef TCL_COMPARE_HASHES_WITH_STRCMP + return !strcmp(p1, p2); +#else for (;; p1++, p2++) { if (*p1 != *p2) { break; @@ -1000,6 +1003,7 @@ CompareStringKeys(keyPtr, hPtr) } } return 0; +#endif /* TCL_COMPARE_HASHES_WITH_STRCMP */ } /* diff --git a/generic/tclScan.c b/generic/tclScan.c index 2ff616d..47d40bd 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclScan.c,v 1.13 2004/04/06 22:25:54 dgp Exp $ + * RCS: @(#) $Id: tclScan.c,v 1.14 2004/05/27 13:18:53 dkf Exp $ */ #include "tclInt.h" @@ -575,9 +575,9 @@ Tcl_ScanObjCmd(dummy, interp, objc, objv) int base = 0; int underflow = 0; size_t width; - long (*fn)() = NULL; + long (*fn) _ANSI_ARGS_((char*,void*,int)) = NULL; #ifndef TCL_WIDE_INT_IS_LONG - Tcl_WideInt (*lfn)() = NULL; + Tcl_WideInt (*lfn) _ANSI_ARGS_((char*,void*,int)) = NULL; Tcl_WideInt wideValue; #endif Tcl_UniChar ch, sch; @@ -727,42 +727,42 @@ Tcl_ScanObjCmd(dummy, interp, objc, objv) case 'd': op = 'i'; base = 10; - fn = (long (*)())strtol; + fn = (long (*) _ANSI_ARGS_((char*,void*,int)))strtol; #ifndef TCL_WIDE_INT_IS_LONG - lfn = (Tcl_WideInt (*)())strtoll; + lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoll; #endif break; case 'i': op = 'i'; base = 0; - fn = (long (*)())strtol; + fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtol; #ifndef TCL_WIDE_INT_IS_LONG - lfn = (Tcl_WideInt (*)())strtoll; + lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoll; #endif break; case 'o': op = 'i'; base = 8; - fn = (long (*)())strtoul; + fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtoul; #ifndef TCL_WIDE_INT_IS_LONG - lfn = (Tcl_WideInt (*)())strtoull; + lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoull; #endif break; case 'x': op = 'i'; base = 16; - fn = (long (*)())strtoul; + fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtoul; #ifndef TCL_WIDE_INT_IS_LONG - lfn = (Tcl_WideInt (*)())strtoull; + lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoull; #endif break; case 'u': op = 'i'; base = 10; flags |= SCAN_UNSIGNED; - fn = (long (*)())strtoul; + fn = (long (*)_ANSI_ARGS_((char*,void*,int)))strtoul; #ifndef TCL_WIDE_INT_IS_LONG - lfn = (Tcl_WideInt (*)())strtoull; + lfn = (Tcl_WideInt (*)_ANSI_ARGS_((char*,void*,int)))strtoull; #endif break; diff --git a/generic/tclVar.c b/generic/tclVar.c index 667c206..2a88366 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.83 2004/05/25 19:45:16 msofer Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.84 2004/05/27 13:18:53 dkf Exp $ */ #include "tclInt.h" @@ -69,8 +69,6 @@ int TclObjUnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp, static Tcl_FreeInternalRepProc FreeLocalVarName; static Tcl_DupInternalRepProc DupLocalVarName; static Tcl_UpdateStringProc UpdateLocalVarName; -static Tcl_FreeInternalRepProc FreeNsVarName; -static Tcl_DupInternalRepProc DupNsVarName; static Tcl_FreeInternalRepProc FreeParsedVarName; static Tcl_DupInternalRepProc DupParsedVarName; static Tcl_UpdateStringProc UpdateParsedVarName; @@ -111,6 +109,9 @@ Tcl_ObjType tclLocalVarNameType = { #define ENABLE_NS_VARNAME_CACHING 0 #if ENABLE_NS_VARNAME_CACHING +static Tcl_FreeInternalRepProc FreeNsVarName; +static Tcl_DupInternalRepProc DupNsVarName; + Tcl_ObjType tclNsVarNameType = { "namespaceVarName", FreeNsVarName, DupNsVarName, NULL, NULL |