diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-28 00:04:31 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-28 00:04:31 (GMT) |
commit | 9652ccdb2f5dbc810445ea5431b278cf4417a9c1 (patch) | |
tree | 6758c40cffcdeee43de72e5cba267a233002f7ef /generic/tclZlib.c | |
parent | 3c5b4af0d42e9175d48a6e114ec5f3ec05e1b915 (diff) | |
download | tcl-9652ccdb2f5dbc810445ea5431b278cf4417a9c1.zip tcl-9652ccdb2f5dbc810445ea5431b278cf4417a9c1.tar.gz tcl-9652ccdb2f5dbc810445ea5431b278cf4417a9c1.tar.bz2 |
[3590483]: Some compilers cannot initialize with complex non-constants.
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r-- | generic/tclZlib.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 11490f1..c63c306 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -2177,29 +2177,35 @@ ZlibStreamSubcmd( FMT_INFLATE }; int i, format, mode = 0, option, level; + enum objIndices { + OPT_COMPRESSION_DICTIONARY = 0, + OPT_GZIP_HEADER = 1, + OPT_COMPRESSION_LEVEL = 2 + }; + Tcl_Obj *obj[3] = { NULL, NULL, NULL }; +#define compDictObj obj[OPT_COMPRESSION_DICTIONARY] +#define gzipHeaderObj obj[OPT_GZIP_HEADER] +#define levelObj obj[OPT_COMPRESSION_LEVEL] typedef struct { const char *name; - Tcl_Obj **valueVar; + enum objIndices offset; } OptDescriptor; - Tcl_Obj *compDictObj = NULL; - Tcl_Obj *gzipHeaderObj = NULL; - Tcl_Obj *levelObj = NULL; - const OptDescriptor compressionOpts[] = { - { "-dictionary", &compDictObj }, - { "-level", &levelObj }, - { NULL, NULL } + static const OptDescriptor compressionOpts[] = { + { "-dictionary", OPT_COMPRESSION_DICTIONARY }, + { "-level", OPT_COMPRESSION_LEVEL }, + { NULL, 0 } }; - const OptDescriptor gzipOpts[] = { - { "-header", &gzipHeaderObj }, - { "-level", &levelObj }, - { NULL, NULL } + static const OptDescriptor gzipOpts[] = { + { "-header", OPT_GZIP_HEADER }, + { "-level", OPT_COMPRESSION_LEVEL }, + { NULL, 0 } }; - const OptDescriptor expansionOpts[] = { - { "-dictionary", &compDictObj }, - { NULL, NULL } + static const OptDescriptor expansionOpts[] = { + { "-dictionary", OPT_COMPRESSION_DICTIONARY }, + { NULL, 0 } }; - const OptDescriptor gunzipOpts[] = { - { NULL, NULL } + static const OptDescriptor gunzipOpts[] = { + { NULL, 0 } }; const OptDescriptor *desc = NULL; Tcl_ZlibStream zh; @@ -2262,13 +2268,7 @@ ZlibStreamSubcmd( sizeof(OptDescriptor), "option", 0, &option) != TCL_OK) { return TCL_ERROR; } - *desc[option].valueVar = objv[i+1]; - - /* - * Drop the cache on the option name; table address not constant. - */ - - TclFreeIntRep(objv[i]); + obj[desc[option].offset] = objv[i+1]; } /* @@ -2300,6 +2300,9 @@ ZlibStreamSubcmd( } Tcl_SetObjResult(interp, Tcl_ZlibStreamGetCommandName(zh)); return TCL_OK; +#undef compDictObj +#undef gzipHeaderObj +#undef levelObj } /* |