am adc10102: am 4c1d4a0e: Merge "Be more intention-revealing with libcutils\' strlcpy."

* commit 'adc10102492a3d46478d6687a3cfcc4d6488c1fb':
  Be more intention-revealing with libcutils' strlcpy.
This commit is contained in:
Elliott Hughes 2015-04-03 00:08:54 +00:00 committed by Android Git Automerger
commit b45733319d
3 changed files with 9 additions and 21 deletions

View file

@ -30,7 +30,7 @@ void android_memset16(uint16_t* dst, uint16_t value, size_t size);
/* size is given in bytes and must be multiple of 4 */ /* size is given in bytes and must be multiple of 4 */
void android_memset32(uint32_t* dst, uint32_t value, size_t size); void android_memset32(uint32_t* dst, uint32_t value, size_t size);
#if !HAVE_STRLCPY #if defined(__GLIBC__) || defined(_WIN32)
/* Declaration of strlcpy() for platforms that don't already have it. */ /* Declaration of strlcpy() for platforms that don't already have it. */
size_t strlcpy(char *dst, const char *src, size_t size); size_t strlcpy(char *dst, const char *src, size_t size);
#endif #endif

View file

@ -22,7 +22,7 @@ commonSources := \
native_handle.c \ native_handle.c \
config_utils.c \ config_utils.c \
load_file.c \ load_file.c \
memory.c \ strlcpy.c \
open_memstream.c \ open_memstream.c \
strdup16to8.c \ strdup16to8.c \
strdup8to16.c \ strdup8to16.c \

View file

@ -1,22 +1,3 @@
/*
* 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> * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
* *
@ -33,9 +14,15 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <features.h>
#if defined(__GLIBC__) || defined(_WIN32)
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
#include <cutils/memory.h>
/* Implementation of strlcpy() for platforms that don't already have it. */ /* 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 */ return(s - src - 1); /* count does not include NUL */
} }
#endif #endif