LCOV - code coverage report
Current view: top level - libs/libgroff - strsave.cpp (source / functions) Hit Total Coverage
Test: GNU roff Lines: 6 7 85.7 %
Date: 2026-01-16 17:51:41 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Copyright 1989-2020 Free Software Foundation, Inc.
       2             :      Written by James Clark (jjc@jclark.com)
       3             : 
       4             : This file is part of groff, the GNU roff typesetting system.
       5             : 
       6             : groff is free software; you can redistribute it and/or modify it under
       7             : the terms of the GNU General Public License as published by the Free
       8             : Software Foundation, either version 3 of the License, or
       9             : (at your option) any later version.
      10             : 
      11             : groff is distributed in the hope that it will be useful, but WITHOUT ANY
      12             : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14             : for more details.
      15             : 
      16             : You should have received a copy of the GNU General Public License
      17             : along with this program.  If not, see <http://www.gnu.org/licenses/>. */
      18             : 
      19             : #ifdef HAVE_CONFIG_H
      20             : #include <config.h>
      21             : #endif
      22             : 
      23             : #include <string.h>
      24             : #include <stdlib.h>
      25             : 
      26      171730 : char *strsave(const char *s)
      27             : {
      28      171730 :   if (s == 0)
      29           0 :     return 0;
      30      171730 :   char *p = (char*)malloc(strlen(s) + 1);
      31      171730 :   if (p != 0)
      32      171730 :     strcpy(p, s);
      33      171730 :   return p;
      34             : }
      35             : 
      36             : // Local Variables:
      37             : // fill-column: 72
      38             : // mode: C++
      39             : // End:
      40             : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72:

Generated by: LCOV version 1.14