Skip to content

Commit

Permalink
lib: Tcl_GetStringFromObj needs Tcl_Size* len ptr on Tcl9
Browse files Browse the repository at this point in the history
lengthPtr argument of Tcl_GetStringFromObj is of Tcl_Size* type starting
Tcl 9.0 instead of int*.
  • Loading branch information
xdelaruelle committed Jan 13, 2024
1 parent 5544d3d commit bc8bb48
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ Modules 5.4.0 (not yet released)
* Install: installation option :instopt:`--enable-new-features` is updated to
enable *abort on error* behavior on :subcmd:`load` and :subcmd:`switch`
sub-commands.
* Lib: slightly adapt code of Modules Tcl extension library to properly build
against Tcl 9.0.


.. _5.3 release notes:
Expand Down
17 changes: 15 additions & 2 deletions lib/envmodules.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*************************************************************************
*
* ENVMODULES.C, Modules Tcl extension library
* Copyright (C) 2018-2022 Xavier Delaruelle
* Copyright (C) 2018-2024 Xavier Delaruelle
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -71,7 +71,11 @@ Envmodules_GetFilesInDirectoryObjCmd(
{
int fetch_dotversion;
const char *dir;
#if TCL_MAJOR_VERSION < 9
int dirlen;
#else
Tcl_Size dirlen;
#endif
DIR *did;
Tcl_Obj *ltmp, *lres;
struct dirent *direntry;
Expand Down Expand Up @@ -186,7 +190,11 @@ Envmodules_ReadFileObjCmd(
int firstline;
int must_have_cookie;
const char *filename;
#if TCL_MAJOR_VERSION < 9
int filenamelen;
#else
Tcl_Size filenamelen;
#endif
int fid;
int firstread;
ssize_t len;
Expand Down Expand Up @@ -493,9 +501,14 @@ Envmodules_ParseDateTimeArgObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *opt;
int optlen;
const char *datetime;
#if TCL_MAJOR_VERSION < 9
int optlen;
int datetimelen;
#else
Tcl_Size optlen;
Tcl_Size datetimelen;
#endif
char dt[17];
int valid_dt = 0;
struct tm tm;
Expand Down

0 comments on commit bc8bb48

Please sign in to comment.