Commit Graph
9 Commits
Author SHA1 Message Date
jessica parsons ff09a191cd add a prototype for memset() because gcc/clang/whatever on macos ventura gets a sad when it doesn't see one 2025-09-11 12:58:45 -07:00
jessica parsons 63c7eb3d86 change amalloc so it fills malloc()ed memory with a nun-null pattern, which found a WHOLE BUNCH of places where I was not null-terminating strings but instead was taking advantage of amalloc always zeroing new allocations. 2025-09-08 09:50:17 -07:00
david parsons 793268533e Add config.h to the includes for amalloc (for the if #define to make clang stfu) 2016-03-22 16:09:58 -07:00
david parsons 56005d0d30 Make amalloc() even more paranoid by dropping a marker at the end of each
allocated memory block and abort()ing if that marker is corrupted when the
memory is freed or reallocated.
2016-02-16 08:04:23 -08:00
david parsons 5dd6f4c69e More work on markdown extra-style definition lists 2010-12-09 13:42:20 -08:00
david parsons ed662dfea3 Implement a somewhat better way of handling embedded emphasis,
by writing compiled output into a token queue, then running
an emphasis maker on that queue.  The token queue is an array
of TEXT and EMPHASIS tokens -- `TEXT` being what you'd expect,
and `EMPHASIS` holding counts of consecutive emphasis characters.

It's easier to explain with pretty pictures:

During the process of compiling the string `***HI***`, it gets
broken into five tokens:

1. TEXT `<p>`
2. EMPHASIS `*`3
3. TEXT `HI`
4. EMPHASIS `*`3
5. TEXT `</p>`

and then pasted together into a compiled document.  During the
pasting, emphasis tokens are paired with the next matching emphasis
token, then rewritten into two text sections (opens & closes) which
are treated as normal text during the pasting.

The above tokens are processed like so;  first to

1. TEXT `<p>`
2. EMPHASIS `*`1 [] [`<strong>`]
3. TEXT `HI`
4. EMPHASIS `*`1 [`</strong>`] []
5. TEXT `</p>`

then to

1. TEXT `<p>`
2. EMPHASIS `*`0 [] [`<strong><em>`]
3. TEXT `HI`
4. EMPHASIS `*`0 [`</em></strong>`] []
5. TEXT `</p>`

which is then concatenated to

    <p><strong><em>HI</em></strong></p>

And Bob's your uncle.
2008-04-10 15:49:19 -07:00
david parsons 4cd2ad9dcb Fix another bug -- I wasn't sizing the header properly
in `realloc()`
2008-04-03 11:42:27 -07:00
david parsons 44376ed97c Correct the (broken) header for afree() 2008-04-03 11:34:31 -07:00
david parsons 5c6115c601 1. Add the new amalloc module, which (if enabled with
--enable-amalloc) replaced malloc and its ilk with
    versions that attempt to maintain a linked list of
    allocated blocks that can be printed to stderr with
    the `adump()` function.

2.  Clean up a couple more places where I leak memory
    during the first level parse.

3.  tweak cstring.h to try to chase down places where
    the C compiler might optimize EXPAND() into producing
    broken code.
2008-04-03 11:22:07 -07:00