1
0
mirror of https://git.disroot.org/80486DX2-66/polonium.git synced 2024-12-26 15:10:40 +05:30

common.h: remove commented code and add a note

This commit is contained in:
Intel A80486DX2-66 2024-07-11 20:29:34 +03:00
parent 743bffc9d2
commit 0833f7a4d2
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -29,33 +29,9 @@ enum configurations {
fflush(stdout); \ fflush(stdout); \
fprintf(stream, __VA_ARGS__); \ fprintf(stream, __VA_ARGS__); \
} while (0) } while (0)
/* // Intel A80486DX2-66: doesn't compile on my system
// TODO: remove this multi-line comment before merging into main branch
#define PERROR_MACRO(s) do { \
fflush(stdout); \
int errnum = errno; \
size_t err_msg_size = 256; \
char *err_msg = NULL; \
int ret = -1; \
do { \
err_msg_size *= 2; \
char* new_err_msg = realloc(err_msg, err_msg_size); \
if (new_err_msg == NULL) { \
free(err_msg); \
break; \
} \
err_msg = new_err_msg; \
ret = strerror_r(errnum, err_msg, err_msg_size); \
} while (ret == -1 && errno == ERANGE); \
if (ret == 0) { \
fprintf(stderr, "%s:%d: %s: %s\n", __FILE__, __LINE__, (s), err_msg); \
} \
free(err_msg); \
} while (0)
*/
#define PERROR_MACRO(s) do { \ #define PERROR_MACRO(s) do { \
int errnum = errno; \ int errnum = errno; \
char* err_msg = strerror(errnum); \ char* err_msg = strerror(errnum); /* XXX: Thread race possible */ \
fflush(stdout); \ fflush(stdout); \
fprintf(stderr, "%s:%d: %s: %s\n", __FILE__, __LINE__, (s), err_msg); \ fprintf(stderr, "%s:%d: %s: %s\n", __FILE__, __LINE__, (s), err_msg); \
} while (0) } while (0)