1141cc406Sopenharmony_ci/* Copyright (C) 1997 Free Software Foundation, Inc. 2141cc406Sopenharmony_ciThis file is part of the GNU C Library. 3141cc406Sopenharmony_ci 4141cc406Sopenharmony_ciThe GNU C Library is free software; you can redistribute it and/or 5141cc406Sopenharmony_cimodify it under the terms of the GNU Library General Public License as 6141cc406Sopenharmony_cipublished by the Free Software Foundation; either version 2 of the 7141cc406Sopenharmony_ciLicense, or (at your option) any later version. 8141cc406Sopenharmony_ci 9141cc406Sopenharmony_ciThe GNU C Library is distributed in the hope that it will be useful, 10141cc406Sopenharmony_cibut WITHOUT ANY WARRANTY; without even the implied warranty of 11141cc406Sopenharmony_ciMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12141cc406Sopenharmony_ciLibrary General Public License for more details. 13141cc406Sopenharmony_ci 14141cc406Sopenharmony_ciYou should have received a copy of the GNU Library General Public 15141cc406Sopenharmony_ciLicense along with the GNU C Library; see the file COPYING.LIB. If 16141cc406Sopenharmony_cinot, see <https://www.gnu.org/licenses/>. */ 17141cc406Sopenharmony_ci 18141cc406Sopenharmony_ci#include "../include/sane/config.h" 19141cc406Sopenharmony_ci 20141cc406Sopenharmony_ci#include <stdlib.h> 21141cc406Sopenharmony_ci#include <string.h> 22141cc406Sopenharmony_ci 23141cc406Sopenharmony_ci#ifndef HAVE_STRDUP 24141cc406Sopenharmony_ci 25141cc406Sopenharmony_cichar * 26141cc406Sopenharmony_cistrdup (const char * s) 27141cc406Sopenharmony_ci{ 28141cc406Sopenharmony_ci char *clone; 29141cc406Sopenharmony_ci size_t size; 30141cc406Sopenharmony_ci 31141cc406Sopenharmony_ci size = strlen (s) + 1; 32141cc406Sopenharmony_ci clone = malloc (size); 33141cc406Sopenharmony_ci memcpy (clone, s, size); 34141cc406Sopenharmony_ci return clone; 35141cc406Sopenharmony_ci} 36141cc406Sopenharmony_ci 37141cc406Sopenharmony_ci#endif /* !HAVE_STRDUP */ 38