Darryl Miles
ff73a1328f
txOutput.c: printf style constify fmt call-site
2025-01-03 09:08:14 +00:00
Darryl Miles
0259fdc990
tclmagic.c: printf style constify fmt call-site
2025-01-03 09:08:14 +00:00
Darryl L. Miles
5770da2abd
geometry.c: TxError() constify call-site
2025-01-03 09:08:14 +00:00
Darryl Miles
1aee10ef4d
utils/magic.h: ANALYSER_xxxxxxxxxx __attribute__
2025-01-03 09:08:14 +00:00
Darryl Miles
2fcd024bdb
utils/magic.h: ATTR_SENTINEL __attribute__ ((sentinel))
2025-01-03 09:08:14 +00:00
Darryl L. Miles
91bb9935f9
grOGL1.c: use ATTR_UNREACHABLE to help analyser
2025-01-03 09:08:14 +00:00
Darryl L. Miles
c8974ed2ec
utils/main.h: MainExit() add ATTR_NORETURN hint
2025-01-03 09:08:14 +00:00
Darryl L. Miles
31d7130833
utils/magic.h: ATTR_UNREACHABLE ATTR_NORETURN
...
Add optional compiler support for these attribute hints.
2025-01-03 09:08:14 +00:00
Darryl L. Miles
fc02f57d73
magic.h: add macro __unused__
...
__attribute__((unused))
use like:
void myFunc(int arg0, __unused__(arg1)) { ... }
2025-01-03 09:08:14 +00:00
Darryl Miles
bf96348502
printf: vararg functions use 'const' for format string
2025-01-03 09:08:14 +00:00
Darryl Miles
94ec5cf98f
printf: use compiler __attribute__((format (printf,fff,aaa)))
2025-01-03 09:08:14 +00:00
Tim Edwards
f80540af46
Applied patch from Darryl Miles that prevents a segfault on an
...
error in "extresist". The underlying error still exists and
causes a "Bad Device" error but no longer crashes magic. See
github Issue #353 .
2024-12-26 16:39:23 -05:00
Tim Edwards
df19d62f51
Corrected code in DBtpaint2.c handling the setup of paint/erase
...
tables for contacts, where an error was pointed out by Darryl
Miles (github issue #339 ).
2024-12-26 16:28:43 -05:00
Tim Edwards
8371d797ad
Revised some code from PR#352 in response to questions from Darryl
...
Miles. Updated the version number to go along with the merge of
a number of pull requests done today.
2024-12-26 15:29:54 -05:00
Darryl L. Miles
55d15ffaa5
extflat/EFdef.c: hash constify freeMalloc() constness cast
...
This is a result of hash.[ch] constification
2024-12-26 15:20:59 -05:00
Darryl L. Miles
a11352970f
dbwind/DBWelement.c: constify args to AppendFlag/AppendString
...
non-static file local functions
2024-12-26 15:20:59 -05:00
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