LCOV - code coverage report
Current view: directory - usr/include/secure - _string.h (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 11 11 100.0 %
Date: 2014-06-18 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright (c) 2007 Apple Inc. All rights reserved.
       3                 :  *
       4                 :  * @APPLE_LICENSE_HEADER_START@
       5                 :  *
       6                 :  * This file contains Original Code and/or Modifications of Original Code
       7                 :  * as defined in and that are subject to the Apple Public Source License
       8                 :  * Version 2.0 (the 'License'). You may not use this file except in
       9                 :  * compliance with the License. Please obtain a copy of the License at
      10                 :  * http://www.opensource.apple.com/apsl/ and read it before using this
      11                 :  * file.
      12                 :  *
      13                 :  * The Original Code and all software distributed under the License are
      14                 :  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
      15                 :  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
      16                 :  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
      17                 :  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
      18                 :  * Please see the License for the specific language governing rights and
      19                 :  * limitations under the License.
      20                 :  *
      21                 :  * @APPLE_LICENSE_HEADER_END@
      22                 :  */
      23                 : 
      24                 : #ifndef _STRING_H_
      25                 : # error "Never use <secure/_string.h> directly; include <string.h> instead."
      26                 : #endif
      27                 : 
      28                 : #ifndef _SECURE__STRING_H_
      29                 : #define _SECURE__STRING_H_
      30                 : 
      31                 : #include <sys/cdefs.h>
      32                 : #include <secure/_common.h>
      33                 : 
      34                 : #if _USE_FORTIFY_LEVEL > 0
      35                 : 
      36                 : /* memcpy, mempcpy, memmove, memset, strcpy, stpcpy, strncpy, strcat
      37                 :    and strncat */
      38                 : 
      39                 : #undef memcpy
      40                 : #undef memmove
      41                 : #undef memset
      42                 : #undef strcpy
      43                 : #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
      44                 : #undef stpcpy
      45                 : #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
      46                 : #undef strncpy
      47                 : #undef strcat
      48                 : #undef strncat
      49                 : 
      50                 : #define memcpy(dest, src, len)                                  \
      51                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
      52                 :    ? __builtin___memcpy_chk (dest, src, len, __darwin_obsz0 (dest))     \
      53                 :    : __inline_memcpy_chk (dest, src, len))
      54                 : 
      55                 : static __inline void *
      56         4487470 : __inline_memcpy_chk (void *__dest, const void *__src, size_t __len)
      57                 : {
      58         4487470 :   return __builtin___memcpy_chk (__dest, __src, __len, __darwin_obsz0(__dest));
      59                 : }
      60                 : 
      61                 : #define memmove(dest, src, len)                                 \
      62                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
      63                 :    ? __builtin___memmove_chk (dest, src, len, __darwin_obsz0 (dest))    \
      64                 :    : __inline_memmove_chk (dest, src, len))
      65                 : 
      66                 : static __inline void *
      67           36143 : __inline_memmove_chk (void *__dest, const void *__src, size_t __len)
      68                 : {
      69           36143 :   return __builtin___memmove_chk (__dest, __src, __len, __darwin_obsz0(__dest));
      70                 : }
      71                 : 
      72                 : #define memset(dest, val, len)                                  \
      73                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
      74                 :    ? __builtin___memset_chk (dest, val, len, __darwin_obsz0 (dest))     \
      75                 :    : __inline_memset_chk (dest, val, len))
      76                 : 
      77                 : static __inline void *
      78          597311 : __inline_memset_chk (void *__dest, int __val, size_t __len)
      79                 : {
      80          597311 :   return __builtin___memset_chk (__dest, __val, __len, __darwin_obsz0(__dest));
      81                 : }
      82                 : 
      83                 : #define strcpy(dest, src)                                       \
      84                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
      85                 :    ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
      86                 :    : __inline_strcpy_chk (dest, src))
      87                 : 
      88                 : static __inline char *
      89           24806 : __inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
      90                 : {
      91           24806 :   return __builtin___strcpy_chk (__dest, __src, __darwin_obsz(__dest));
      92                 : }
      93                 : 
      94                 : #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
      95                 : #define stpcpy(dest, src)                                       \
      96                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
      97                 :    ? __builtin___stpcpy_chk (dest, src, __darwin_obsz (dest))           \
      98                 :    : __inline_stpcpy_chk (dest, src))
      99                 : 
     100                 : static __inline char *
     101                 : __inline_stpcpy_chk (char *__dest, const char *__src)
     102                 : {
     103                 :   return __builtin___stpcpy_chk (__dest, __src, __darwin_obsz(__dest));
     104                 : }
     105                 : #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
     106                 : 
     107                 : #define strncpy(dest, src, len)                                 \
     108                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
     109                 :    ? __builtin___strncpy_chk (dest, src, len, __darwin_obsz (dest))     \
     110                 :    : __inline_strncpy_chk (dest, src, len))
     111                 : 
     112                 : static __inline char *
     113            9063 : __inline_strncpy_chk (char *__restrict __dest, const char *__restrict __src,
     114            9063 :                       size_t __len)
     115                 : {
     116            9063 :   return __builtin___strncpy_chk (__dest, __src, __len, __darwin_obsz(__dest));
     117                 : }
     118                 : 
     119                 : #define strcat(dest, src)                                       \
     120                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
     121                 :    ? __builtin___strcat_chk (dest, src, __darwin_obsz (dest))           \
     122                 :    : __inline_strcat_chk (dest, src))
     123                 : 
     124                 : static __inline char *
     125                 : __inline_strcat_chk (char *__restrict __dest, const char *__restrict __src)
     126                 : {
     127                 :   return __builtin___strcat_chk (__dest, __src, __darwin_obsz(__dest));
     128                 : }
     129                 : 
     130                 : #define strncat(dest, src, len)                                 \
     131                 :   ((__darwin_obsz0 (dest) != (size_t) -1)                               \
     132                 :    ? __builtin___strncat_chk (dest, src, len, __darwin_obsz (dest))     \
     133                 :    : __inline_strncat_chk (dest, src, len))
     134                 : 
     135                 : static __inline char *
     136                 : __inline_strncat_chk (char *__restrict __dest, const char *__restrict __src,
     137                 :                       size_t __len)
     138                 : {
     139                 :   return __builtin___strncat_chk (__dest, __src, __len, __darwin_obsz(__dest));
     140                 : }
     141                 : 
     142                 : #endif
     143                 : #endif

Generated by: LCOV version 1.7