<feed xmlns='http://www.w3.org/2005/Atom'>
<title>puzzles/malloc.c, branch devel</title>
<subtitle>My sgt-puzzles tree</subtitle>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/'/>
<entry>
<title>malloc.c: check allocation sizes against PTRDIFF_MAX.</title>
<updated>2021-12-11T11:59:25+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2021-12-11T11:13:00+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=57fbcd2b29aa74423d47a9efd783a1508ab1bfc5'/>
<id>57fbcd2b29aa74423d47a9efd783a1508ab1bfc5</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>malloc.c: fix copy-pasted comment from the Dawn Of Time.</title>
<updated>2021-12-11T11:16:36+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2021-12-11T11:12:06+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=5c5c607fdb834bc73033736f5774ef53c42008aa'/>
<id>5c5c607fdb834bc73033736f5774ef53c42008aa</id>
<content type='text'>
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 :-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 :-)
</pre>
</div>
</content>
</entry>
<entry>
<title>Miscellaneous fixes from James Harvey's PalmOS porting work:</title>
<updated>2005-06-01T17:47:56+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2005-06-01T17:47:56+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=50edaa578b614eb74c57a38faa2d05ab628ff81b'/>
<id>50edaa578b614eb74c57a38faa2d05ab628ff81b</id>
<content type='text'>
 - 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]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 - 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]
</pre>
</div>
</content>
</entry>
<entry>
<title>dupstr() should take a const char *. In particular, this allows</title>
<updated>2004-05-04T09:56:38+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2004-05-04T09:56:38+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=2f999a9a595714fe62630b68065cee8d668ba13e'/>
<id>2f999a9a595714fe62630b68065cee8d668ba13e</id>
<content type='text'>
compilation under GTK 2.

[originally from svn r4198]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
compilation under GTK 2.

[originally from svn r4198]
</pre>
</div>
</content>
</entry>
<entry>
<title>Further general development. Net is now playable, though</title>
<updated>2004-04-26T17:10:44+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2004-04-26T17:10:44+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=9867234e70002b8252a48c2bc023875ff87b8ca1'/>
<id>9867234e70002b8252a48c2bc023875ff87b8ca1</id>
<content type='text'>
configuration is absent as yet.

[originally from svn r4145]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
configuration is absent as yet.

[originally from svn r4145]
</pre>
</div>
</content>
</entry>
<entry>
<title>Initial checkin of a portable framework for writing small GUI puzzle</title>
<updated>2004-04-25T14:27:58+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2004-04-25T14:27:58+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=96dbb537ee14f992459a8359a113a78414addf9d'/>
<id>96dbb537ee14f992459a8359a113a78414addf9d</id>
<content type='text'>
games.

[originally from svn r4138]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
games.

[originally from svn r4138]
</pre>
</div>
</content>
</entry>
</feed>
