From 76dfa6e351952e60893e236022df54a23a558b65 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 6 Jan 2016 09:15:02 -0800 Subject: [PATCH] Remove mktime_tz. Bug: http://b/15765976 Change-Id: Ifc8cd19ae621e611d66173ae927ef9a0445965c1 --- libc/libc.arm.brillo.map | 1 - libc/libc.arm.map | 1 - libc/libc.arm64.map | 1 - libc/libc.map.txt | 1 - libc/libc.mips.brillo.map | 1 - libc/libc.mips.map | 1 - libc/libc.mips64.map | 1 - libc/libc.x86.brillo.map | 1 - libc/libc.x86.map | 1 - libc/libc.x86_64.map | 1 - libc/private/bionic_time.h | 41 --------------------------------- libc/tzcode/localtime.c | 46 -------------------------------------- 12 files changed, 97 deletions(-) delete mode 100644 libc/private/bionic_time.h diff --git a/libc/libc.arm.brillo.map b/libc/libc.arm.brillo.map index 317b3b2d3..6c6d9aac1 100644 --- a/libc/libc.arm.brillo.map +++ b/libc/libc.arm.brillo.map @@ -687,7 +687,6 @@ LIBC { mktemp; mktime; mktime64; # arm x86 mips - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.arm.map b/libc/libc.arm.map index efd1106f6..8bc8033a8 100644 --- a/libc/libc.arm.map +++ b/libc/libc.arm.map @@ -688,7 +688,6 @@ LIBC { mktemp; mktime; mktime64; # arm x86 mips - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map index 530706dd7..dcf1e8f6a 100644 --- a/libc/libc.arm64.map +++ b/libc/libc.arm64.map @@ -581,7 +581,6 @@ LIBC { mkstemps64; mktemp; mktime; - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.map.txt b/libc/libc.map.txt index d2e2b1ba4..90a0634db 100644 --- a/libc/libc.map.txt +++ b/libc/libc.map.txt @@ -691,7 +691,6 @@ LIBC { mktemp; mktime; mktime64; # arm x86 mips - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.mips.brillo.map b/libc/libc.mips.brillo.map index f268509ed..3db3197a8 100644 --- a/libc/libc.mips.brillo.map +++ b/libc/libc.mips.brillo.map @@ -673,7 +673,6 @@ LIBC { mktemp; mktime; mktime64; # arm x86 mips - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.mips.map b/libc/libc.mips.map index a72d680a7..9b506641e 100644 --- a/libc/libc.mips.map +++ b/libc/libc.mips.map @@ -674,7 +674,6 @@ LIBC { mktemp; mktime; mktime64; # arm x86 mips - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map index 530706dd7..dcf1e8f6a 100644 --- a/libc/libc.mips64.map +++ b/libc/libc.mips64.map @@ -581,7 +581,6 @@ LIBC { mkstemps64; mktemp; mktime; - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.x86.brillo.map b/libc/libc.x86.brillo.map index 333b4193c..b82f9899c 100644 --- a/libc/libc.x86.brillo.map +++ b/libc/libc.x86.brillo.map @@ -671,7 +671,6 @@ LIBC { mktemp; mktime; mktime64; # arm x86 mips - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.x86.map b/libc/libc.x86.map index 06640f009..24a5f7045 100644 --- a/libc/libc.x86.map +++ b/libc/libc.x86.map @@ -672,7 +672,6 @@ LIBC { mktemp; mktime; mktime64; # arm x86 mips - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map index 530706dd7..dcf1e8f6a 100644 --- a/libc/libc.x86_64.map +++ b/libc/libc.x86_64.map @@ -581,7 +581,6 @@ LIBC { mkstemps64; mktemp; mktime; - mktime_tz; mlock; mlockall; mmap; diff --git a/libc/private/bionic_time.h b/libc/private/bionic_time.h deleted file mode 100644 index 030dcfd99..000000000 --- a/libc/private/bionic_time.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _BIONIC_TIME_H -#define _BIONIC_TIME_H - -#include -#include - -__BEGIN_DECLS - -// We can't remove this (and this file) until we fix MtpUtils.cpp. -time_t mktime_tz(struct tm* const, char const*); - -__END_DECLS - -#endif /* _BIONIC_TIME_H */ diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c index b1ebb24cc..f370e8798 100644 --- a/libc/tzcode/localtime.c +++ b/libc/tzcode/localtime.c @@ -2462,50 +2462,4 @@ static int __bionic_open_tzdata(const char* olson_id) { return fd; } -// Caches the most recent timezone (http://b/8270865). -static int __bionic_tzload_cached(const char* name, struct state* const sp, const int doextend) { - lock(); - - // Our single-item cache. - static char* g_cached_time_zone_name; - static struct state g_cached_time_zone; - - // Do we already have this timezone cached? - if (g_cached_time_zone_name != NULL && strcmp(name, g_cached_time_zone_name) == 0) { - *sp = g_cached_time_zone; - unlock(); - return 0; - } - - // Can we load it? - int rc = tzload(name, sp, doextend); - if (rc == 0) { - // Update the cache. - free(g_cached_time_zone_name); - g_cached_time_zone_name = strdup(name); - g_cached_time_zone = *sp; - } - - unlock(); - return rc; -} - -// Non-standard API: mktime(3) but with an explicit timezone parameter. -// This can't actually be hidden/removed until we fix MtpUtils.cpp -__attribute__((visibility("default"))) time_t mktime_tz(struct tm* const tmp, const char* tz) { - struct state* st = malloc(sizeof(*st)); - time_t return_value; - - if (st == NULL) - return 0; - if (__bionic_tzload_cached(tz, st, true) != 0) { - // TODO: not sure what's best here, but for now, we fall back to gmt. - gmtload(st); - } - - return_value = time1(tmp, localsub, st, 0L); - free(st); - return return_value; -} - // END android-added