On Sun, May 8, 2011 at 12:00 AM, Daniel Nichter <[email protected]> wrote:
> Hello,
>
> I have a working plugin which I'll push to Launchpad soon.  I have a question 
> about using the update_func_arg of class sys_var_std_string to create a 
> dynamic variable.  My plugin's class has a file descriptor to the open query 
> log file, but the update function can't access it because it doesn't receive 
> a pointer to the plugin's class.  I can make the file descriptor var global 
> in my plugin's namespace, but I'd like to keep everything inside the class.  
> Is this possible?  I tried hacking and casting and passing a pointer to a 
> non-static member function of the class, but I couldn't get that to work.  My 
> update function is currently:
>
> bool update_file(Session *, set_var *var)
> {
>  const char *new_file= var->value->str_value.ptr();
>
>  if (fd)
>    close(fd);
>  fd= open_log_file(new_file);
>  if (fd < 0)
>    return false;  // error
>
>  sysvar_file= new_file;
>
>  return false;  // success
> }

Hi,

What does return false; mean? Error or success? ;)

>
> fd and sysvar_file are global in the plugin's namespace.  Does that code look 
> correct?

I don't know, but you might want to prefix global vars with g_.


Olaf

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to