LCOV - code coverage report
Current view: top level - libc/string - strdup.c (source / functions) Coverage Total Hit
Test: skiboot.info Lines: 100.0 % 5 5
Test Date: 2025-01-24 18:40:10 Functions: - 0 0
Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /******************************************************************************
       2                 :             :  * Copyright (c) 2012 IBM Corporation
       3                 :             :  * All rights reserved.
       4                 :             :  * This program and the accompanying materials
       5                 :             :  * are made available under the terms of the BSD License
       6                 :             :  * which accompanies this distribution, and is available at
       7                 :             :  * http://www.opensource.org/licenses/bsd-license.php
       8                 :             :  *
       9                 :             :  * Contributors:
      10                 :             :  *     IBM Corporation - initial implementation
      11                 :             :  *****************************************************************************/
      12                 :             : 
      13                 :             : #include <stdlib.h>
      14                 :             : 
      15                 :             : size_t strlen(const char *s);
      16                 :             : void *memcpy(void *dest, const void *src, size_t n);
      17                 :             : char *strdup(const char *src);
      18                 :             : char *strdup(const char *src)
      19                 :             : {
      20                 :          42 :         size_t len = strlen(src) + 1;
      21                 :             :         char *ret;
      22                 :             : 
      23                 :          42 :         ret = malloc(len);
      24                 :          42 :         if (ret)
      25                 :          42 :                 memcpy(ret, src, len);
      26                 :          42 :         return ret;
      27                 :             : }
        

Generated by: LCOV version 2.0-1