On 6 May 2025, at 18:02, Warner Losh wrote:
> xo_emit(" <{d:%s}>", dev->dd_desc);

Missing the field name and the "/".

With "--libxo:W", you should see "foo: invalid XML tag name: '%s'".

Annoying, 'xolint' does not catch this.

+                       xo_emit(" <{d:%s}>", dev->dd_desc);
+                       xo_emit("{e:description/%s}", dev->dd_desc);


I'm not sure why you need both lines here, given that:

                       xo_emit("<{:description/%s}>", dev->dd_desc);

should suffice, since the "encoding" styles will not emit the surrounding text:

        % cat /tmp/foo.c
        #include <libxo/xo.h>

        int
        main (int argc, char **argv)
        {
            xo_parse_args(argc, argv);

            xo_open_container("data");
            xo_emit(" <{:description/%s}>\n", argv[0]);
            xo_close_container(NULL);
            xo_finish();
            return 0;
        }
        % /tmp/foo
         </tmp/foo>
        % /tmp/foo --libxo:XPW
        <data>
          <description>/tmp/foo</description>
        </data>
        % /tmp/foo --libxo:JPW
        {
          "data": {
            "description": "/tmp/foo"
          }
        }
        %

The same issue ("{d:%s}") is repeated in print_rman, etc.

+       if (xo_finish() < 0) {
+               exit(1);
        }
        return(0);

Should I make a more convenient form, so one can just:

     return xo_finish_rc(); /* xo_finish_exit_code()? */

Thanks,
 Phil


Reply via email to