Changes To Manual for lc_cleanup

Changes to "Manual for lc_cleanup" between 2014-11-24 20:10:44 and 2014-11-24 20:11:48

            1  +<H2>NAME</H2>
            2  +lc_cleanup - Clean up internal structures after processing data.
            3  +<P>
            4  +<A NAME="lbAC">&nbsp;</A>
            5  +<H2>SYNOPSIS</H2>
            6  +<B>#include &lt;<A HREF="artifact/7c61a9805e664fde7943807af8d5e164e7cebdb6">libconfig.h</A>&gt;</B>
            7  +<P>
            8  +<B>void lc_cleanup(void);</B>
            9  +<P>
           10  +<A NAME="lbAD">&nbsp;</A>
           11  +<H2>DESCRIPTION</H2>
           12  +The
           13  +<B><A HREF="wiki/Manual for lc_cleanup">lc_cleanup</A></B>(3)
           14  +function cleans up the internal structures created by calling
           15  +<B><A HREF="wiki/Manual for lc_register_var">lc_register_var</A></B>(3)
           16  +or
           17  +<B><A HREF="wiki/Manual for lc_register_callback">lc_register_callback</A></B>(3)
           18  +and returns the memory to the application.  It is not strictly required, however memory concious programmers will still want to call this after finishing processing configuration files.
           19  +<P>
           20  +After you call
           21  +<B><A HREF="wiki/Manual for lc_cleanup">lc_cleanup</A></B>(3)
           22  +calling
           23  +<B><A HREF="wiki/Manual for lc_process">lc_process</A></B>(3)
           24  +or
           25  +<B><A HREF="wiki/Manual for lc_process_file">lc_process_file</A></B>(3)
           26  +will generally cause errors since the registered variables and callbacks have been unregistered.
           27  +<P>
           28  +<A NAME="lbAE">&nbsp;</A>
           29  +<H2>EXAMPLE</H2>
           30  +<PRE>
           31  +#include &lt;<A HREF="artifact/7c61a9805e664fde7943807af8d5e164e7cebdb6">libconfig.h</A>&gt;
           32  +#include &lt;<A HREF="file:/usr/include/stdlib.h">stdlib.h</A>&gt;
           33  +#include &lt;<A HREF="file:/usr/include/stdio.h">stdio.h</A>&gt;
           34  +int main(int argc, char **argv) {
           35  +        int lc_p_ret, lc_rv_ret;
           36  +        char *filename = NULL;
           37  +        lc_rv_ret = lc_register_var(&quot;File&quot;, LC_VAR_STRING,
           38  +                                    &amp;filename, 'f');
           39  +        if (lc_rv_ret != 0) {
           40  +                fprintf(stderr, &quot;Error registering variable: %i.\n&quot;,
           41  +                        lc_geterrno());
           42  +                return(EXIT_FAILURE);
           43  +        }
           44  +        lc_p_ret = lc_process(argc, argv, &quot;example&quot;, LC_CONF_APACHE,
           45  +                              NULL);
           46  +        lc_cleanup();
           47  +        if (lc_p_ret != 0) {
           48  +                fprintf(stderr, &quot;Error processing configuration: \
           49  +                        %s\n&quot;, lc_geterrstr());
           50  +                return(EXIT_FAILURE);
           51  +        }
           52  +        if (filename != NULL) {
           53  +                printf(&quot;File specified was: %s\n&quot;, filename);
           54  +        } else {
           55  +                printf(&quot;No filename specified.\n&quot;);
           56  +        }
           57  +        return(EXIT_SUCCESS);
           58  +}
           59  +</PRE>
           60  +<P>
           61  +<A NAME="lbAF">&nbsp;</A>
           62  +<H2>SEE ALSO</H2>
           63  +<B><A HREF="wiki/Manual">libconfig</A></B>(3),
           64  +<B><A HREF="wiki/Manual for lc_register_var">lc_register_var</A></B>(3),
           65  +<B><A HREF="wiki/Manual for lc_register_callback">lc_register_callback</A></B>(3),
           66  +<B><A HREF="wiki/Manual for lc_geterrno">lc_geterrno</A></B>(3),
           67  +<B><A HREF="wiki/Manual for lc_geterrstr">lc_geterrstr</A></B>(3),
           68  +<B><A HREF="wiki/Manual for lc_seterrstr">lc_seterrstr</A></B>(3),
           69  +<B><A HREF="wiki/Manual for lc_handle_type">lc_handle_type</A></B>(3),
           70  +<B><A HREF="wiki/Manual for lc_process">lc_process</A></B>(3),
           71  +<B><A HREF="wiki/Manual for lc_process_file">lc_process_file</A></B>(3)
           72  +<P>