diff options
author | Elliott Hughes <enh@google.com> | 2015-04-02 15:39:33 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-04-02 15:39:33 -0700 |
commit | 2040031f7b6ad64db395c78eb650b90c6871b029 (patch) | |
tree | 5038627a8a511c0f49975951f08c1f3ba2651b59 /libcutils | |
parent | 34efe4cf1ad8d080b37fc02bf55e42eb2ea643b6 (diff) | |
download | system_core-2040031f7b6ad64db395c78eb650b90c6871b029.zip system_core-2040031f7b6ad64db395c78eb650b90c6871b029.tar.gz system_core-2040031f7b6ad64db395c78eb650b90c6871b029.tar.bz2 |
Be more intention-revealing with libcutils' strlcpy.
Several people have been independently confused about when this gets
built and why over the past couple of days.
Change-Id: I2d4a02f66e24c0734327585b7d27e50a344b1e94
Diffstat (limited to 'libcutils')
-rw-r--r-- | libcutils/Android.mk | 2 | ||||
-rw-r--r-- | libcutils/strlcpy.c (renamed from libcutils/memory.c) | 26 |
2 files changed, 8 insertions, 20 deletions
diff --git a/libcutils/Android.mk b/libcutils/Android.mk index 62c6113..d4450c6 100644 --- a/libcutils/Android.mk +++ b/libcutils/Android.mk @@ -22,7 +22,7 @@ commonSources := \ native_handle.c \ config_utils.c \ load_file.c \ - memory.c \ + strlcpy.c \ open_memstream.c \ strdup16to8.c \ strdup8to16.c \ diff --git a/libcutils/memory.c b/libcutils/strlcpy.c index 44cf127..360abc5 100644 --- a/libcutils/memory.c +++ b/libcutils/strlcpy.c @@ -1,23 +1,4 @@ /* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <cutils/memory.h> - -#if !HAVE_STRLCPY -/* * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> * * Permission to use, copy, modify, and distribute this software for any @@ -33,9 +14,15 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <features.h> + +#if defined(__GLIBC__) || defined(_WIN32) + #include <sys/types.h> #include <string.h> +#include <cutils/memory.h> + /* Implementation of strlcpy() for platforms that don't already have it. */ /* @@ -68,4 +55,5 @@ strlcpy(char *dst, const char *src, size_t siz) return(s - src - 1); /* count does not include NUL */ } + #endif |