aboutsummaryrefslogtreecommitdiff
path: root/pattern.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-01-02 16:48:20 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-01-02 18:09:27 +0000
commitd246077e78bb1aeafe8829927db23f281cd03c72 (patch)
tree7a5b78b0659c06138c700cc92b86c645e22ecebf /pattern.c
parent44b5291b48e77810a096933d0b6f8dae5a17300c (diff)
downloadpuzzles-d246077e78bb1aeafe8829927db23f281cd03c72.zip
puzzles-d246077e78bb1aeafe8829927db23f281cd03c72.tar.gz
puzzles-d246077e78bb1aeafe8829927db23f281cd03c72.tar.bz2
puzzles-d246077e78bb1aeafe8829927db23f281cd03c72.tar.xz
Add a macro of an upper bound on the formatted length of an integer
There are lots of places where Puzzles formats integers into fixed-length buffers using sprintf() with a "%d" format. This isn't very safe, since C doesn't guarantee any particular maximum size for an "int". However, the restrictions on representations of integers means we can infer an upper bound using sizeof(), CHAR_BIT, and an approximation to the binary log of 10.
Diffstat (limited to 'pattern.c')
0 files changed, 0 insertions, 0 deletions