* Create a handle for use by later libxo functions. * * Note: normal use of libxo does not require a distinct handle, since * the default handle (used when NULL is passed) generates text on stdout. * * @param style Style of output desired (XO_STYLE_* value) * @param flags Set of XOF_* flags in use with this handle * @return Newly allocated handle * @see xo_destroy */
| 1865 | * @see xo_destroy |
| 1866 | */ |
| 1867 | xo_handle_t * |
| 1868 | xo_create (xo_style_t style, xo_xof_flags_t flags) |
| 1869 | { |
| 1870 | xo_handle_t *xop = xo_realloc(NULL, sizeof(*xop)); |
| 1871 | |
| 1872 | if (xop) { |
| 1873 | bzero(xop, sizeof(*xop)); |
| 1874 | |
| 1875 | xop->xo_style = style; |
| 1876 | XOF_SET(xop, flags); |
| 1877 | xo_init_handle(xop); |
| 1878 | xop->xo_style = style; /* Reset style (see LIBXO_OPTIONS) */ |
| 1879 | } |
| 1880 | |
| 1881 | return xop; |
| 1882 | } |
| 1883 | |
| 1884 | /** |
| 1885 | * Create a handle that will write to the given file. Use |
no test coverage detected