It's ok, but not recommended, since OW_init calls API_init:

GOOD_OR_BAD API_init(const char *command_line)
{
    GOOD_OR_BAD return_code = gbGOOD;

    LEVEL_DEBUG("OWLIB started with <%s>",SAFESTRING(command_line));

    if (StateInfo.owlib_state == lib_state_pre) {
        LibSetup(Globals.program_type);    // use previous or default value
        StateInfo.owlib_state = lib_state_setup;
    }
    LIB_WLOCK;
    // stop if started
    if (StateInfo.owlib_state == lib_state_started) {
        LibStop();
        StateInfo.owlib_state = lib_state_setup;
    }
    // now restart
    if (StateInfo.owlib_state == lib_state_setup) {
        return_code = owopt_packed(command_line);
        if ( BAD(return_code) ) {
            goto init_exit ;
        }

        return_code = LibStart();
        if ( BAD(return_code) ) {
            goto init_exit ;
        }

        StateInfo.owlib_state = lib_state_started;
    }

So if called a second time, it closes everything and restarts. That's fine
if that's what you wanted to do. If you just want to init-if-needed, not
quite what you want.

I can certainly add a function to init-if-needed. Would that be helpful?

Paul


On Fri, Jan 31, 2014 at 4:05 PM, Sven Geggus <[email protected]>wrote:

> Sven Geggus <[email protected]> wrote:
>
> > is there a possibility to tell if OW_init has already been called and
> > if not will I risk memory leaks if OW_init is called more than once?
>
> Hm, I just saw, that I could use OW_present("/") but this just
> returns -1:
>
> int main() {
>   OW_init("localhost:4304");
>   printf("%d\n",OW_present("/"));
> }
>
> Will give me -1 all the time.
>
> owfs is 2.8p15 from debian stable.
>
> Sven
>
> --
> "and on the third day he rebooted into Linux-1.3.84"
>                                 (Linus Torvalds, Easter Kernel Release
> 1996)
>
> /me is giggls@ircnet, http://sven.gegg.us/ on the Web
>
>
> ------------------------------------------------------------------------------
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> _______________________________________________
> Owfs-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to