1 /* Jitter: string utility functions: implementation. 2 3 Copyright (C) 2017 Luca Saiu 4 Written by Luca Saiu 5 6 This file is part of Jitter. 7 8 Jitter is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 Jitter is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with Jitter. If not, see <http://www.gnu.org/licenses/>. */ 20 21 22 #include <assert.h> 23 #include <string.h> 24 25 #include "jitter-malloc.h" 26 #include "jitter-string.h" 27 28 char * jitter_clone_string(const char * s)29jitter_clone_string (const char *s) 30 { 31 assert (s != NULL); 32 size_t size = strlen (s); 33 char * res = jitter_xmalloc (size + 1); 34 strcpy (res, s); 35 return res; 36 } 37