Subject: Re: breaking the ABI (was Re: 'watch' libssh2 on github)

Re: breaking the ABI (was Re: 'watch' libssh2 on github)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 13 Mar 2015 09:54:34 +0100 (CET)

On Thu, 12 Mar 2015, Will Cosgrove wrote:

>> But they're different error codes, they're not in a single number range.
>
> They are in a single range across the project, look at _FX_ and _KNOWNHOST_
> errors. For example:
>
> LIBSSH2_KNOWNHOST_CHECK_MISMATCH 1
> LIBSSH2_FX_EOF 1
>
> These types of collisions are not great, IMHO.

They are the same values because they actually are in different ranges. But I
also recognize that it isn't very ovious since the functions all just return
'int' - which I think is unfortunate but really a design choice made back in
the days we still lived in caves.

Changing them to different typedef'ed variables depending on what error code
range they return would be a good thing for a future API update.

> we have a function like errorMessageFromCode(int code), the _code_ is the
> code coming from any o’l libssh function call.

But that's the mistake. All libssh2 functions don't return the same error code
set. The libssh2_knownhost*() functions for example only return error codes in
the LIBSSH2_KNOWNHOST_CHECK_* series.

-- 
  / daniel.haxx.se

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2015-03-13