Fix RETURNFUNC -- when RETURNFUNC(function) was used is was calling the function multiple times

https://github.com/Hamlib/Hamlib/issues/595
pull/608/head
Michael Black W9MDB 2021-03-10 08:24:33 -06:00
rodzic 74a10af560
commit 7b58661d12
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -142,9 +142,12 @@ extern HAMLIB_EXPORT(int) parse_hoststr(char *host, char hoststr[256], char port
void errmsg(int err, char *s, const char *func, const char *file, int line);
#define ERRMSG(err, s) errmsg(err, s, __func__, __FILENAME__, __LINE__)
#define ENTERFUNC rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):%s entered\n", __FILENAME__, __LINE__, __func__)
// we need to refer to rc just once as it
// could be a function call
#define RETURNFUNC(rc) do { \
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):%s return(%ld)\n", __FILENAME__, __LINE__, __func__, (long int) (rc)); \
return (rc); \
int rctmp = rc; \
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):%s return(%ld)\n", __FILENAME__, __LINE__, __func__, (long int) (rctmp)); \
return (rctmp); \
} while(0)
#if 0 // 5.0