1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Add SP_ERR_MEM failure code.

This commit is contained in:
Martin Ling 2013-11-03 20:21:36 +00:00 committed by Uwe Hermann
parent 1ebf4347e0
commit e9a2f9c9d3
2 changed files with 8 additions and 5 deletions

5
README
View File

@ -65,9 +65,10 @@ Most functions take a pointer to a struct sp_port, which represents an open
port. This structure should be allocated by the user and is populated by
sp_open(). It can be freed safely after sp_close().
All functions can return only two possible error values. SP_ERR_ARG indicates
All functions can return only three possible error values. SP_ERR_ARG indicates
the function was called with invalid arguments. SP_ERR_FAIL indicates that the
OS reported a failure. Both these error values are negative.
OS reported a failure. SP_ERR_MEM indicates that a memory allocation failed.
Aoth these error values are negative.
When SP_ERR_FAIL is returned, an error code or string description of the error
can be obtained by calling sp_last_error_code() or sp_last_error_message(). The

View File

@ -41,10 +41,12 @@ struct sp_port {
enum {
/* Operation completed successfully. */
SP_OK = 0,
/* A system error occured while executing the operation. */
SP_ERR_FAIL = -1,
/* Invalid arguments were passed to the function. */
SP_ERR_ARG = -2
SP_ERR_ARG = -1,
/* A system error occured while executing the operation. */
SP_ERR_FAIL = -2,
/* A memory allocation failed while executing the operation. */
SP_ERR_MEM = -3
};
/* Port access modes. */