diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2014-02-10 14:45:42 +0100 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2014-02-10 15:07:12 +0100 |
commit | a1ffb40e32741f992c743e7b16c061fefa3747ac (patch) | |
tree | 246a29a87b26cfd5d07b17070f85eb3785018de9 /time/tzfile.c | |
parent | 1448f3244714a9dabb5240ec18b094f100887d5c (diff) | |
download | glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip |
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'time/tzfile.c')
-rw-r--r-- | time/tzfile.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/time/tzfile.c b/time/tzfile.c index deef58ef34..52f0994815 100644 --- a/time/tzfile.c +++ b/time/tzfile.c @@ -232,7 +232,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap) > (SIZE_MAX - total_size) / sizeof (struct ttinfo), 0)) goto lose; total_size += num_types * sizeof (struct ttinfo); - if (__builtin_expect (chars > SIZE_MAX - total_size, 0)) + if (__glibc_unlikely (chars > SIZE_MAX - total_size)) goto lose; total_size += chars; if (__builtin_expect (__alignof__ (struct leap) - 1 @@ -261,16 +261,16 @@ __tzfile_read (const char *file, size_t extra, char **extrap) || tzspec_len < num_leaps * 12, 0)) goto lose; tzspec_len -= num_leaps * 12; - if (__builtin_expect (tzspec_len < num_isstd, 0)) + if (__glibc_unlikely (tzspec_len < num_isstd)) goto lose; tzspec_len -= num_isstd; - if (__builtin_expect (tzspec_len == 0 || tzspec_len - 1 < num_isgmt, 0)) + if (__glibc_unlikely (tzspec_len == 0 || tzspec_len - 1 < num_isgmt)) goto lose; tzspec_len -= num_isgmt + 1; - if (__builtin_expect (SIZE_MAX - total_size < tzspec_len, 0)) + if (__glibc_unlikely (SIZE_MAX - total_size < tzspec_len)) goto lose; } - if (__builtin_expect (SIZE_MAX - total_size - tzspec_len < extra, 0)) + if (__glibc_unlikely (SIZE_MAX - total_size - tzspec_len < extra)) goto lose; /* Allocate enough memory including the extra block requested by the @@ -310,7 +310,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap) /* Check for bogus indices in the data file, so we can hereafter safely use type_idxs[T] as indices into `types' and never crash. */ for (i = 0; i < num_transitions; ++i) - if (__builtin_expect (type_idxs[i] >= num_types, 0)) + if (__glibc_unlikely (type_idxs[i] >= num_types)) goto lose; if ((BYTE_ORDER != BIG_ENDIAN && (sizeof (time_t) == 4 || trans_width == 4)) @@ -341,18 +341,18 @@ __tzfile_read (const char *file, size_t extra, char **extrap) 0)) goto lose; c = getc_unlocked (f); - if (__builtin_expect ((unsigned int) c > 1u, 0)) + if (__glibc_unlikely ((unsigned int) c > 1u)) goto lose; types[i].isdst = c; c = getc_unlocked (f); - if (__builtin_expect ((size_t) c > chars, 0)) + if (__glibc_unlikely ((size_t) c > chars)) /* Bogus index in data file. */ goto lose; types[i].idx = c; types[i].offset = (long int) decode (x); } - if (__builtin_expect (fread_unlocked (zone_names, 1, chars, f) != chars, 0)) + if (__glibc_unlikely (fread_unlocked (zone_names, 1, chars, f) != chars)) goto lose; for (i = 0; i < num_leaps; ++i) @@ -366,7 +366,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap) else leaps[i].transition = (time_t) decode64 (x); - if (__builtin_expect (fread_unlocked (x, 1, 4, f) != 4, 0)) + if (__glibc_unlikely (fread_unlocked (x, 1, 4, f) != 4)) goto lose; leaps[i].change = (long int) decode (x); } @@ -374,7 +374,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap) for (i = 0; i < num_isstd; ++i) { int c = getc_unlocked (f); - if (__builtin_expect (c == EOF, 0)) + if (__glibc_unlikely (c == EOF)) goto lose; types[i].isstd = c != 0; } @@ -384,7 +384,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap) for (i = 0; i < num_isgmt; ++i) { int c = getc_unlocked (f); - if (__builtin_expect (c == EOF, 0)) + if (__glibc_unlikely (c == EOF)) goto lose; types[i].isgmt = c != 0; } @@ -627,7 +627,7 @@ __tzfile_compute (time_t timer, int use_localtime, __tzname[0] = NULL; __tzname[1] = NULL; - if (__builtin_expect (num_transitions == 0 || timer < transitions[0], 0)) + if (__glibc_unlikely (num_transitions == 0 || timer < transitions[0])) { /* TIMER is before any transition (or there are no transitions). Choose the first non-DST type @@ -657,9 +657,9 @@ __tzfile_compute (time_t timer, int use_localtime, ++j; } } - else if (__builtin_expect (timer >= transitions[num_transitions - 1], 0)) + else if (__glibc_unlikely (timer >= transitions[num_transitions - 1])) { - if (__builtin_expect (tzspec == NULL, 0)) + if (__glibc_unlikely (tzspec == NULL)) { use_last: i = num_transitions; @@ -671,7 +671,7 @@ __tzfile_compute (time_t timer, int use_localtime, /* Convert to broken down structure. If this fails do not use the string. */ - if (__builtin_expect (! __offtime (&timer, 0, tp), 0)) + if (__glibc_unlikely (! __offtime (&timer, 0, tp))) goto use_last; /* Use the rules from the TZ string to compute the change. */ @@ -680,7 +680,7 @@ __tzfile_compute (time_t timer, int use_localtime, /* If tzspec comes from posixrules loaded by __tzfile_default, override the STD and DST zone names with the ones user requested in TZ envvar. */ - if (__builtin_expect (zone_names == (char *) &leaps[num_leaps], 0)) + if (__glibc_unlikely (zone_names == (char *) &leaps[num_leaps])) { assert (num_types == 2); __tzname[0] = __tzstring (zone_names); @@ -762,7 +762,7 @@ __tzfile_compute (time_t timer, int use_localtime, ++j; } - if (__builtin_expect (__tzname[0] == NULL, 0)) + if (__glibc_unlikely (__tzname[0] == NULL)) __tzname[0] = __tzname[1]; i = type_idxs[i - 1]; |