On 10/10/14 12:27, Gisle Vanem wrote:
The recent change to progress.c doesn't compile with
'USE_NLS_PROGRESS_BAR = 0'. The error from gcc was:
progress.c:843:35: error: "*" may not appear in macro parameter list
progress.c: In function 'create_image':
progress.c:975:7: warning: implicit declaration of function
'cols_to_bytes' [-Wimplicit-function-declaration]
Well caught.
This patch works here:
--- Git-latest/src/progress.c 2014-10-09 21:14:26 +0000
+++ src/progress.c 2014-10-10 12:11:33 +0000
@@ -840,10 +840,8 @@
}
#else
# define count_cols(mbs) ((int)(strlen(mbs)))
-# define cols_to_bytes(mbs, cols, *ncols) do { \
- *ncols = cols; \
- bytes = cols; \
-}while (0)
+# define cols_to_bytes(mbs, cols, ncols) ( \
+ *ncols = cols), cols
#endif
-----------
And since the ret-val from cols_to_bytes() is used, the 'do { } while(0)'
had to go.
You don't even need the comma operator:
diff --git a/src/progress.c b/src/progress.c
index 5ba542d..1c53bd0 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -840,10 +840,7 @@ cols_to_bytes (const char *mbs, const int cols, int
*ncols)
}
#else
# define count_cols(mbs) ((int)(strlen(mbs)))
-# define cols_to_bytes(mbs, cols, *ncols) do { \
- *ncols = cols; \
- bytes = cols; \
-}while (0)
+# define cols_to_bytes(mbs, cols, ncols) *ncols = cols
#endif
static const char *