X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=libserialport_internal.h;h=78b727b7a2dbbb7a506786092c77e9a8e0e372f9;hb=9caa2e86aa14e347b0a274ac023d02582a217bc8;hp=3553b124d715c819f6f956f62699f1d30dfeb86d;hpb=48a4076f692ffe34026c37815580a32b2f70592b;p=libserialport.git diff --git a/libserialport_internal.h b/libserialport_internal.h index 3553b12..78b727b 100644 --- a/libserialport_internal.h +++ b/libserialport_internal.h @@ -176,9 +176,19 @@ extern void (*sp_debug_handler)(const char *format, ...); #define RETURN_OK() RETURN_CODE(SP_OK); #define RETURN_ERROR(err, ...) do { DEBUG_ERROR(err, __VA_ARGS__); return err; } while (0) #define RETURN_FAIL(...) do { DEBUG_FAIL(__VA_ARGS__); return SP_ERR_FAIL; } while (0) -#define RETURN_VALUE(fmt, x) do { \ - typeof(x) _x = x; \ - DEBUG("%s returning " fmt, __func__, _x); \ +#define RETURN_INT(x) do { \ + int _x = x; \ + DEBUG("%s returning %d", __func__, _x); \ + return _x; \ +} while (0) +#define RETURN_STRING(x) do { \ + char *_x = x; \ + DEBUG("%s returning %s", __func__, _x); \ + return _x; \ +} while (0) +#define RETURN_POINTER(x) do { \ + void *_x = x; \ + DEBUG("%s returning %p", __func__, _x); \ return _x; \ } while (0) #define SET_ERROR(val, err, msg) do { DEBUG_ERROR(err, msg); val = err; } while (0) @@ -187,8 +197,8 @@ extern void (*sp_debug_handler)(const char *format, ...); #define TRY(x) do { int ret = x; if (ret != SP_OK) RETURN_CODEVAL(ret); } while (0) -struct sp_port **list_append(struct sp_port **list, const char *portname); +SP_PRIV struct sp_port **list_append(struct sp_port **list, const char *portname); /* OS-specific Helper functions. */ -enum sp_return get_port_details(struct sp_port *port); -enum sp_return list_ports(struct sp_port ***list); +SP_PRIV enum sp_return get_port_details(struct sp_port *port); +SP_PRIV enum sp_return list_ports(struct sp_port ***list);