While on the topic of libssh2_error, I have a few questions:
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) {
libssh2_error(hosts->session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED,
"Unsupported type of known-host information store", 0);
return LIBSSH2_ERROR_METHOD_NOT_SUPPORTED;
}
to 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).
Alex
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-02-23