On Tue, 23 Feb 2010, Alexander Lamaison wrote:
> Why is it a macro rather than a function?
>
> Can we make it a function that return the error code we pass it? This
> simplifies code like this:
>
> if(type != LIBSSH2_KNOWNHOST_FILE_OPENSSH)
> return libssh2_error(hosts->session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
> "Unsupported type of known-host
> information store", 0);
>
> which is clearer and eliminates the source of error that comes from having
> to duplicate the error code (very easy to forget to keep them consistent).
Oh I'm all for that! It'll clean up things.
And it struck me that we can also probably (later on) add some debug code in
that function (only present when built with some debug option switched on)
that checks if the function is called multiple times before libssh2 returns,
as that would be a hint that perhaps we've done something wrong internally.
-- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2010-02-24