From dcb54fafb128ab41772ae217afc6a7612e2cc446 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 10 Mar 2009 13:36:56 +0100 Subject: [PATCH] cal: remove gcc-ism from nl_langinfo() call > On Tue, Mar 10, 2009 at 01:15:14PM +0100, Samuel Thibault wrote: > That will only work with the gcc compiler, which allows to read a > union field what you wrote in another. Shouldn't > (int)(intptr_t)nl_langinfo() be just fine? Signed-off-by: Karel Zak --- misc-utils/cal.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 753cc24c..2417f1b5 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -310,11 +310,7 @@ main(int argc, char **argv) { POSIX: 19971201 + 7 -1 = 0 */ { - int wfd; - union { unsigned int word; char *string; } val; - val.string = nl_langinfo(_NL_TIME_WEEK_1STDAY); - - wfd = val.word; + int wfd = (int)(intptr_t) nl_langinfo(_NL_TIME_WEEK_1STDAY); wfd = day_in_week(wfd % 100, (wfd / 100) % 100, wfd / (100 * 100)); weekstart = (wfd + *nl_langinfo(_NL_TIME_FIRST_WEEKDAY) - 1) % 7; } -- 2.39.5