2 * This file is part of the libjaylink project.
4 * Copyright (C) 2014 Marc Schink <jaylink-dev@marcschink.de>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "libjaylink.h"
29 * Return a human-readable description of a libjaylink error code.
31 * @param error_code A libjaylink error code. See #jaylink_error for valid
34 * @return A string which describes the given error code or the string
35 * <i>unknown error</i> if the error code is not known. The string is
36 * null-terminated and must not be free'd by the caller.
38 const char *jaylink_strerror(int error_code
)
44 return "unspecified error";
45 case JAYLINK_ERR_MALLOC
:
46 return "memory allocation error";
48 return "invalid argument";
49 case JAYLINK_ERR_TIMEOUT
:
50 return "timeout occurred";
52 return "unknown error";
57 * Return the name of a libjaylink error code.
59 * @param error_code A libjaylink error code. See #jaylink_error for valid
62 * @return A string which contains the name for the given error code or the
63 * string <i>unknown error code</i> if the error code is not known. The
64 * string is null-terminated and must not be free'd by the caller.
66 const char *jaylink_strerror_name(int error_code
)
73 case JAYLINK_ERR_MALLOC
:
74 return "JAYLINK_ERR_MALLOC";
76 return "JAYLINK_ERR_ARG";
77 case JAYLINK_ERR_TIMEOUT
:
78 return "JAYLINK_ERR_TIMEOUT";
80 return "unknown error code";