X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Ftime-dst.c;h=ceca2fafae2f027288b5bc0677726a176e6b3784;hp=3950a882bf46b7600f77730452252902723653f5;hb=4de33e7f3238a6fe616e61139ab87e221572e5e5;hpb=11f22867f9cdbfc6656905861090cded91a41bd7 diff --git a/src/shared/time-dst.c b/src/shared/time-dst.c index 3950a882b..ceca2fafa 100644 --- a/src/shared/time-dst.c +++ b/src/shared/time-dst.c @@ -183,7 +183,7 @@ read_again: return -EINVAL; } - transitions = (time_t *)calloc(total_size + tzspec_len, 1); + transitions = malloc0(total_size + tzspec_len); if (transitions == NULL) return -EINVAL; @@ -207,8 +207,8 @@ read_again: if (type_idxs[i] >= num_types) return -EINVAL; - if ((BYTE_ORDER != BIG_ENDIAN && (sizeof(time_t) == 4 || trans_width == 4)) || - (BYTE_ORDER == BIG_ENDIAN && sizeof(time_t) == 8 && trans_width == 4)) { + if (BYTE_ORDER == BIG_ENDIAN ? sizeof(time_t) == 8 && trans_width == 4 + : sizeof(time_t) == 4 || trans_width == 4) { /* Decode the transition times, stored as 4-byte integers in network (big-endian) byte order. We work from the end of the array so as not to clobber the next element to be