mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
macros.h: Make FLAC_CHECK_RETURN print to stderr
Also comment the fact that this macro should only be used for things that are extremely unlikely to fail.
This commit is contained in:
@@ -32,10 +32,14 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/* FLAC_CHECK_RETURN : Check the return value of the provided function and
|
/* FLAC_CHECK_RETURN : Check the return value of the provided function and
|
||||||
* print and error message if it fails (ie returns a value < 0).
|
* print an error message if it fails (ie returns a value < 0).
|
||||||
|
*
|
||||||
|
* Ideally, a library should not print anything, but this macro is only used
|
||||||
|
* for things that extremely unlikely to fail, like `chown` to a previoulsy
|
||||||
|
* saved `uid`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FLAC_CHECK_RETURN(x) \
|
#define FLAC_CHECK_RETURN(x) \
|
||||||
{ if ((x) < 0) \
|
{ if ((x) < 0) \
|
||||||
printf ("%s : %s\n", #x, strerror (errno)) ; \
|
fprintf (stderr, "%s : %s\n", #x, strerror (errno)) ; \
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user