Darryl L. Miles
bbc52ecd41
util/hash.c: fix use after free (not quite)
...
Dereference of 'h' after calling freeMagic(h)
Found while putting in cast.
Initially this is what was thought however....
freeMagic() has this one allocation to free latency, which is a matter
to resolve another day.
2024-12-26 15:20:58 -05:00
Darryl L. Miles
fadd2d98b4
irouter/irCommand.c: fix SetNoisyDI() usage
...
WARNING 64bit to 32bit truncation
Was directly overwriting a 32bit storage location with a 64bit value.
2024-12-26 15:20:58 -05:00
Darryl L. Miles
fd5050b2b5
util/lookup*.c: fix integer pointer arithmetic not using pointertype
...
This would be a bug on WIN64 and other LLP64 models.
2024-12-26 15:20:58 -05:00
Darryl L. Miles
f22ecda44a
set.c: SetNoisyBool() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
2b69b07860
set.c: SetNoisyDI() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
f51ad56aea
set.c: SetNoisyInt() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
5b97638ac7
port.c: MagAtof() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
14a8409e40
utils.h: Wait()/WaitPid() add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
bd51438c15
database/DBio.c: PaExpand() constify update call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
265ace5c9f
path.c: PaEnum() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
6bccbef0d4
path.c: PaSubsWD() constify and no prototype exists
...
This function does not appear used across the codebase.
No prototype exists in utils.h
2024-12-26 15:20:58 -05:00
Darryl L. Miles
c77d3852d5
path.c: PaOpen() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
fd7eab2193
path.c: PaZOpen() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
d077368436
path.c: PaLockOpen() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
875d825afb
path.c: PaLockZOpen() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
bfb411d19f
path.c: nextName() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
feef9730f3
path.c: PaExpand() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
6a6f85862e
path.c: PaAppend() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
fca164715e
PaCheckCompressed() constify implementation
2024-12-26 15:20:58 -05:00
Darryl L. Miles
e22e5d63b9
PaCheckCompressed() removed API quirkiness
...
When constifying there is this inconsistent quirk in this API returning
'filename' or a malloced storage. When special handling needs to be
made by the caller to detect this to decide if it needs a free.
This appears to done to save a strdup().
Make it always return a malloc block so the API contract is
strightforward to the caller. A non-NULL return requires
free() by the caller.
2024-12-26 15:20:58 -05:00
Darryl L. Miles
e7bfa72298
args.c: ArgStr() constify and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
2ba1d20ab4
utils/match.c constify Match() and add prototype
2024-12-26 15:20:58 -05:00
Darryl L. Miles
b8dae95515
Lookup() constify call-site
...
extflat/EFantenna.c: Lookup() constify call-site
drc/DRCtech.c: Lookup() constify call-site
dbwind/DBWelement.c: Lookup() constify call-site
database/DBtpaint.c: Lookup() constify call-site
commands/CmdTZ.c: Lookup() constify call-site
commands/CmdRS.c: Lookup() constify call-site
commands/CmdLQ.c: Lookup() constify call-site
commands/CmdFI.c: Lookup() constify call-site
commands/CmdE.c: Lookup() constify call-site
commands/CmdCD.c: Lookup() constify call-site
commands/CmdAB.c: Lookup() constify call-site
cmwind/CMWcmmnds.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
6851f27284
extract/ExtBasic.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
3dbcb0759e
Lookup() constify call-site
...
plow/PlowCmd.c: Lookup() constify call-site
plot/plotVers.c: Lookup() constify call-site
plot/plotMain.c: Lookup() constify call-site
plot/plotCmd.c: Lookup() constify call-site
netmenu/NMnetlist.c: Lookup() constify call-site
netmenu/NMcmdLZ.c: Lookup() constify call-site
netmenu/NMcmdAK.c: Lookup() constify call-site
lef/lefTech.c: Lookup() constify call-site
lef/lefCmd.c: Lookup() constify call-site
irouter/irRoute.c: Lookup() constify call-site
irouter/irCommand.c: Lookup() constify call-site
router/rtrCmd.c: Lookup() constify call-site
resis/ResRex.c: Lookup() constify call-site
gcr/gcrShwFlgs.c: Lookup() constify call-site
windows/windCmdSZ.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
c2d533af3b
windows/windCmdNR.c: Lookup() constify call-site (extern data)
2024-12-26 15:20:58 -05:00
Darryl L. Miles
586e9f1e36
Lookup() constify WindGetCommandTable() returns 'const'
...
This commit related to the dynamic creation of data that is used
to parse commands and options via Lookup.
windows/windows.h: Lookup() constify call-site
tcltk/tclmagic.c: Lookup() constify call-site
graphics/W3Dmain.c: Lookup() constify call-site
windows/windSend.c: Lookup() constify call-site
windows/windMain.c: Lookup() constify call-site
windows/windInt.h: Lookup() constify call-site
textio/txMain.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
882d82a8ae
Lookup() constify call-site with Tcl_SetResult()
...
ext2spice/ext2spice.c: Lookup() constify call-site
ext2sim/ext2sim.c: Lookup() constify call-site
windows/windCmdAM.c: Lookup() constify call-site
Tcl_SetResult() uses cast to remove 'const' from type, the pointer
is only used to take a copy of the data, the lack of 'const' is due
to Tcl heritage when supporting C89 era compilers.
TCL9 appears to fix this, in that the macro used ends up at
Tcl_NewStringObj() which has 'const' here.
2024-12-26 15:20:58 -05:00
Darryl L. Miles
a3dce62887
LookupFull() constify call-site
...
lef/lefRead.c LookupFull() constify call-site
lef/defRead.c LookupFull() constify call-site
graphics/grDStyle.c: LookupFull() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
14b6453707
LookupStruct() constify call-site
...
irouter/irTestCmd.c: LookupStruct() constify call-site
irouter/irCommand.c: LookupStruct() constify call-site
mzrouter/mzTestCmd.c: LookupStruct() constify call-site
mzrouter/mzTech.c: LookupStruct() constify call-site
router/rtrCmd.c: LookupStruct() constify call-site
plow/PlowTest.c: LookupStruct() constify call-site
plow/PlowTech.c: LookupStruct() constify call-site
plot/plotVers.c: LookupStruct() constify call-site
grouter/grouteTest.c: LookupStruct() constify call-site
garouter/gaTest.c: LookupStruct() constify call-site
extract/ExtTest.c: LookupStruct() constify call-site
extract/ExtTech.c: LookupStruct() constify call-site
extflat/EFread.c: LookupStruct() constify call-site
DRCtech.c: LookupStruct() constify call-site
debugFlags.c: LookupStruct() constify call-site
CmdSubrs.c: LookupStruct() constify call-site
geometry.c: LookupStruct() constify call-site
set.c: LookupStruct() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
fb8f7b94aa
LookupStructFull() constify call-site
...
txInput.c: LookupStructFull() constify call-site
DBlabel.c: LookupStructFull() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles
f5b41a06d6
utils/lookup*.c: constify the API
...
extern int Lookup(const char *str, const char * const *table);
extern int LookupAny(char, const char * const *);
extern int LookupFull(const char *, const char **);
extern int LookupStruct(const char *str, const LookupTable *table_start, int size);
extern int LookupStructFull(const char *str, const char * const *table, int size);
2024-12-26 15:20:58 -05:00
Darryl L. Miles
aa43cc164e
geometry.h: constify global wellknown Geometry data values
...
This then rippled through into callers
Fixed merge conflicts in cif/CIFrdutils.c and cif/CIFread.h
2024-12-26 15:20:39 -05:00
Darryl L. Miles
a224c7e21a
GeoDisjoint() unify return type of callback to bool
...
GeoDisjoint() handles this as 'bool' type internally so make all
consumer call-sites consistent with this type.
2024-12-26 15:10:35 -05:00
Darryl L. Miles
fd6c30a380
geometry.c: constify and add prototypes
2024-12-26 15:10:35 -05:00
Darryl L. Miles
efb5d9001c
util/hash.[ch]: const hash 'key' for API and internal type
...
This is mainly to modify the function signature to accept const
data pointers to keys.
Patch required to ease use of const by API consumers.
2024-12-26 15:10:35 -05:00
Darryl L. Miles
91da638579
utils/strdup.c: StrDup() and mode constifiy impl
2024-12-26 15:10:35 -05:00
Darryl L. Miles
77f04b4e80
K&R debug.h: conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:15:29 -05:00
Darryl L. Miles
c7f99e076e
DBcount.c: DBTreeCountPaint() unify return type of hiercount() callback
...
The call-site does not expect a return value.
The use case in command/Cmdwizard.c is written to be void.
So a resolution was needed.
2024-12-26 13:13:14 -05:00
Darryl L. Miles
bd03a550d3
CmdCD.c: DBOrientUse() called with too many arguments.
...
Comment added to come back to later.
DBOrientUse(cellname, dodef/*, orient*/);
2024-12-26 13:13:13 -05:00
Darryl L. Miles
f08793ddd7
CmdTZ.c: use strict prototype for qsort() compar callback function
2024-12-26 13:13:13 -05:00
Darryl L. Miles
2123f7090d
CmdCD.c: removed unnecessary fwd decl for function in included header
...
commands.h contains the prototype for cmdFlushCell() which is already
being included in CmdCD.c
2024-12-26 13:13:13 -05:00
Darryl L. Miles
7ebaba6b39
DBcount.c: clarify function documentation of hiercount() callback
...
DBTreeCountPaint(def, count, hiercount, cleanup, cdata)
callback hiercount()
The K&R function prototype syntax in the documentation might confuse
reader into which argument order is correct (as a modern developer
might be out of practice with interpreting K&R syntax)
2024-12-26 13:13:13 -05:00
Darryl L. Miles
3a41bf6ae2
DBWprocs.c: removed fwd decl for non-existant function
...
void DisplayWindow();
Found during K&R removal of commands/**
2024-12-26 13:13:13 -05:00
Darryl L. Miles
56139b48eb
K&R commands/*.c: bulk forward reference function prototype conversion
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
afd1b0b2df
K&R commands: 2 x missing forward declaration removal
...
Functions do not appear to exist:
extern void DisplayWindow();
extern void DisplayWindow();
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
b3d4ab7980
K&R commands/*.c: bulk function implementation conversion
...
Argument order and type declaration mismatches:
Label *
portFindLabel(editDef, port, unique, nonEdit)
CellDef *editDef;
bool unique;
bool port; // If TRUE, only look for labels that are ports
bool *nonEdit; // TRUE if label is not in the edit cell
This warrants inspection at call site CmdLQ.c:1712 as both types are bool
is it not so straightforward to check.
It looks like when PORT_MAKE is the option 'port make [index] [dir...]'
port=FALSE is this the correct intention ? This looks ok in that
we're searching for labels to make (upgrade) into ports.
Where as all other 'port ....' commands are operating on items that are
already ports, and ignoring labels.
So the K&R argument name order is also how the call-sites are using it.
void
cmdStatsHier(parent, nuses, child)
CellDef *parent, *child;
int nuses;
This was checked and found ok as callback to ../database/DBcount.c
DBTreeCountPaint(... hiercount, ...)
Due to this not-obvious K&R style also being used in the documentation
this was changed as well (in another commit0.
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
8a4464f443
commands.h: add #include "textio/txcommands.h"
...
The type TxCommand is used in the function signatures.
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
06b5870035
K&R commands.h: conversion to ANSI
...
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00
Darryl L. Miles
866699f353
K&R commands.h: 3 x missing prototype removal
...
Functions do not appear to exist:
extern MagWindow *CmdGetRootBox();
extern void CmdAddSlop();
extern void CmdDoMacro();
K&R obsolete syntax removal for C23 compatibility series
2024-12-26 13:13:13 -05:00