From 99736682f1f28d933cd4edd6153e014817b9adc8 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 6 Mar 2024 17:13:13 -0500 Subject: [PATCH] Remove unused code and update docos. --- doc/body.md | 2 +- doc/mxml.epub | Bin 720252 -> 720252 bytes doc/mxml.html | 2 +- mxml-file.c | 49 ------------------------------------------------- 4 files changed, 2 insertions(+), 51 deletions(-) diff --git a/doc/body.md b/doc/body.md index 655f911..06fb035 100644 --- a/doc/body.md +++ b/doc/body.md @@ -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. diff --git a/doc/mxml.epub b/doc/mxml.epub index beda56c2b8fb9421d411c4939d6ff9266cfbfa3e..1281549bee4e8b3cbe07f21075a5a7ab0634a815 100644 GIT binary patch delta 627 zcmezKOZ(3+ZJq#cW)=|!5LnbXk;j4wNV=(l$lSX?aw20XuzVkMhF?%A$D`R1U&_MkvUAZ7w$W*}w(Vpbq#17da{<^W>O?LmQD8y12MTIqGc zbUN2(F2(xU1_H<5S8|=ct~;Y<#ae+4tEzIBWNn|iYOm!thP;pNy`EfqPX+fHsOKeKDrq=PHwGpl$tajpt`;JvEeaN;_#`MSSCw4Jzk z8@=UzxLQn4x>(lye$hG+9;*v0u5K>fl~z)kc=45eYY*QGMOV3y7YlA_FP@bD+dpM` z+LO)Od!I)oFHSjs_Q38Y-6xYYY(6B|F6)}+>@IiWF{gq{$-lD3<9;2VuQl>NpX4QY z;I-X#3on_*C0EsMznPRXJH891Wq-Zko66ZeeEBEZr^kHZQf73V-tdLXJ>d@9n&ylNUFr|tTx4g3@?u(z~ zjzD)!lZdRCNowm7F5iz?`;P&V8kiV3fT>}-`d6-eHee)ApYfZ^1Vo?v&1DLrS^sc3 lfoRV^Tt@KJF}?W@ml;TO_a826L{$I#!(|QO?LmQD8y12MiqTo& zKb`9{mty^81A*i3Yq?H`d(5dj;4~$rbw?2A+oqNsJHM$I9+9{3+g+;?*Q}oWNG(&G zub^|z$^3u+XMS9=qyCbtWz+kqrmC^aB~=qzrk*lUm35lCXW{p&s|sRjp7RPU@r}P^ z#xmWw%xZ3sYV6#o`x|_x-8Foj<;AwRj%R`fr`n3BM*Wq?>Ron4)ognayp}`Lghj9N zf%wCiF4x<<`?_}p8N6^<9CrTN%UKt%wz{sa7csJ0&@NILu&_C6eUI0^H}(@^XHD$C zXErapw|A1QIrDq2Z4SpPfb zu|^@wq_EjJo4q&XPTFhyZ%f_m_i;~e-o4(`n;E{lZ+6-N%kYFr=ld_Fa_UY9_m%$j zYH#WD3YGnJLT@T(_webT+&w+!3zssZ!}NwPT>Oz2X7_~t^F^>xjI%zDb* z^W%^FowLs0(Y|wo{Zjt0dFgLI{`vo?KHK*7dnHNdmBwd_kDk~dG4FZ7<*JL;sSn&_ zmtII%S?D=yN0V=T@z!6wkkr7$zyVAR+tt5v<+A}JdHRgsTqYp;+;1*Z5Y76B%Lzn# i{^2r$r;h2(f4Iy*qPzcaStFwQ-ybe>kf`}zE>{59ju-3z diff --git a/doc/mxml.html b/doc/mxml.html index 17a5334..acd0082 100644 --- a/doc/mxml.html +++ b/doc/mxml.html @@ -428,7 +428,7 @@ span.string {

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.

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.

-

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.

+

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.

Resources

The Mini-XML home page can be found at https://www.msweet.org/mxml. From there you can download the current version of Mini-XML, access the issue tracker, and find other resources.

diff --git a/mxml-file.c b/mxml-file.c index 2d88f2a..bbd0aee 100644 --- a/mxml-file.c +++ b/mxml-file.c @@ -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); @@ -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. //