summaryrefslogtreecommitdiffstats
path: root/generic/tclFileName.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r--generic/tclFileName.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 0e2fd20..adb94d0 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.77 2007/02/20 15:36:46 patthoyts Exp $
+ * RCS: @(#) $Id: tclFileName.c,v 1.78 2007/02/20 23:24:03 nijtmans Exp $
*/
#include "tclInt.h"
@@ -28,16 +28,16 @@ TclPlatformType tclPlatform = TCL_PLATFORM_UNIX;
* Prototypes for local procedures defined in this file:
*/
-static CONST char * DoTildeSubst(Tcl_Interp *interp,
- CONST char *user, Tcl_DString *resultPtr);
-static CONST char * ExtractWinRoot(CONST char *path,
+static const char * DoTildeSubst(Tcl_Interp *interp,
+ const char *user, Tcl_DString *resultPtr);
+static const char * ExtractWinRoot(const char *path,
Tcl_DString *resultPtr, int offset,
Tcl_PathType *typePtr);
static int SkipToChar(char **stringPtr, int match);
-static Tcl_Obj* SplitWinPath(CONST char *path);
-static Tcl_Obj* SplitUnixPath(CONST char *path);
+static Tcl_Obj* SplitWinPath(const char *path);
+static Tcl_Obj* SplitUnixPath(const char *path);
static int DoGlob(Tcl_Interp *interp, Tcl_Obj *resultPtr,
- char *separators, Tcl_Obj *pathPtr, int flags,
+ const char *separators, Tcl_Obj *pathPtr, int flags,
char *pattern, Tcl_GlobTypeData *types);
/*
@@ -86,9 +86,9 @@ SetResultLength(Tcl_DString *resultPtr, int offset, int extended)
*----------------------------------------------------------------------
*/
-static CONST char *
+static const char *
ExtractWinRoot(
- CONST char *path, /* Path to parse. */
+ const char *path, /* Path to parse. */
Tcl_DString *resultPtr, /* Buffer to hold result. */
int offset, /* Offset in buffer where result should be
* stored. */
@@ -114,7 +114,7 @@ ExtractWinRoot(
* Might be a UNC or Vol-Relative path.
*/
- CONST char *host, *share, *tail;
+ const char *host, *share, *tail;
int hlen, slen;
if (path[1] != '/' && path[1] != '\\') {
@@ -328,7 +328,7 @@ ExtractWinRoot(
Tcl_PathType
Tcl_GetPathType(
- CONST char *path)
+ const char *path)
{
Tcl_PathType type;
Tcl_Obj *tempObj = Tcl_NewStringObj(path,-1);
@@ -427,7 +427,7 @@ TclpGetNativePathType(
}
case TCL_PLATFORM_WINDOWS: {
Tcl_DString ds;
- CONST char *rootEnd;
+ const char *rootEnd;
Tcl_DStringInit(&ds);
rootEnd = ExtractWinRoot(path, &ds, 0, &type);
@@ -528,10 +528,10 @@ TclpNativeSplitPath(
void
Tcl_SplitPath(
- CONST char *path, /* Pointer to string containing a path. */
+ const char *path, /* Pointer to string containing a path. */
int *argcPtr, /* Pointer to location to fill in with the
* number of elements in the path. */
- CONST char ***argvPtr) /* Pointer to place to store pointer to array
+ const char ***argvPtr) /* Pointer to place to store pointer to array
* of pointers to path elements. */
{
Tcl_Obj *resultPtr = NULL; /* Needed only to prevent gcc warnings. */
@@ -565,7 +565,7 @@ Tcl_SplitPath(
* plus the argv pointers and the terminating NULL pointer.
*/
- *argvPtr = (CONST char **) ckalloc((unsigned)
+ *argvPtr = (const char **) ckalloc((unsigned)
((((*argcPtr) + 1) * sizeof(char *)) + size));
/*
@@ -619,10 +619,10 @@ Tcl_SplitPath(
static Tcl_Obj *
SplitUnixPath(
- CONST char *path) /* Pointer to string containing a path. */
+ const char *path) /* Pointer to string containing a path. */
{
int length;
- CONST char *p, *elementStart;
+ const char *p, *elementStart;
Tcl_Obj *result = Tcl_NewObj();
/*
@@ -696,10 +696,10 @@ SplitUnixPath(
static Tcl_Obj *
SplitWinPath(
- CONST char *path) /* Pointer to string containing a path. */
+ const char *path) /* Pointer to string containing a path. */
{
int length;
- CONST char *p, *elementStart;
+ const char *p, *elementStart;
Tcl_PathType type = TCL_PATH_ABSOLUTE;
Tcl_DString buf;
Tcl_Obj *result = Tcl_NewObj();
@@ -774,7 +774,7 @@ Tcl_Obj *
Tcl_FSJoinToPath(
Tcl_Obj *pathPtr, /* Valid path or NULL. */
int objc, /* Number of array elements to join */
- Tcl_Obj *CONST objv[]) /* Path elements to join. */
+ Tcl_Obj *const objv[]) /* Path elements to join. */
{
int i;
Tcl_Obj *lobj, *ret;
@@ -944,7 +944,7 @@ TclpNativeJoinPath(
char *
Tcl_JoinPath(
int argc,
- CONST char *CONST *argv,
+ const char *const *argv,
Tcl_DString *resultPtr) /* Pointer to previously initialized DString */
{
int i, len;
@@ -1015,7 +1015,7 @@ char *
Tcl_TranslateFileName(
Tcl_Interp *interp, /* Interpreter in which to store error message
* (if necessary). */
- CONST char *name, /* File name, which may begin with "~" (to
+ const char *name, /* File name, which may begin with "~" (to
* indicate current user's home directory) or
* "~<user>" (to indicate any user's home
* directory). */
@@ -1072,11 +1072,11 @@ Tcl_TranslateFileName(
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
TclGetExtension(
- CONST char *name) /* File name to parse. */
+ const char *name) /* File name to parse. */
{
- CONST char *p, *lastSep;
+ const char *p, *lastSep;
/*
* First find the last directory separator.
@@ -1133,16 +1133,16 @@ TclGetExtension(
*----------------------------------------------------------------------
*/
-static CONST char *
+static const char *
DoTildeSubst(
Tcl_Interp *interp, /* Interpreter in which to store error message
* (if necessary). */
- CONST char *user, /* Name of user whose home directory should be
+ const char *user, /* Name of user whose home directory should be
* substituted, or "" for current user. */
Tcl_DString *resultPtr) /* Initialized DString filled with name after
* tilde substitution. */
{
- CONST char *dir;
+ const char *dir;
if (*user == '\0') {
Tcl_DString dirString;
@@ -1192,14 +1192,15 @@ Tcl_GlobObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
- Tcl_Obj *CONST objv[]) /* Argument objects. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
int index, i, globFlags, length, join, dir, result;
- char *string, *separators;
+ char *string;
+ const char *separators;
Tcl_Obj *typePtr, *resultPtr, *look;
Tcl_Obj *pathOrDir = NULL;
Tcl_DString prefix;
- static CONST char *options[] = {
+ static const char *options[] = {
"-directory", "-join", "-nocomplain", "-path", "-tails",
"-types", "--", NULL
};
@@ -1599,7 +1600,7 @@ Tcl_GlobObjCmd(
Tcl_AppendResult(interp, Tcl_DStringValue(&prefix),
(char *) NULL);
} else {
- char *sep = "";
+ const char *sep = "";
for (i = 0; i < objc; i++) {
string = Tcl_GetString(objv[i]);
Tcl_AppendResult(interp, sep, string, (char *) NULL);
@@ -1673,8 +1674,8 @@ TclGlob(
Tcl_GlobTypeData *types) /* Struct containing acceptable types. May be
* NULL. */
{
- char *separators;
- CONST char *head;
+ const char *separators;
+ const char *head;
char *tail, *start;
int result;
Tcl_Obj *filenamesObj, *savedResultObj;
@@ -1936,7 +1937,7 @@ TclGlob(
int objc, i;
Tcl_Obj **objv;
int prefixLen;
- CONST char *pre;
+ const char *pre;
/*
* If this length has never been set, set it here.
@@ -2092,7 +2093,7 @@ DoGlob(
* resulting filenames. Caller allocates and
* deallocates; DoGlob must not touch the
* refCount of this object. */
- char *separators, /* String containing separator characters that
+ const char *separators, /* String containing separator characters that
* should be used to identify globbing
* boundaries. */
Tcl_Obj *pathPtr, /* Completely expanded prefix. */
@@ -2399,7 +2400,7 @@ DoGlob(
#if defined(__CYGWIN__) && defined(__WIN32__)
{
- extern int cygwin_conv_to_win32_path(CONST char *, char *);
+ extern int cygwin_conv_to_win32_path(const char *, char *);
char winbuf[MAX_PATH+1];
cygwin_conv_to_win32_path(Tcl_DStringValue(&append), winbuf);
@@ -2438,7 +2439,7 @@ DoGlob(
*/
int len;
- CONST char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
+ const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
if (strchr(separators, joined[len-1]) == NULL) {
Tcl_AppendToObj(joinedPtr, "/", 1);
@@ -2474,7 +2475,7 @@ DoGlob(
*/
int len;
- CONST char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
+ const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
if (strchr(separators, joined[len-1]) == NULL) {
if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) {