Skip to content

Commit

Permalink
Remove unused code and update docos.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Mar 6, 2024
1 parent 30fedd6 commit 9973668
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 51 deletions.
2 changes: 1 addition & 1 deletion doc/body.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ integrated Mini-XML into Gutenprint and removed libxml2.

Thanks to lots of feedback and support from various developers, Mini-XML has
evolved since then to provide a more complete XML implementation and now stands
at a whopping 4,371 lines of code, compared to 175,808 lines of code for libxml2
at a whopping 3,751 lines of code, compared to 175,808 lines of code for libxml2
version 2.11.7.


Expand Down
Binary file modified doc/mxml.epub
Binary file not shown.
2 changes: 1 addition & 1 deletion doc/mxml.html
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ <h3 class="title" id="history">History</h3>
<p>Given the limited scope of what you use in XML, it should be trivial to code a mini-XML API in a few hundred lines of code.</p>
</blockquote>
<p>I took my own challenge and coded furiously for two days to produced the initial public release of Mini-XML, total lines of code: 696. Robert promptly integrated Mini-XML into Gutenprint and removed libxml2.</p>
<p>Thanks to lots of feedback and support from various developers, Mini-XML has evolved since then to provide a more complete XML implementation and now stands at a whopping 4,371 lines of code, compared to 175,808 lines of code for libxml2 version 2.11.7.</p>
<p>Thanks to lots of feedback and support from various developers, Mini-XML has evolved since then to provide a more complete XML implementation and now stands at a whopping 3,751 lines of code, compared to 175,808 lines of code for libxml2 version 2.11.7.</p>
<h3 class="title" id="resources">Resources</h3>
<p>The Mini-XML home page can be found at <a href="https://www.msweet.org/mxml">https://www.msweet.org/mxml</a>. From there you can download the current version of Mini-XML, access the issue tracker, and find other resources.</p>
<h3 class="title" id="legal-stuff">Legal Stuff</h3>
Expand Down
49 changes: 0 additions & 49 deletions mxml-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ static inline int mxml_isspace(int ch)
}
static mxml_node_t *mxml_load_data(mxml_read_cb_t read_cb, void *read_cbdata, mxml_node_t *top, mxml_load_cb_t load_cb, void *load_cbdata, mxml_sax_cb_t sax_cb, void *sax_data);
static int mxml_parse_element(mxml_read_cb_t read_cb, void *read_cbdata, mxml_node_t *node, _mxml_encoding_t *encoding, int *line);
static bool mxml_putc(mxml_write_cb_t write_cb, void *write_cbdata, int ch);
static ssize_t mxml_read_cb_fd(int *fd, void *buffer, size_t bytes);
static ssize_t mxml_read_cb_file(FILE *fp, void *buffer, size_t bytes);
static ssize_t mxml_read_cb_string(_mxml_stringbuf_t *sb, void *buffer, size_t bytes);
Expand Down Expand Up @@ -1825,54 +1824,6 @@ mxml_parse_element(
}


//
// 'mxml_putc()' - Write a single Unicode character with UTF-8 encoding.
//

static bool // O - `true` on success, `false` on error
mxml_putc(mxml_write_cb_t write_cb, // I - Write callback function
void *write_cbdata,// I - Write callback data
int ch) // I - Character to write
{
size_t bytes; // Number of bytes
unsigned char buffer[4]; // Output buffer


if (ch < 128)
{
// One byte
bytes = 1;
buffer[0] = (unsigned char)ch;
}
else if (ch < 0x800)
{
// Two bytes
bytes = 2;
buffer[0] = (unsigned char)(0xc0 | ((ch >> 6) & 0x1f));
buffer[1] = (unsigned char)(0x80 | (ch & 0x3f));
}
else if (ch < 0x10000)
{
// Three bytes
bytes = 3;
buffer[0] = (unsigned char)(0xe0 | ((ch >> 12) & 0x0f));
buffer[1] = (unsigned char)(0x80 | ((ch >> 6) & 0x3f));
buffer[2] = (unsigned char)(0x80 | (ch & 0x3f));
}
else
{
// Four bytes
bytes = 4;
buffer[0] = (unsigned char)(0xf0 | ((ch >> 18) & 0x07));
buffer[1] = (unsigned char)(0x80 | ((ch >> 12) & 0x3f));
buffer[2] = (unsigned char)(0x80 | ((ch >> 6) & 0x3f));
buffer[3] = (unsigned char)(0x80 | (ch & 0x3f));
}

return ((write_cb)(write_cbdata, buffer, bytes) == (ssize_t)bytes);
}


//
// 'mxml_read_cb_fd()' - Read bytes from a file descriptor.
//
Expand Down

0 comments on commit 9973668

Please sign in to comment.