Hi all,

I am writing my first dlfunc. My question is: Is it ok to return a
pointer to a static string? I could not find answer to this in the
documentation.

Consider the following example:

#include "local_scan.h"

int foobar(uschar **yield, int argc, uschar *argv[])
{
        *yield = US"foobar";
        return OK;
}

Is the above correct, or should I write the following instead?

        *yield = string_copy(US"foobar");

The first version seems to work fine, but when looking at dlfuncs
written by other people I often see the second alternative which makes a
copy of the original string. Why?

Best Regards,
-- 
Janne Snabb / EPIPE Communications
[email protected] - http://epipe.com/

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to