aboutsummaryrefslogtreecommitdiff
path: root/malloc.c (follow)
Commit message (Collapse)AuthorAge
* malloc.c: check allocation sizes against PTRDIFF_MAX.Simon Tatham2021-12-11
| | | | | | | | | | | | | | | | | | | | | | | I don't expect this to actually come up in any circumstance, but it prevents a warning in some versions of gcc that would otherwise arise from the use of 'int' to compute the input size: if gcc isn't confident that the int is positive, then it complains that possible inputs to malloc might be in the region of 2^64 - (small multiple of a negative 32-bit int). I would hope malloc would fail in any case on such an input, so failing a couple of lines earlier makes no important difference. Annoyingly, stdint.h is missing in my NestedVM build setup (though it has stdbool.h - it's not _totally_ C90). So I have to check that at cmake time. Also, removed the #defines for smalloc and friends from the tree234 test mode. These were needed in the old build system, when tree234-test was built ad-hoc without being linked against malloc.c. But now tree234-test links against the same utils library as everything else, and can use the real smalloc - and doing so prevents another of these warnings when compiling with -flto.
* malloc.c: fix copy-pasted comment from the Dawn Of Time.Simon Tatham2021-12-11
| | | | | | | | My standard 'abort on failure' wrappers around malloc and friends look more or less the same in most of my C software. In this case, they were so much the same that there was even a comment betraying that I copy-pasted them from Halibut. And nobody has noticed in the whole lifetime of this code base :-)
* Miscellaneous fixes from James Harvey's PalmOS porting work:Simon Tatham2005-06-01
| | | | | | | | | | | | | | | | | | | | - fixed numerous memory leaks (not Palm-specific) - corrected a couple of 32-bit-int assumptions (vital for Palm but generally a good thing anyway) - lifted a few function pointer types into explicit typedefs (neutral for me but convenient for the source-munging Perl scripts he uses to deal with Palm code segment rules) - lifted a few function-level static arrays into global static arrays (neutral for me but apparently works round a Palm tools bug) - a couple more presets in Rectangles (so that Palm, or any other slow platform which can't handle the larger sizes easily, can still have some variety available) - in Solo, arranged a means of sharing scratch space between calls to nsolve to prevent a lot of redundant malloc/frees (gives a 10% speed increase even on existing platforms) [originally from svn r5897]
* dupstr() should take a const char *. In particular, this allowsSimon Tatham2004-05-04
| | | | | | compilation under GTK 2. [originally from svn r4198]
* Further general development. Net is now playable, thoughSimon Tatham2004-04-26
| | | | | | configuration is absent as yet. [originally from svn r4145]
* Initial checkin of a portable framework for writing small GUI puzzleSimon Tatham2004-04-25
games. [originally from svn r4138]